From mboxrd@z Thu Jan 1 00:00:00 1970 From: Casey Schaufler Subject: Re: [PATCH] Audit: do not print error when SELinux disabled Date: Wed, 24 Oct 2012 09:10:07 -0700 Message-ID: <508812DF.9070905@schaufler-ca.com> References: <1350997115.3801.5.camel@dhcp137-49.rdu.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9OGGaMS004932 for ; Wed, 24 Oct 2012 12:16:37 -0400 Received: from nm16.access.bullet.mail.sp2.yahoo.com (nm16.access.bullet.mail.sp2.yahoo.com [98.139.44.143]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9OGGZDM023499 for ; Wed, 24 Oct 2012 12:16:35 -0400 In-Reply-To: <1350997115.3801.5.camel@dhcp137-49.rdu.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com 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 > > --- > > 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 >