From owner-dev-commits-src-main@freebsd.org Sat Jul 3 07:59:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A152164D5AD; Sat, 3 Jul 2021 07:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GH49j3mmHz4RCl; Sat, 3 Jul 2021 07:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69C5D238E8; Sat, 3 Jul 2021 07:59:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1637xrZY095435; Sat, 3 Jul 2021 07:59:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1637xrVa095434; Sat, 3 Jul 2021 07:59:53 GMT (envelope-from git) Date: Sat, 3 Jul 2021 07:59:53 GMT Message-Id: <202107030759.1637xrVa095434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 2f514e6f13de - main - linux(4): implement PR_SET_NO_NEW_PRIVS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f514e6f13de41aa9ad5f563ed0decc66e91f99c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2021 07:59:53 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=2f514e6f13de41aa9ad5f563ed0decc66e91f99c commit 2f514e6f13de41aa9ad5f563ed0decc66e91f99c Author: Edward Tomasz Napierala AuthorDate: 2021-07-03 07:41:59 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-03 07:42:37 +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 --- 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 65a5b0dd24d7..559eb6463da0 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1982,7 +1982,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; @@ -2113,8 +2113,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");