syscall: add Landlock support for execve() on Linux#77630
syscall: add Landlock support for execve() on Linux#77630gnoack wants to merge 1 commit intogolang:masterfrom
Conversation
|
For a rationale on why I updated these generated files that way, please see #68595 (comment) -- the previously suggested approach to put these constants in I'm happy to implement it either way, please let me know what you prefer. |
|
This PR (HEAD: f4cd8f1) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/745940. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/745940. |
|
Message from Günther Noack: Patch Set 1: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/745940. |
|
Message from Günther Noack: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/745940. |
|
Message from Günther Noack: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/745940. |
f4cd8f1 to
ed40a01
Compare
|
This PR (HEAD: ed40a01) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/745940. Important tips:
|
ed40a01 to
95c53bb
Compare
* Extend SysProcAttr on Linux to optionally store the ruleset FD and flag arguments for landlock_restrict_self(2). * Extend forkAndExecInChild1() to invoke the system call. * Before enabling Landlock, we also unconditionally set the PR_SET_NO_NEW_PRIVS flag, which is a prerequisite for enforcing any Landlock ruleset. * Define the necessary constants unexported as _PR_SET_NO_NEW_PRIVS and _SYS_landlock_restrict_self. * The test case exercises the logic and demonstrates that it works (provided that the host Linux system has the Landlock LSM enabled). As it is customary in forkAndExecInChild1(), system calls need to be invoked with RawSyscall(), and their system call numbers are defined in the same package. (Depending on internal/syscall/unix would create an import loop.) The Landlock API is described in https://docs.kernel.org/userspace-api/landlock.html Updates landlock-lsm/go-landlock#45 Fixes golang#68595
95c53bb to
6269c26
Compare
|
This PR (HEAD: 6269c26) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/745940. Important tips:
|
|
Message from Günther Noack: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/745940. |
flag arguments for landlock_restrict_self(2).
PR_SET_NO_NEW_PRIVS flag, which is a prerequisite for enforcing any
Landlock ruleset.
and _SYS_landlock_restrict_self.
(provided that the host Linux system has the Landlock LSM enabled).
As it is customary in forkAndExecInChild1(), system calls need to be
invoked with RawSyscall(), and their system call numbers are defined
in the same package. (Depending on internal/syscall/unix would create
an import loop.)
The Landlock API is described in
https://docs.kernel.org/userspace-api/landlock.html
Updates landlock-lsm/go-landlock#45
Fixes #68595