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