* [PATCH] Audit: do not print error when SELinux disabled
@ 2012-10-23 12:58 Eric Paris
2012-10-23 15:46 ` Paul Moore
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Paris @ 2012-10-23 12:58 UTC (permalink / raw)
To: linux-audit
RHBZ: 785936
About to be posted upstream
If the audit system collects a record about one process sending a signal
to another process it includes in that collection the 'secid' or 'an int
used to represet an SELinux label.' If SELinux is disabled it will
collect a 0. The problem is that when we attempt to print that record
we ask the LSM to convert the secid back to a string. Since there is no
LSM it returns EOPNOTSUPP.
Most code in the audit system checks if the secid is 0 and does not
print LSM info in that case. The signal information code however forgot
that check. Thus users will see a message in syslog indicating that
converting the sid to string failed. Add the right check.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 857f2e2..1f5cc03 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1195,12 +1195,14 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid,
audit_log_format(ab, "opid=%d oauid=%d ouid=%d oses=%d", pid, auid,
uid, sessionid);
- if (security_secid_to_secctx(sid, &ctx, &len)) {
- audit_log_format(ab, " obj=(none)");
- rc = 1;
- } else {
- audit_log_format(ab, " obj=%s", ctx);
- security_release_secctx(ctx, len);
+ if (sid) {
+ if (security_secid_to_secctx(sid, &ctx, &len)) {
+ audit_log_format(ab, " obj=(none)");
+ rc = 1;
+ } else {
+ audit_log_format(ab, " obj=%s", ctx);
+ security_release_secctx(ctx, len);
+ }
}
audit_log_format(ab, " ocomm=");
audit_log_untrustedstring(ab, comm);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Audit: do not print error when SELinux disabled
2012-10-23 12:58 [PATCH] Audit: do not print error when SELinux disabled Eric Paris
@ 2012-10-23 15:46 ` Paul Moore
2012-10-24 3:53 ` Casey Schaufler
2012-10-24 16:10 ` Casey Schaufler
2 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2012-10-23 15:46 UTC (permalink / raw)
To: linux-audit
On Tuesday, October 23, 2012 08:58:35 AM Eric Paris wrote:
> RHBZ: 785936
> About to be posted upstream
>
> If the audit system collects a record about one process sending a signal
> to another process it includes in that collection the 'secid' or 'an int
> used to represet an SELinux label.' If SELinux is disabled it will
> collect a 0. The problem is that when we attempt to print that record
> we ask the LSM to convert the secid back to a string. Since there is no
> LSM it returns EOPNOTSUPP.
>
> Most code in the audit system checks if the secid is 0 and does not
> print LSM info in that case. The signal information code however forgot
> that check. Thus users will see a message in syslog indicating that
> converting the sid to string failed. Add the right check.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
Looks good to me.
Reviewed-by: Paul Moore <paul@paul-moore.com>
> ---
>
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 857f2e2..1f5cc03 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1195,12 +1195,14 @@ static int audit_log_pid_context(struct
> audit_context *context, pid_t pid,
>
> audit_log_format(ab, "opid=%d oauid=%d ouid=%d oses=%d", pid, auid,
> uid, sessionid);
> - if (security_secid_to_secctx(sid, &ctx, &len)) {
> - audit_log_format(ab, " obj=(none)");
> - rc = 1;
> - } else {
> - audit_log_format(ab, " obj=%s", ctx);
> - security_release_secctx(ctx, len);
> + if (sid) {
> + if (security_secid_to_secctx(sid, &ctx, &len)) {
> + audit_log_format(ab, " obj=(none)");
> + rc = 1;
> + } else {
> + audit_log_format(ab, " obj=%s", ctx);
> + security_release_secctx(ctx, len);
> + }
> }
> audit_log_format(ab, " ocomm=");
> audit_log_untrustedstring(ab, comm);
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Audit: do not print error when SELinux disabled
2012-10-23 12:58 [PATCH] Audit: do not print error when SELinux disabled Eric Paris
2012-10-23 15:46 ` Paul Moore
@ 2012-10-24 3:53 ` Casey Schaufler
2012-10-24 16:10 ` Casey Schaufler
2 siblings, 0 replies; 4+ messages in thread
From: Casey Schaufler @ 2012-10-24 3:53 UTC (permalink / raw)
To: linux-audit
On 10/23/2012 5:58 AM, Eric Paris wrote:
> RHBZ: 785936
> About to be posted upstream
>
> If the audit system collects a record about one process sending a signal
> to another process it includes in that collection the 'secid' or 'an int
> used to represet an SELinux label.' If SELinux is disabled it will
> collect a 0. The problem is that when we attempt to print that record
> we ask the LSM to convert the secid back to a string. Since there is no
> LSM it returns EOPNOTSUPP.
Err, what about Smack?
>
> Most code in the audit system checks if the secid is 0 and does not
> print LSM info in that case. The signal information code however forgot
> that check. Thus users will see a message in syslog indicating that
> converting the sid to string failed. Add the right check.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
>
> ---
>
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 857f2e2..1f5cc03 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1195,12 +1195,14 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid,
>
> audit_log_format(ab, "opid=%d oauid=%d ouid=%d oses=%d", pid, auid,
> uid, sessionid);
> - if (security_secid_to_secctx(sid, &ctx, &len)) {
> - audit_log_format(ab, " obj=(none)");
> - rc = 1;
> - } else {
> - audit_log_format(ab, " obj=%s", ctx);
> - security_release_secctx(ctx, len);
> + if (sid) {
> + if (security_secid_to_secctx(sid, &ctx, &len)) {
> + audit_log_format(ab, " obj=(none)");
> + rc = 1;
> + } else {
> + audit_log_format(ab, " obj=%s", ctx);
> + security_release_secctx(ctx, len);
> + }
> }
> audit_log_format(ab, " ocomm=");
> audit_log_untrustedstring(ab, comm);
>
>
>
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Audit: do not print error when SELinux disabled
2012-10-23 12:58 [PATCH] Audit: do not print error when SELinux disabled Eric Paris
2012-10-23 15:46 ` Paul Moore
2012-10-24 3:53 ` Casey Schaufler
@ 2012-10-24 16:10 ` Casey Schaufler
2 siblings, 0 replies; 4+ messages in thread
From: Casey Schaufler @ 2012-10-24 16:10 UTC (permalink / raw)
To: linux-audit
On 10/23/2012 5:58 AM, Eric Paris wrote:
> RHBZ: 785936
> About to be posted upstream
>
> If the audit system collects a record about one process sending a signal
> to another process it includes in that collection the 'secid' or 'an int
> used to represet an SELinux label.' If SELinux is disabled it will
> collect a 0. The problem is that when we attempt to print that record
> we ask the LSM to convert the secid back to a string. Since there is no
> LSM it returns EOPNOTSUPP.
There's no problem with the patch, but the description would
lead the reader to assume that only SELinux is affected.
>
> Most code in the audit system checks if the secid is 0 and does not
> print LSM info in that case. The signal information code however forgot
> that check. Thus users will see a message in syslog indicating that
> converting the sid to string failed. Add the right check.
>
> Signed-off-by: Eric Paris <eparis@redhat.com>
>
> ---
>
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 857f2e2..1f5cc03 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1195,12 +1195,14 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid,
>
> audit_log_format(ab, "opid=%d oauid=%d ouid=%d oses=%d", pid, auid,
> uid, sessionid);
> - if (security_secid_to_secctx(sid, &ctx, &len)) {
> - audit_log_format(ab, " obj=(none)");
> - rc = 1;
> - } else {
> - audit_log_format(ab, " obj=%s", ctx);
> - security_release_secctx(ctx, len);
> + if (sid) {
> + if (security_secid_to_secctx(sid, &ctx, &len)) {
> + audit_log_format(ab, " obj=(none)");
> + rc = 1;
> + } else {
> + audit_log_format(ab, " obj=%s", ctx);
> + security_release_secctx(ctx, len);
> + }
> }
> audit_log_format(ab, " ocomm=");
> audit_log_untrustedstring(ab, comm);
>
>
>
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-24 16:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 12:58 [PATCH] Audit: do not print error when SELinux disabled Eric Paris
2012-10-23 15:46 ` Paul Moore
2012-10-24 3:53 ` Casey Schaufler
2012-10-24 16:10 ` Casey Schaufler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox