From nobody Fri Feb 03 01:00:39 2023 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 4P7HQJ1fylz3kmvB; Fri, 3 Feb 2023 01:00:40 +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 4P7HQJ0sJQz3tJx; Fri, 3 Feb 2023 01:00:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675386040; 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=DO0tqXfZFQa/cI4tzr3kP9KPzZl3mrEx0Yz9KkQJqT0=; b=h87W//+avVN1c/J6REHEaMGOTVjypprcFdKKuH75qaHWYzP1VWLg07IO4XISUX91XoaVwL GDxnrsTYzACbd6HF4uQ5bxr2AN4SCqAdElG1KiCEU48NvJZL5F872KhfTRgIdqpf60Ztwe LZ/qd+P+a31zDdrYyGiLAVwjg5fLmZor+xeF5eg7Am4VGnQdswhos6ce5UAW/KCkMXRAmF wAbVmgauXdkSBMYnWc7agPTa2ZpNPxtORsKlrbbvlgZgPD3XxiufGq8kOolstJuDJIf/2G k6tgsc6W568PNis+kkuTJ3MxB2zkAUcP1eVwBJ61I6XVRWJddRBWpwHN1RmWqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675386040; 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=DO0tqXfZFQa/cI4tzr3kP9KPzZl3mrEx0Yz9KkQJqT0=; b=qQ4o6RgG7HdCSB7eQCkh4yvil4550Nij5MUokzA/YzFjRhOy30fq/vjZBA/5Q3A8Q2GfVf CqJ8H6+nwsVHAktD5K234RbJVvU6FgNIGDdeQ0rmCzThpxHpa+CQXpeXJipzIspkehfZvl kxXv+7y/PouRMesAeQah7TAIfatfgWfvsvyaaXmZQMHCMbZ+w7SNhD25Nqfr0HmMqCxQ9O ppO0w/MJLej4xW/osDvSmjeEGY16bgFGziMICheDFDg9t5a7AKtcsNByG+d5BgmOeNguSu /MCbJ0tbdqq03oAtleNUX/qgKRHsqGLO8txdniWJZs3lpjLR52mrzhgFdxOZMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675386040; a=rsa-sha256; cv=none; b=ALH0GrECMpQSHgrFepqKNOFbj0DP5vNwh6J1FJLNqDCl6tMefIcWowuZlYtgZU1dBrWhuT WWytNx7lscl7Ft6n60vb8GNpXeEJ2TbBcyXIfp2Crh8Xks/8h9hO/70ac94HGIeZ0Sjiim tlTUEpTGTkblyDY5djLwlImZqtxQXdylGxsgKYymtNmjBycofd2hBSSlmAdXixu9z7snlj hQOUGeFt+FKHvCpw3SqIfu182GRiKeARxqo4wr1MVKo4PayhTI8dSnSyoBBAvKt4lmDpVd p3TQ4PljnI7Kn5eYhhD4OVAz8m9IhzU0BmXlpgJ6OUv+sl8LYxFOFPzE+qEahA== 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 4P7HQH70XJzGMx; Fri, 3 Feb 2023 01:00:39 +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 31310dUK058625; Fri, 3 Feb 2023 01:00:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31310dlH058624; Fri, 3 Feb 2023 01:00:39 GMT (envelope-from git) Date: Fri, 3 Feb 2023 01:00:39 GMT Message-Id: <202302030100.31310dlH058624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pawel Jakub Dawidek Subject: git: c54d240eb1a0 - main - kern_prot.c p_candebug(): Remove single-use variable. 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pjd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c54d240eb1a0d23d2602ffb82d351cbfaaa94eae Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pjd: URL: https://cgit.FreeBSD.org/src/commit/?id=c54d240eb1a0d23d2602ffb82d351cbfaaa94eae commit c54d240eb1a0d23d2602ffb82d351cbfaaa94eae Author: Pawel Jakub Dawidek AuthorDate: 2023-01-31 00:15:04 +0000 Commit: Pawel Jakub Dawidek CommitDate: 2023-02-03 01:00:24 +0000 kern_prot.c p_candebug(): Remove single-use variable. Reviewed by: allanjude, oshogbo Approved by: allanjude, oshogbo Differential Revision: https://reviews.freebsd.org/D38288 --- sys/kern/kern_prot.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 942062756631..983e6ae21493 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1682,7 +1682,7 @@ SYSCTL_PROC(_security_bsd, OID_AUTO, unprivileged_proc_debug, int p_candebug(struct thread *td, struct proc *p) { - int credentialchanged, error, grpsubset, i, uidsubset; + int error, grpsubset, i, uidsubset; KASSERT(td == curthread, ("%s: td not curthread", __func__)); PROC_LOCK_ASSERT(p, MA_OWNED); @@ -1724,11 +1724,6 @@ p_candebug(struct thread *td, struct proc *p) td->td_ucred->cr_uid == p->p_ucred->cr_svuid && td->td_ucred->cr_uid == p->p_ucred->cr_ruid); - /* - * Has the credential of the process changed since the last exec()? - */ - credentialchanged = (p->p_flag & P_SUGID); - /* * If p's gids aren't a subset, or the uids aren't a subset, * or the credential has changed, require appropriate privilege @@ -1740,7 +1735,10 @@ p_candebug(struct thread *td, struct proc *p) return (error); } - if (credentialchanged) { + /* + * Has the credential of the process changed since the last exec()? + */ + if ((p->p_flag & P_SUGID) != 0) { error = priv_check(td, PRIV_DEBUG_SUGID); if (error) return (error);