git: b5cae0d5ed3e - stable/13 - linux(4): implement PR_SET_NO_NEW_PRIVS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Feb 2022 15:53:52 UTC
The branch stable/13 has been updated by trasz:
URL: https://cgit.FreeBSD.org/src/commit/?id=b5cae0d5ed3e9f91404c67828c9736b255e6b7bf
commit b5cae0d5ed3e9f91404c67828c9736b255e6b7bf
Author: Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-07-03 07:41:59 +0000
Commit: Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2022-02-14 00:08:55 +0000
linux(4): implement PR_SET_NO_NEW_PRIVS
This makes prctl(2) support PR_SET_NO_NEW_PRIVS, by mapping it
to the native PROC_NO_NEW_PRIVS_CTL procctl(2).
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30973
(cherry picked from commit 2f514e6f13de41aa9ad5f563ed0decc66e91f99c)
---
sys/compat/linux/linux_misc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index fc846df6689f..fb529f140d3e 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1921,7 +1921,7 @@ linux_capset(struct thread *td, struct linux_capset_args *uap)
int
linux_prctl(struct thread *td, struct linux_prctl_args *args)
{
- int error = 0, max_size;
+ int error = 0, max_size, arg;
struct proc *p = td->td_proc;
char comm[LINUX_MAX_COMM_LEN];
int pdeath_signal, trace_state;
@@ -2052,8 +2052,10 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args)
error = EINVAL;
break;
case LINUX_PR_SET_NO_NEW_PRIVS:
- linux_msg(td, "unsupported prctl PR_SET_NO_NEW_PRIVS");
- error = EINVAL;
+ arg = args->arg2 == 1 ?
+ PROC_NO_NEW_PRIVS_ENABLE : PROC_NO_NEW_PRIVS_DISABLE;
+ error = kern_procctl(td, P_PID, p->p_pid,
+ PROC_NO_NEW_PRIVS_CTL, &arg);
break;
case LINUX_PR_SET_PTRACER:
linux_msg(td, "unsupported prctl PR_SET_PTRACER");