From nobody Fri May 1 11:59:21 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g6V2R1KSGz6cVqL for ; Fri, 01 May 2026 11:59:27 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g6V2Q6Pnqz3Dtn for ; Fri, 01 May 2026 11:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777636766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7z+/qhjqCgYZMAOckcOY9Qo3e13+V856BOdZlzBuzns=; b=xcnMLHW02olVROO61q+XcJ4MZlomRdwvDQavdc7InRC2IeczZMkP2W06eaJrsF//txkmPS xFdRLocml2Tq0DKRUUnYSia51FrYM8P00D30V32KLScKURmJH1Ox9vGltdDlw3f3NJDmWH kwT/Cb0ApJYtomYbJKbD3qQc+PEuPwmKydvMeLihFLP2TdetGcrb2X5tUMiRIYrMb70Pfu 50O78yCFU6PwLbEEACEFfCAX4i3NFiyFaPYBem2C6ivb3dFovAyZzkQGtT3lmQlyy94/A/ KMFpbGv10pJ207NEezsy/uwbgzWHPAxEATFSXXfTX9BoxQRIe2zf7MIBD2zRrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777636766; a=rsa-sha256; cv=none; b=NBlFWVMwfNdCdLXJVyngpExtiZ/XHW5e4+Ey9c6lke3+9j0gOIIj0UaDLjLYzcRdslWptl b2AjpyL7jAbq/+gdPoxAlR7dsI+LARvr5iyXaQIKp6ziyapPCwMtMgHXV2UiQ9894BHWJw rH2wPRhBO19ChyQLaZiHDHv+7aGeAwxnQNDyjByINOSiViFohnAiJliIaUh+u74K0RjnHP PpAlTJ4x6tLA7qTXA/E04/ry72kQBvv20xG4Zhd9tnWkr5VPfGok20uzg6XoPsxoWeB8EI MX8OdK9AqRnSdDERPXMYuSyQGKfPJhsTBHlJCBKA7U0BRqXxA0LLRou0Iirahw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777636766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7z+/qhjqCgYZMAOckcOY9Qo3e13+V856BOdZlzBuzns=; b=W2Ik5RrX1AbrXSGc4TIX1PoNuIGE0cSFa8tN4GgKhqmrUO1T8L2cLK1U/ehf7NwXNl5Bra QxClknJ5UIJjWojlm3p+miKt8LFdJHk3V/ipunPLT7n5fUdkK9tgX7HKpWvXLgy5IdK380 e36QDFLhbaNq0XZRGE+hRYX4CA0hDI6FUZBoEt7OAnxhszsAfyxKdRnSC2i1acfnw5J+0S YsMBnorGCorXh0kI6j2yZysS4jaf3qz+j3oWbvhm4Up2FX8Mpgvejkd+a/OrLu1VtJrOSA CxxArdQSikaa/BePpw5Q9WtdhYo7sJM1S6V91lSeDWVr5NDl80i7q9SYBNW7Og== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g6V2Q5WpTzxhp for ; Fri, 01 May 2026 11:59:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 367fe by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 01 May 2026 11:59:21 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ricardo Branco From: Pouria Mousavizadeh Tehrani Subject: git: f4ae41b7ea5e - main - linux: Implement setfsuid(2) and setfsgid(2) as no-ops List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4ae41b7ea5efb8381a5df234b3f5e1f7569f9b0 Auto-Submitted: auto-generated Date: Fri, 01 May 2026 11:59:21 +0000 Message-Id: <69f49599.367fe.30c6d2d9@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=f4ae41b7ea5efb8381a5df234b3f5e1f7569f9b0 commit f4ae41b7ea5efb8381a5df234b3f5e1f7569f9b0 Author: Ricardo Branco AuthorDate: 2026-04-29 18:27:22 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-05-01 11:52:37 +0000 linux: Implement setfsuid(2) and setfsgid(2) as no-ops These system calls exist to decouple the Linux filesystem credentials from the effective credentials, avoiding signal exposure during privilege transitions. The signal permission model that motivated this was revised in Linux 2.0, making these syscalls obsolete for new applications. Implement both syscalls as no-ops that return the current effective UID/GID as the previous filesystem UID/GID. Linux returns the previous filesystem UID/GID for these syscalls with no error indication. Same for the equivalent setfsuid16() & setfsgid16() system calls. Signed-off-by: Ricardo Branco PR: 294879 Reviewed by: kib, pouria Pull-Request: https://github.com/freebsd/freebsd-src/pull/2175 --- sys/compat/linux/linux_dummy.c | 2 -- sys/compat/linux/linux_misc.c | 26 ++++++++++++++++++++++++++ sys/compat/linux/linux_uid16.c | 16 ++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c index dfabf33eb8a6..971e070e90aa 100644 --- a/sys/compat/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -56,8 +56,6 @@ UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(security); UNIMPLEMENTED(vserver); -DUMMY(setfsuid); -DUMMY(setfsgid); DUMMY(vhangup); DUMMY(pivot_root); DUMMY(adjtimex); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 4c8ad669f03c..f89758f41ba0 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -3179,4 +3179,30 @@ linux_membarrier(struct thread *td, struct linux_membarrier_args *args) return (0); } +/* + * setfsuid() & setfsgid() exist to decouple the Linux filesystem credentials + * from the effective credentials, avoiding signal exposure during privilege + * transitions. The signal permission model that motivated this was revised in + * Linux 2.0, making these syscalls obsolete for new applications. + * + * As there's no FreeBSD equivalent, implement both syscalls as no-ops that + * return the current effective UID/GID as the previous filesystem UID/GID. + * Linux returns the previous filesystem UID/GID for these syscalls, with no + * error indication. + */ + +int +linux_setfsuid(struct thread *td, struct linux_setfsuid_args *args) +{ + td->td_retval[0] = td->td_ucred->cr_uid; + return (0); +} + +int +linux_setfsgid(struct thread *td, struct linux_setfsgid_args *args) +{ + td->td_retval[0] = td->td_ucred->cr_gid; + return (0); +} + MODULE_DEPEND(linux, mqueuefs, 1, 1, 1); diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c index 8ac093e004d0..16866c374aa2 100644 --- a/sys/compat/linux/linux_uid16.c +++ b/sys/compat/linux/linux_uid16.c @@ -59,8 +59,6 @@ LIN_SDT_PROBE_DEFINE1(uid16, linux_setgroups16, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(uid16, linux_setgroups16, priv_check_cred_error, "int"); LIN_SDT_PROBE_DEFINE1(uid16, linux_getgroups16, copyout_error, "int"); -DUMMY(setfsuid16); -DUMMY(setfsgid16); DUMMY(getresuid16); DUMMY(getresgid16); @@ -284,3 +282,17 @@ linux_setresuid16(struct thread *td, struct linux_setresuid16_args *args) return (error); } + +int +linux_setfsuid16(struct thread *td, struct linux_setfsuid16_args *args) +{ + td->td_retval[0] = td->td_ucred->cr_uid; + return (0); +} + +int +linux_setfsgid16(struct thread *td, struct linux_setfsgid16_args *args) +{ + td->td_retval[0] = td->td_ucred->cr_gid; + return (0); +}