Skip to contentSkip to conversation

apparmor: use SEND_SIG_NOINFO instead of NULL in aa_audit()

PATCH In review Oleg Nesterov 4 participants 9 messages Jul 5 – Aug 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apparmor: use SEND_SIG_NOINFO instead of NULL in aa_audit()

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

---
 security/apparmor/audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/audit.c +1 -1
index 4a60b6fda75f..15e42e96b163 100644
@@ -192,7 +192,7 @@ int aa_audit(int type, struct aa_profile *profile,
 	aa_audit_msg(type, ad, cb);
 
 	if (ad->type == AUDIT_APPARMOR_KILL)
-		(void)send_sig_info(profile->signal, NULL,
+		send_sig_info(profile->signal, SEND_SIG_NOINFO,
 			ad->common.type == LSM_AUDIT_DATA_TASK &&
 			ad->common.u.tsk ? ad->common.u.tsk : current);
 
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

- also drop the now redundant (void)

Quoted 1 line
Quoted 20 lines
---
 security/apparmor/audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/audit.c +1 -1
index 4a60b6fda75f..15e42e96b163 100644
@@ -192,7 +192,7 @@ int aa_audit(int type, struct aa_profile *profile,
 	aa_audit_msg(type, ad, cb);
 
 	if (ad->type == AUDIT_APPARMOR_KILL)
-		(void)send_sig_info(profile->signal, NULL,
+		send_sig_info(profile->signal, SEND_SIG_NOINFO,
 			ad->common.type == LSM_AUDIT_DATA_TASK &&
 			ad->common.u.tsk ? ad->common.u.tsk : current);
 
Signature · 1 line
2.52.0

Also, feel free to CC me in signal patches, so I can review, from you or from others.
Thanks!

#2 lore raw
Quoted 10 lines · Bradley Morgan
Quoted 9 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

- also drop the now redundant (void)

Yes, but the "void" cast was never necessary, I guess.

and just in case... To me the usage of SEND_SIG_NOINFO here doesn't look right with or without this change. Perhaps I am wrong, but please lets not discuss this right now, this connects to other cleanups I have in mind.

The purpose of this change is to make aa_audit() grep-friendly wrt SEND_SIG_NOINFO. And because send_sig_info(NULL) looks "just wrong" to me, no matter what.

Quoted 1 line

Thanks,

Quoted 2 lines

Also, feel free to CC me in signal patches, so I can review, from you or from others.

OK, will do.

Oleg.

#3 lore raw
Quoted 22 lines · Oleg Nesterov
Quoted 2 lines · Bradley Morgan
Quoted 2 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so

passing

Quoted 3 lines
Quoted 3 lines

NULL works, but:

- this works "by accident" and looks as if the caller doesn't

understand

Quoted 5 lines
Quoted 4 lines

the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

- also drop the now redundant (void)

Yes, but the "void" cast was never necessary, I guess.

and just in case... To me the usage of SEND_SIG_NOINFO here doesn't look right with
or without this change. Perhaps I am wrong, but please lets not discuss this right
now, this connects to other cleanups I have in mind.

Quoted 3 lines

The purpose of this change is to make aa_audit() grep-friendly wrt SEND_SIG_NOINFO.
And because send_sig_info(NULL) looks "just wrong" to me, no matter what.

No need, just a teeny tiny description nit.

Quoted 12 lines
Quoted 1 line

Thanks,

Quoted 2 lines

Also, feel free to CC me in signal patches, so I can review, from you or from others.

OK, will do.

Oleg.

Thanks!

maintainer
#4 lore raw
In reply to Oleg Nesterov
Quoted 10 lines · Oleg Nesterov
Quoted 9 lines · Bradley Morgan
Quoted 9 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

Quoted 8 lines
Quoted 1 line

- also drop the now redundant (void)

Yes, but the "void" cast was never necessary, I guess.

and just in case... To me the usage of SEND_SIG_NOINFO here doesn't look right with or without this change. Perhaps I am wrong, but please lets not discuss this right now, this connects to other cleanups I have in mind.

Yes, I agree. Perhaps SEND_SIG_PRIV would be more appropriate here.

Quoted 14 lines

The purpose of this change is to make aa_audit() grep-friendly wrt SEND_SIG_NOINFO. And because send_sig_info(NULL) looks "just wrong" to me, no matter what.

Quoted 1 line

Thanks,

Quoted 2 lines

Also, feel free to CC me in signal patches, so I can review, from you or from others.

OK, will do.

Oleg.

#5 lore raw
Quoted 14 lines · Georgia Garcia
Quoted 12 lines · Oleg Nesterov
Quoted 10 lines · Bradley Morgan
Quoted 9 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

- also drop the now redundant (void)

Quoted 8 lines
Quoted 6 lines

Yes, but the "void" cast was never necessary, I guess.

and just in case... To me the usage of SEND_SIG_NOINFO here doesn't look right with or without this change. Perhaps I am wrong, but please lets not discuss this right now, this connects to other cleanups I have in mind.

Yes, I agree. Perhaps SEND_SIG_PRIV would be more appropriate here.

Yes, this is what I meant. And I think the same is true for most of (all?) users of send_sig(sig, task, priv = 0), at least when task is current. I'll return to this later.

Thanks for your ACK!

Oleg.

#6 lore raw
Quoted 16 lines · Oleg Nesterov
Quoted 5 lines · Georgia Garcia
Quoted 3 lines · Oleg Nesterov
Quoted 2 lines · Bradley Morgan
Quoted 2 lines

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so

passing

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

NULL works, but:

- this works "by accident" and looks as if the caller doesn't

understand

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from

grep,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and this is really bad.

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

- also drop the now redundant (void)

Yes, but the "void" cast was never necessary, I guess.

and just in case... To me the usage of SEND_SIG_NOINFO here doesn't

look right with

Quoted 1 line
Quoted 1 line

or without this change. Perhaps I am wrong, but please lets not

discuss this right

Quoted 4 lines
Quoted 2 lines

now, this connects to other cleanups I have in mind.

Yes, I agree. Perhaps SEND_SIG_PRIV would be more appropriate here.

Nice! thank you!

Quoted 9 lines

Yes, this is what I meant. And I think the same is true for most of (all?) users of send_sig(sig, task, priv = 0), at least when task is current. I'll return to this later.

Thanks for your ACK!

Oleg.

Thanks!

maintainer Acked-by on v1 1/1
#7 lore raw
In reply to Oleg Nesterov

Hi Oleg,

Quoted 9 lines · Oleg Nesterov

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

Quoted 18 lines
---
 security/apparmor/audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/audit.c +1 -1
index 4a60b6fda75f..15e42e96b163 100644
@@ -192,7 +192,7 @@ int aa_audit(int type, struct aa_profile *profile,
 	aa_audit_msg(type, ad, cb);
 
 	if (ad->type == AUDIT_APPARMOR_KILL)
-		(void)send_sig_info(profile->signal, NULL,
+		send_sig_info(profile->signal, SEND_SIG_NOINFO,
 			ad->common.type == LSM_AUDIT_DATA_TASK &&
 			ad->common.u.tsk ? ad->common.u.tsk : current);
 
maintainer
#8 lore raw
In reply to Oleg Nesterov
Quoted 10 lines · Oleg Nesterov

SEND_SIG_NOINFO is defined as ((struct kernel_siginfo *) 0), so passing NULL works, but:

- this works "by accident" and looks as if the caller doesn't understand the signal sending API.

- more importantly, this hides the usage of SEND_SIG_NOINFO from grep, and this is really bad.

this is now in apparmor-next

Quoted 17 lines
---
  security/apparmor/audit.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/audit.c +1 -1
index 4a60b6fda75f..15e42e96b163 100644
@@ -192,7 +192,7 @@ int aa_audit(int type, struct aa_profile *profile,
  	aa_audit_msg(type, ad, cb);
 
  	if (ad->type == AUDIT_APPARMOR_KILL)
-		(void)send_sig_info(profile->signal, NULL,
+		send_sig_info(profile->signal, SEND_SIG_NOINFO,
  			ad->common.type == LSM_AUDIT_DATA_TASK &&
  			ad->common.u.tsk ? ad->common.u.tsk : current);