Commit ad395abe authored by Eric Paris's avatar Eric Paris

Audit: do not print error when LSMs disabled

RHBZ: 785936

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 LSM label.'  If there is no LSM enabled 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: default avatarEric Paris <eparis@redhat.com>
parent f7616102
...@@ -1205,6 +1205,7 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid, ...@@ -1205,6 +1205,7 @@ 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, audit_log_format(ab, "opid=%d oauid=%d ouid=%d oses=%d", pid,
from_kuid(&init_user_ns, auid), from_kuid(&init_user_ns, auid),
from_kuid(&init_user_ns, uid), sessionid); from_kuid(&init_user_ns, uid), sessionid);
if (sid) {
if (security_secid_to_secctx(sid, &ctx, &len)) { if (security_secid_to_secctx(sid, &ctx, &len)) {
audit_log_format(ab, " obj=(none)"); audit_log_format(ab, " obj=(none)");
rc = 1; rc = 1;
...@@ -1212,6 +1213,7 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid, ...@@ -1212,6 +1213,7 @@ static int audit_log_pid_context(struct audit_context *context, pid_t pid,
audit_log_format(ab, " obj=%s", ctx); audit_log_format(ab, " obj=%s", ctx);
security_release_secctx(ctx, len); security_release_secctx(ctx, len);
} }
}
audit_log_format(ab, " ocomm="); audit_log_format(ab, " ocomm=");
audit_log_untrustedstring(ab, comm); audit_log_untrustedstring(ab, comm);
audit_log_end(ab); audit_log_end(ab);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment