From nobody Sat Aug 09 15:50:29 2025 X-Original-To: bugs@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 4bzljK12nLz64Xvp for ; Sat, 09 Aug 2025 15:50:29 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bzljK0C50z3bBT for ; Sat, 09 Aug 2025 15:50:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754754629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=puQ7Ie3dmfZUNZc/Ugy91/WwpnDEfqFY9kFpTHjAyRo=; b=V5eq0Lll5j/n+GKEH23BkayHE8HQCOGp4Bww54ZiejWyk/rVBAN3uJQABrBPwPWW3KNQWS Milum7ZMSX9Ly8/tvV4kL0WUAzeEUzfxvERoSU8ixip1iPgJqdmsY6fShMd6xEfugJYItF hjffn3XOxrGC5Frk3gHfhICPqxfcUKm/ofbuTcKG3NNXcAp0ecSr8d0u0MBeEx0QRIt6Ye 9I1E1n5PsBLbVcGdQRbY1CoH/yaaiNAmsWO3/95dgcWWWddBWJX9vIf8STP5EHhMCIYCwm 5CgPM9wusmXuDh1k6J3esP3dVkB9y2cZRQa95uwnvgf/NBrvnWW0TXehpaN34w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754754629; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=puQ7Ie3dmfZUNZc/Ugy91/WwpnDEfqFY9kFpTHjAyRo=; b=qaw/QYjOtuf3qdz1w0Kvlta+V8dAB9GZuS9lUp/EpfjU+A0iFqijLl0PIuMmHha801GIP7 sgGxpzSWMS6U1LoDg/C/inKn+HXsPAFuyEBszjuk9t3awNTU6R4kOnOdh+77MH3DSUGJl6 9dc3TzIwAEm/o9GoI99+EeeCnJLs9XTqpgrebIFofqISMMGAHOG/1LIbWsYCaDPZI68p2B +8yTc1gH1CZQxdlCQHdyV9oVD6F6hNnnVotMi1/DoLlyhaHxGg3eocglDmrnfPy5LvGOBo xV7LZzixnauACXovIsbXvExCR6Rsk6X7s4jhm03wGbtTMOH6Vc0g/aR7yELoVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754754629; a=rsa-sha256; cv=none; b=Hzo2BggfGhm8k1qjJ/cifShLJ7fftVAVzNZhXLMnDqtttQd7/5hhmZTybWjtRjuqSRBs5k QZtqUlYEV4KMutGzTGcZqVbx6KFhUzS3oPQaHivbgxL7lAnY//+smU9pXamPKiDZ2Pmnkr 77ia1Hby1nWvhoSNiajdtGyDbUTszX0e4PD6MOgVId7CZOaykuBI1kXwgfzHPIZLg+ix3A 8uE43UeLDI0QUKFwC0CtC3abDzCuGHgwcm3CmpX+Sn0mJTLJHxhm75hNDjuUQLBy00P61a FkCaCxo5+oGqgj+6DjC5/Fm2cioTANhPKkvbyHim9Oh3plTV+80qHphVrUMIbQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4bzljJ6lm4zBvb for ; Sat, 09 Aug 2025 15:50:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 579FoSN1001997 for ; Sat, 9 Aug 2025 15:50:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 579FoSNb001996 for bugs@FreeBSD.org; Sat, 9 Aug 2025 15:50:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 288751] chroot -n fails with "setgroups: Operation not permitted" when security.bsd.unprivileged_chroot=1 Date: Sat, 09 Aug 2025 15:50:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: beldin@beldin.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D288751 Bug ID: 288751 Summary: chroot -n fails with "setgroups: Operation not permitted" when security.bsd.unprivileged_chroot=3D1 Product: Base System Version: 15.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: beldin@beldin.org Recent changes to chroot have resulted in chroot -n failing compared= to previous cases. The resulting error is : chroot: setgroups: Operation not permitted This appears to be caused by gids being set to a minimum of 1 (previously 0= ) at line 150 of usr.sbin/chroot/chroot.c which then results in setgroups being called at line 178 when previously a null grouplist would have caused gids = to be zero. A suggested fix would be to change line 178 from: if (gids && setgroups(gids, gidlist) =3D=3D -1) to: if (grouplist !=3D NULL && setgroups(gids, gidlist) =3D=3D -1) since previously setgroups was only called if grouplist was set via the -G command line argument. (This maintains the recent change to fill the first entry of gidlist with the egid). This change solved the issue for me. --=20 You are receiving this mail because: You are the assignee for the bug.=