]> Cypherpunks repositories - gostls13.git/commit
syscall: honor prlimit set by a different process
authorIan Lance Taylor <iant@golang.org>
Wed, 21 Aug 2024 20:43:42 +0000 (13:43 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 30 Aug 2024 19:55:07 +0000 (19:55 +0000)
commit44483133fd991ec929fb1404e087d08f679c8d28
treebdaacb8208b65fb62b996f68e64193104dbd43db
parent7b0fdd13230038aabf249f0335097a2cdc233f5c
syscall: honor prlimit set by a different process

On Linux one process can call prlimit to change the resource limit
of another process. With this change we treat that as though the
current process called prlimit (or setrlimit) to set its own limit.
The cost is one additional getrlimit system call per fork/exec,
for cases in which the rlimit Cur and Max values differ at startup.

This revealed a bug: the setrlimit (not Setrlimit) function should not
change the cached rlimit. That means that it must call prlimit1, not prlimit.

Fixes #66797

Change-Id: I46bfd06e09ab7273fe8dd9b5b744dffdf31d828b
Reviewed-on: https://go-review.googlesource.com/c/go/+/607516
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Aleksa Sarai <cyphar@cyphar.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/syscall/exec_linux.go
src/syscall/rlimit.go
src/syscall/syscall_linux.go
src/syscall/syscall_linux_test.go