linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: John Johansen <john.johansen@canonical.com>
Cc: Shen Lichuan <shenlichuan@vivo.com>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function
Date: Tue, 10 Sep 2024 15:57:44 -0500	[thread overview]
Message-ID: <20240910205744.GA314978@mail.hallyn.com> (raw)
In-Reply-To: <46fc455c-385c-44fb-b194-0fd046f6d21c@canonical.com>

On Mon, Sep 09, 2024 at 11:57:05PM -0700, John Johansen wrote:
> On 8/21/24 00:22, Shen Lichuan wrote:
> > The code was unpacking the 'allow' parameter twice.
> > This change removes the duplicate part.
> > 
> > Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> 
> NAK, this would break the unpack. The first entry is actually a reserved
> value and is just being thrown away atm. Instead of double unpacking to
> perms->allow we could unpack it to a temp variable that just gets discarded

Heh, I recon this should probably be documented in a comment? :)
> 
> 
> > ---
> >   security/apparmor/policy_unpack.c | 1 -
> >   1 file changed, 1 deletion(-)
> > 
> > diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
> > index 5a570235427d..4ec1e1251012 100644
> > --- a/security/apparmor/policy_unpack.c
> > +++ b/security/apparmor/policy_unpack.c
> > @@ -649,7 +649,6 @@ static bool unpack_perm(struct aa_ext *e, u32 version, struct aa_perms *perm)
> >   		return false;
> >   	return	aa_unpack_u32(e, &perm->allow, NULL) &&
> > -		aa_unpack_u32(e, &perm->allow, NULL) &&
> >   		aa_unpack_u32(e, &perm->deny, NULL) &&
> >   		aa_unpack_u32(e, &perm->subtree, NULL) &&
> >   		aa_unpack_u32(e, &perm->cond, NULL) &&
> 

  reply	other threads:[~2024-09-10 21:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  7:22 [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function Shen Lichuan
2024-09-10  6:57 ` John Johansen
2024-09-10 20:57   ` Serge E. Hallyn [this message]
2024-09-10 23:22     ` John Johansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240910205744.GA314978@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=apparmor@lists.ubuntu.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=paul@paul-moore.com \
    --cc=shenlichuan@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).