From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 094BAC433E2 for ; Tue, 21 Jul 2020 23:11:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1ACE20771 for ; Tue, 21 Jul 2020 23:11:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MK8DEweX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1ACE20771 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-audit-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595373101; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fh6KVHYX3Y12/GWn+m1TPLZHJzfqbObJbeLpFZmmBHg=; b=MK8DEweX9Yb3hiNXVOwNkGGghmcaHSwNLdQAS28UkDeG3/fCwbU9mwJBWE5fWNxt0dYcRA ZZj7fwFG82fH9ia1p+hsbRyPd4CpazMwMdlSQ7eW7J2yiiQlFt/cPPJt5YB+XOZYoY7DcO uvPQUMPtkQY6IpnD/77BaDdwB/DaCNg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-3Sx7DQJpM9eyJAgSh-RFcA-1; Tue, 21 Jul 2020 19:11:39 -0400 X-MC-Unique: 3Sx7DQJpM9eyJAgSh-RFcA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5DBF81902EA8; Tue, 21 Jul 2020 23:11:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 434FE10013C1; Tue, 21 Jul 2020 23:11:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1C26B730C9; Tue, 21 Jul 2020 23:11:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06LN9N7k023038 for ; Tue, 21 Jul 2020 19:09:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id A86931009978; Tue, 21 Jul 2020 23:09:23 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92AE010013C1; Tue, 21 Jul 2020 23:09:16 +0000 (UTC) Date: Tue, 21 Jul 2020 19:09:13 -0400 From: Richard Guy Briggs To: Paul Moore Subject: Re: null pointer dereference regression in 5.7 Message-ID: <20200721230913.gnoakbg4mrb5opsz@madcap2.tricolour.ca> References: <9c8f1fc6-2b8e-e9e3-37bf-2d1d6bedace1@gmail.com> <360c7a62-fd39-ad02-60b8-87fb18022eeb@defensec.nl> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: linux-audit@redhat.com Cc: bauen1 , linux-audit@redhat.com, Dominick Grift X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2020-07-21 18:45, Paul Moore wrote: > On Tue, Jul 21, 2020 at 6:30 PM Paul Moore wrote: > > Richard, you broke it, you bought it :) Did you want to take a closer > > look at this? If you can't let me know. Based on a quick look, my > > gut feeling is that either context->pwd is never set properly or it is > > getting free'd prematurely; I'm highly suspicious of the latter but > > the former seems like it might be a reasonable place to start. > > Actually, yes, I'm pretty certain the problem is that context->pwd is > never set in this case. I'll have a look. This review is also related to ghak122 and potentially missing PATH records... > Normally context->pwd would be set by a call to > audit_getname()/__audit_getname(), but if there audit context is a > dummy context, that is skipped and context->pwd is never set. > Normally that is fine, expect with Richard's patch if the kernel > explicitly calls audit_log_start() we mark the context as ... not a > dummy? smart? I'm not sure of the right term here ... which then > triggers all the usual logging one would expect. In this particular > case, a SELinux AVC, the audit_log_start() happens *after* the > pathname has been resolved and the audit_getname() calls are made; > thus in this case context->pwd is not valid when the normal audit > logging takes place on exit and things explode in predictable fashion. > > Unfortunately, it is beginning to look like 1320a4052ea1 ("audit: > trigger accompanying records when no rules present") may be more > dangerous than initially thought. I'm borderline tempted to just > revert this patch, but I'll leave this open for discussion ... > Richard, I think you need to go through the code and audit all of the > functions that store data in an audit context that are skipped when > there is a dummy context to see which fields are potentially unset, > and then look at all the end of task/syscall code to make sure the > necessary set/unset checks are in place. > > This should be a priority. > > -- > paul moore > www.paul-moore.com > > -- > Linux-audit mailing list > Linux-audit@redhat.com > https://www.redhat.com/mailman/listinfo/linux-audit - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635 -- Linux-audit mailing list Linux-audit@redhat.com https://www.redhat.com/mailman/listinfo/linux-audit