From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Moore Subject: Re: [PATCH] audit: Fix check of return value of strnlen_user() Date: Thu, 11 Jun 2015 15:58:51 -0400 Message-ID: <3063794.B6fgj1Ljmc@sifl> References: <1433257709-1530-1-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5BJwsMA017162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 11 Jun 2015 15:58:54 -0400 Received: from mail-qg0-f51.google.com (mail-qg0-f51.google.com [209.85.192.51]) by mx1.redhat.com (Postfix) with ESMTPS id B496D2DC3DE for ; Thu, 11 Jun 2015 19:58:53 +0000 (UTC) Received: by qgep100 with SMTP id p100so5227828qge.3 for ; Thu, 11 Jun 2015 12:58:53 -0700 (PDT) In-Reply-To: <1433257709-1530-1-git-send-email-jack@suse.cz> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: Jan Kara Cc: linux-audit@redhat.com List-Id: linux-audit@redhat.com On Tuesday, June 02, 2015 05:08:29 PM Jan Kara wrote: > strnlen_user() returns 0 when it hits fault, not -1. Fix the test in > audit_log_single_execve_arg(). Luckily this shouldn't ever happen unless > there's a kernel bug so it's mostly a cosmetic fix. > > CC: Paul Moore > Signed-off-by: Jan Kara > --- > kernel/auditsc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Merged to audit#next, thanks for your patience. > diff --git a/kernel/auditsc.c b/kernel/auditsc.c > index 9fb9d1cb83ce..bb947ceeee4d 100644 > --- a/kernel/auditsc.c > +++ b/kernel/auditsc.c > @@ -1023,7 +1023,7 @@ static int audit_log_single_execve_arg(struct > audit_context *context, * for strings that are too long, we should not have > created > * any. > */ > - if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) { > + if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) { > WARN_ON(1); > send_sig(SIGKILL, current, 0); > return -1; -- paul moore www.paul-moore.com