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