[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f3e7f421323bb99c12507299a658d572@paul-moore.com>
Date: Wed, 28 Aug 2024 13:42:09 -0400
From: Paul Moore <paul@...l-moore.com>
To: Zhen Lei <thunder.leizhen@...wei.com>, Stephen Smalley <stephen.smalley.work@...il.com>, Ondrej Mosnacek <omosnace@...hat.com>, <selinux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Cc: Zhen Lei <thunder.leizhen@...wei.com>
Subject: Re: [PATCH 1/1] selinux: simplify avc_xperms_audit_required()
On Aug 22, 2024 Zhen Lei <thunder.leizhen@...wei.com> wrote:
>
> By associative and commutative laws, the result of the two 'audited' is
> zero. Take the second 'audited' as an example:
> 1) audited = requested & avd->auditallow;
> 2) audited &= ~requested;
> ==> audited = ~requested & (requested & avd->auditallow);
> ==> audited = (~requested & requested) & avd->auditallow;
> ==> audited = 0 & avd->auditallow;
> ==> audited = 0;
>
> In fact, it is more readable to directly write zero. The value of the
> first 'audited' is 0 because AUDIT is not allowed. The second 'audited'
> is zero because there is no AUDITALLOW permission.
>
> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
> ---
> security/selinux/avc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Looks good to me, merged into selinux/dev, thanks!
--
paul-moore.com
Powered by blists - more mailing lists