96a45b
diff -up firefox-68.0/config/makefiles/rust.mk.rust-network-check firefox-68.0/config/makefiles/rust.mk
96a45b
--- firefox-68.0/config/makefiles/rust.mk.rust-network-check	2019-06-06 10:29:18.984737603 +0200
96a45b
+++ firefox-68.0/config/makefiles/rust.mk	2019-06-06 11:39:51.581028835 +0200
96a45b
@@ -127,7 +127,7 @@ export RUST_BACKTRACE=full
96a45b
 export MOZ_TOPOBJDIR=$(topobjdir)
96a45b
 
96a45b
 target_rust_ltoable := force-cargo-library-build
96a45b
-target_rust_nonltoable := force-cargo-test-run force-cargo-library-check $(foreach b,build check,force-cargo-program-$(b))
96a45b
+target_rust_nonltoable := force-cargo-test-run $(foreach b,build check,force-cargo-program-$(b))
96a45b
 
96a45b
 $(target_rust_ltoable): RUSTFLAGS:=$(rustflags_override) $(RUSTFLAGS) $(if $(MOZ_LTO_RUST),-Clinker-plugin-lto)
96a45b
 $(target_rust_nonltoable): RUSTFLAGS:=$(rustflags_override) $(RUSTFLAGS)
96a45b
@@ -238,19 +238,9 @@ force-cargo-library-build:
96a45b
 	$(call CARGO_BUILD) --lib $(cargo_target_flag) $(rust_features_flag) -- $(cargo_rustc_flags)
96a45b
 
96a45b
 $(RUST_LIBRARY_FILE): force-cargo-library-build
96a45b
-# When we are building in --enable-release mode; we add an additional check to confirm
96a45b
-# that we are not importing any networking-related functions in rust code. This reduces
96a45b
-# the chance of proxy bypasses originating from rust code.
96a45b
-ifndef DEVELOPER_OPTIONS
96a45b
-ifndef MOZ_DEBUG_RUST
96a45b
-ifeq ($(OS_ARCH), Linux)
96a45b
-	$(call py_action,check_binary,--target --networking $@)
96a45b
-endif
96a45b
-endif
96a45b
-endif
96a45b
 
96a45b
 force-cargo-library-check:
96a45b
-	$(call CARGO_CHECK) --lib $(cargo_target_flag) $(rust_features_flag)
96a45b
+	@true
96a45b
 else
96a45b
 force-cargo-library-check:
96a45b
 	@true
96a45b
diff -up firefox-68.0/python/mozbuild/mozbuild/action/check_binary.py.rust-network-check firefox-68.0/python/mozbuild/mozbuild/action/check_binary.py
96a45b
--- firefox-68.0/python/mozbuild/mozbuild/action/check_binary.py.rust-network-check	2019-05-20 18:17:57.000000000 +0200
96a45b
+++ firefox-68.0/python/mozbuild/mozbuild/action/check_binary.py	2019-06-06 10:29:18.986737599 +0200
96a45b
@@ -250,43 +250,6 @@ def check_mozglue_order(target, binary):
96a45b
         raise RuntimeError('Could not parse readelf output?')
96a45b
 
96a45b
 
96a45b
-def check_networking(binary):
96a45b
-    retcode = 0
96a45b
-    networking_functions = set([
96a45b
-        # socketpair is not concerning; it is restricted to AF_UNIX
96a45b
-        "socket", "connect", "accept", "bind", "listen",
96a45b
-        "getsockname", "getsockopt", "setsockopt",
96a45b
-        "recv", "recvfrom",
96a45b
-        "send", "sendto",
96a45b
-        # We would be concerned by recvmsg and sendmsg; but we believe
96a45b
-        # they are okay as documented in 1376621#c23
96a45b
-        "gethostbyname", "gethostbyaddr", "gethostent", "sethostent", "endhostent",
96a45b
-        "gethostent_r", "gethostbyname2", "gethostbyaddr_r", "gethostbyname_r",
96a45b
-        "gethostbyname2_r",
96a45b
-        "getaddrinfo", "getservent", "getservbyname", "getservbyport", "setservent",
96a45b
-        "getprotoent", "getprotobyname", "getprotobynumber", "setprotoent",
96a45b
-        "endprotoent"])
96a45b
-    bad_occurences_names = set()
96a45b
-
96a45b
-    try:
96a45b
-        for sym in at_least_one(iter_symbols(binary)):
96a45b
-            if sym['addr'] == 0 and sym['name'] in networking_functions:
96a45b
-                bad_occurences_names.add(sym['name'])
96a45b
-    except Empty:
96a45b
-        raise RuntimeError('Could not parse llvm-objdump output?')
96a45b
-
96a45b
-    basename = os.path.basename(binary)
96a45b
-    if bad_occurences_names:
96a45b
-        s = 'TEST-UNEXPECTED-FAIL | check_networking | {} | Identified {} ' + \
96a45b
-            'networking function(s) being imported in the rust static library ({})'
96a45b
-        print(s.format(basename, len(bad_occurences_names),
96a45b
-            ",".join(sorted(bad_occurences_names))),
96a45b
-            file=sys.stderr)
96a45b
-        retcode = 1
96a45b
-    elif buildconfig.substs.get('MOZ_AUTOMATION'):
96a45b
-        print('TEST-PASS | check_networking | {}'.format(basename))
96a45b
-    return retcode
96a45b
-
96a45b
 def checks(target, binary):
96a45b
     # The clang-plugin is built as target but is really a host binary.
96a45b
     # Cheat and pretend we were passed the right argument.
96a45b
@@ -330,8 +293,6 @@ def main(args):
96a45b
                         help='Perform checks for a host binary')
96a45b
     parser.add_argument('--target', action='store_true',
96a45b
                         help='Perform checks for a target binary')
96a45b
-    parser.add_argument('--networking', action='store_true',
96a45b
-                        help='Perform checks for networking functions')
96a45b
 
96a45b
     parser.add_argument('binary', metavar='PATH',
96a45b
                         help='Location of the binary to check')
96a45b
@@ -343,14 +304,7 @@ def main(args):
96a45b
               file=sys.stderr)
96a45b
         return 1
96a45b
 
96a45b
-    if options.networking and options.host:
96a45b
-        print('--networking is only valid with --target',
96a45b
-               file=sys.stderr)
96a45b
-        return 1
96a45b
-
96a45b
-    if options.networking:
96a45b
-        return check_networking(options.binary)
96a45b
-    elif options.host:
96a45b
+    if options.host:
96a45b
         return checks(HOST, options.binary)
96a45b
     elif options.target:
96a45b
         return checks(TARGET, options.binary)