linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] apparmor: Fix incorrect profile->signal range check
@ 2025-05-06 17:04 Colin Ian King
  2025-05-06 17:07 ` Ryan Lee
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Ian King @ 2025-05-06 17:04 UTC (permalink / raw)
  To: John Johansen, Paul Moore, James Morris, Serge E . Hallyn,
	apparmor, linux-security-module
  Cc: kernel-janitors, linux-kernel

The check on profile->signal is always false, the value can never be
less than 1 *and* greater than MAXMAPPED_SIG. Fix this by replacing
the logical operator && with ||.

Fixes: 84c455decf27 ("apparmor: add support for profiles to define the kill signal")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 security/apparmor/policy_unpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 73139189df0f..e643514a3d92 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -919,7 +919,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
 
 	/* optional */
 	(void) aa_unpack_u32(e, &profile->signal, "kill");
-	if (profile->signal < 1 && profile->signal > MAXMAPPED_SIG) {
+	if (profile->signal < 1 || profile->signal > MAXMAPPED_SIG) {
 		info = "profile kill.signal invalid value";
 		goto fail;
 	}
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] apparmor: Fix incorrect profile->signal range check
  2025-05-06 17:04 [PATCH][next] apparmor: Fix incorrect profile->signal range check Colin Ian King
@ 2025-05-06 17:07 ` Ryan Lee
  2025-05-17  8:44   ` John Johansen
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Lee @ 2025-05-06 17:07 UTC (permalink / raw)
  To: Colin Ian King
  Cc: John Johansen, Paul Moore, James Morris, Serge E . Hallyn,
	apparmor, linux-security-module, kernel-janitors, linux-kernel

On Tue, May 6, 2025 at 10:04 AM Colin Ian King <colin.i.king@gmail.com> wrote:
>
> The check on profile->signal is always false, the value can never be
> less than 1 *and* greater than MAXMAPPED_SIG. Fix this by replacing
> the logical operator && with ||.
>
> Fixes: 84c455decf27 ("apparmor: add support for profiles to define the kill signal")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  security/apparmor/policy_unpack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
> index 73139189df0f..e643514a3d92 100644
> --- a/security/apparmor/policy_unpack.c
> +++ b/security/apparmor/policy_unpack.c
> @@ -919,7 +919,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
>
>         /* optional */
>         (void) aa_unpack_u32(e, &profile->signal, "kill");
> -       if (profile->signal < 1 && profile->signal > MAXMAPPED_SIG) {
> +       if (profile->signal < 1 || profile->signal > MAXMAPPED_SIG) {
>                 info = "profile kill.signal invalid value";
>                 goto fail;
>         }
> --
> 2.49.0
Reviewed-by: Ryan Lee <ryan.lee@canonical.com>

>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][next] apparmor: Fix incorrect profile->signal range check
  2025-05-06 17:07 ` Ryan Lee
@ 2025-05-17  8:44   ` John Johansen
  0 siblings, 0 replies; 3+ messages in thread
From: John Johansen @ 2025-05-17  8:44 UTC (permalink / raw)
  To: Ryan Lee, Colin Ian King
  Cc: Paul Moore, James Morris, Serge E . Hallyn, apparmor,
	linux-security-module, kernel-janitors, linux-kernel

On 5/6/25 10:07, Ryan Lee wrote:
> On Tue, May 6, 2025 at 10:04 AM Colin Ian King <colin.i.king@gmail.com> wrote:
>>
>> The check on profile->signal is always false, the value can never be
>> less than 1 *and* greater than MAXMAPPED_SIG. Fix this by replacing
>> the logical operator && with ||.
>>
>> Fixes: 84c455decf27 ("apparmor: add support for profiles to define the kill signal")
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>> ---
>>   security/apparmor/policy_unpack.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
>> index 73139189df0f..e643514a3d92 100644
>> --- a/security/apparmor/policy_unpack.c
>> +++ b/security/apparmor/policy_unpack.c
>> @@ -919,7 +919,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
>>
>>          /* optional */
>>          (void) aa_unpack_u32(e, &profile->signal, "kill");
>> -       if (profile->signal < 1 && profile->signal > MAXMAPPED_SIG) {
>> +       if (profile->signal < 1 || profile->signal > MAXMAPPED_SIG) {
>>                  info = "profile kill.signal invalid value";
>>                  goto fail;
>>          }
>> --
>> 2.49.0
> Reviewed-by: Ryan Lee <ryan.lee@canonical.com>
> 

Acked-by: John Johansen <john.johansen@canonical.com>

I have pulled this into my tree


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-17  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 17:04 [PATCH][next] apparmor: Fix incorrect profile->signal range check Colin Ian King
2025-05-06 17:07 ` Ryan Lee
2025-05-17  8:44   ` 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).