* [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function
@ 2024-08-21 7:22 Shen Lichuan
2024-09-10 6:57 ` John Johansen
0 siblings, 1 reply; 4+ messages in thread
From: Shen Lichuan @ 2024-08-21 7:22 UTC (permalink / raw)
To: John Johansen, Paul Moore, James Morris, Serge E. Hallyn,
apparmor, linux-security-module, linux-kernel
Cc: opensource.kernel, Shen Lichuan
The code was unpacking the 'allow' parameter twice.
This change removes the duplicate part.
Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
---
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) &&
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function
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
0 siblings, 1 reply; 4+ messages in thread
From: John Johansen @ 2024-09-10 6:57 UTC (permalink / raw)
To: Shen Lichuan, Paul Moore, James Morris, Serge E. Hallyn, apparmor,
linux-security-module, linux-kernel
Cc: opensource.kernel
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
> ---
> 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) &&
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function
2024-09-10 6:57 ` John Johansen
@ 2024-09-10 20:57 ` Serge E. Hallyn
2024-09-10 23:22 ` John Johansen
0 siblings, 1 reply; 4+ messages in thread
From: Serge E. Hallyn @ 2024-09-10 20:57 UTC (permalink / raw)
To: John Johansen
Cc: Shen Lichuan, Paul Moore, James Morris, Serge E. Hallyn, apparmor,
linux-security-module, linux-kernel, opensource.kernel
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) &&
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] security/apparmor: remove duplicate unpacking in unpack_perm function
2024-09-10 20:57 ` Serge E. Hallyn
@ 2024-09-10 23:22 ` John Johansen
0 siblings, 0 replies; 4+ messages in thread
From: John Johansen @ 2024-09-10 23:22 UTC (permalink / raw)
To: Serge E. Hallyn
Cc: Shen Lichuan, Paul Moore, James Morris, apparmor,
linux-security-module, linux-kernel, opensource.kernel
On 9/10/24 13:57, Serge E. Hallyn wrote:
> 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? :)
yes, definitely.
>>
>>
>>> ---
>>> 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) &&
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-10 23:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-09-10 23:22 ` John Johansen
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).