diff options
Diffstat (limited to 'src/syscall/exec_linux.go')
-rw-r--r-- | src/syscall/exec_linux.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 554aad412d..cb7127771e 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -171,6 +171,8 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att uidmap, setgroups, gidmap []byte ) + rlim, rlimOK := origRlimitNofile.Load().(Rlimit) + if sys.UidMappings != nil { puid = []byte("/proc/self/uid_map\000") uidmap = formatIDMappings(sys.UidMappings) @@ -519,6 +521,11 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att } } + // Restore original rlimit. + if rlimOK && rlim.Cur != 0 { + rawSetrlimit(RLIMIT_NOFILE, &rlim) + } + // Enable tracing if requested. // Do this right before exec so that we don't unnecessarily trace the runtime // setting up after the fork. See issue #21428. |