Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4509213img; Tue, 26 Mar 2019 10:44:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqeCTeuggg72x3BGON4puYLxuii+ZP/d24e2JEN37IMiypF12QYnHvAVfZePP3/QchHfP5 X-Received: by 2002:a63:1b07:: with SMTP id b7mr31184995pgb.250.1553622291020; Tue, 26 Mar 2019 10:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553622291; cv=none; d=google.com; s=arc-20160816; b=v4vWSc771fT7nWYnp7YJPRFEGsSSxDb/bQzg3g870pmEKEukB7sPKbB8Qu3pLZIRus ICH2BO9cyrAGz+qDpioylsuCcZGKAmVd9hWfK9IeSaDsuTYddmTZa33JqDFiK71cQvAo yO0YgWlz7V6+gTL+KGbu7qG0Ah+PvuBYS77Dg9zpFC2K9FI/YUqKvnxj8NUy6DE6xYNr gNt9wpItrpazwKpdUb6PUDDZfzVO1Hzdi5O/4ZZLlIzNYQbPBfluEQwDSjG6SaQzM6DI lYbemcRdSgHS0Bpbqp8lN3ErUChF1fKaZdRvEuIT9bgGOHbuBjES2Szu6sdb6PK+/XbH cmiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=bUKagnIh+UMy694SS84KbjpitGocf2WUQ/umPtuZ3qQ=; b=P/+SPnbafOYBr89YQSBBea8OxmurmJ+lzXnJvBjZ5lA0kQH1RXaWWe7DE0jqAnk/Jb rKiGp4E8P1N734ZM+ao7plohYEPcvMnsmb5RQQ4V7vDpazJsBnoTLc041O+qxvbPUw/E S4lbhwtsl7AhqQRDWJdIdyWb2xgUd9ks23M+jkBzhnH10A2GFj42CZNS5V1D2gN6wa0m wLypGWaARfZ93ZU8RAvQ7cGROkM0XQusJCJ9HJg0mzcWU+fvBLyr49whXAbDJwlL/MZV 0UWJRVmsX40e0V/cV5a/HXJ3OE8ribN8n2o3Cltx+oqoqRaMl3TJSMPHnNcOyeSr0Mrr wwaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si6390999pgg.1.2019.03.26.10.44.35; Tue, 26 Mar 2019 10:44:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732325AbfCZRnD (ORCPT + 99 others); Tue, 26 Mar 2019 13:43:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46202 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfCZRnD (ORCPT ); Tue, 26 Mar 2019 13:43:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A801A87629; Tue, 26 Mar 2019 17:43:02 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-19.phx2.redhat.com [10.3.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E869C600C8; Tue, 26 Mar 2019 17:42:55 +0000 (UTC) Date: Tue, 26 Mar 2019 13:42:52 -0400 From: Richard Guy Briggs To: Mimi Zohar Cc: Steve Grubb , Paul Moore , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Linux-Audit Mailing List , LKML , omosnace@redhat.com, Eric Paris , Serge Hallyn , mjg59@google.com Subject: Re: [PATCH ghak109 V1] audit: link integrity evm_write_xattrs record to syscall event Message-ID: <20190326174252.irqrldtcy5bwho6k@madcap2.tricolour.ca> References: <81d0122d14c4fbb3a2ad33d25fdf2dd001c7dcc7.1552737854.git.rgb@redhat.com> <20190321005008.wfz3bk7q262km5fz@madcap2.tricolour.ca> <2006016.NXIvICiRTL@x2> <1553614157.4115.17.camel@linux.ibm.com> <20190326161409.3wej7hcwnqalf4or@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190326161409.3wej7hcwnqalf4or@madcap2.tricolour.ca> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 26 Mar 2019 17:43:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-03-26 12:14, Richard Guy Briggs wrote: > On 2019-03-26 11:29, Mimi Zohar wrote: > > On Tue, 2019-03-26 at 11:22 -0400, Steve Grubb wrote: > > > > > > > > --- a/security/integrity/evm/evm_secfs.c > > > > > > +++ b/security/integrity/evm/evm_secfs.c > > > > > > @@ -192,7 +192,8 @@ static ssize_t evm_write_xattrs(struct file *file, > > > > > > const char __user *buf,> > > > > > > > if (count > XATTR_NAME_MAX) > > > > > > > > > > > > return -E2BIG; > > > > > > > > > > > > - ab = audit_log_start(NULL, GFP_KERNEL, > > > > > > AUDIT_INTEGRITY_EVM_XATTR); > > > > > > + ab = audit_log_start(audit_context(), GFP_KERNEL, > > > > > > + AUDIT_INTEGRITY_EVM_XATTR); > > > > > > > > > > This part is fine. > > > > > > > > > > > if (!ab) > > > > > > > > > > > > return -ENOMEM; > > > > > > > > > > > > @@ -222,7 +223,7 @@ static ssize_t evm_write_xattrs(struct file *file, > > > > > > const char __user *buf,> > > > > > > > inode_lock(inode); > > > > > > err = simple_setattr(evm_xattrs, &newattrs); > > > > > > inode_unlock(inode); > > > > > > > > > > > > - audit_log_format(ab, "locked"); > > > > > > + audit_log_format(ab, "xattr=(locked)"); > > > > > > > > > > Two things come to mind: > > > > > > > > > > * While we can clearly trust the string above, should we be logging > > > > > the xattr field value as an untrusted string so it is consistent with > > > > > how we record other xattr names? > > > > > > > > That would be a question for Steve. > > > > > > All fields with the same name must be represented the same way. If one > > > instance is untrusted, every instance of the same keyword must be untrusted. > > > > Normal case: > > audit_log_format(ab, "xattr="); > > audit_log_untrustedstring(ab, xattr->name); > > > > Ok, so the above audit_log_format() call should be replaced with > > ?audit_log_untrustedstring(). > > Ok, so I think we can agree on "audit_log_untrustedstring(ab, > "xattr=.");" and simpler yet just print the contents regardless and not > special case this print. V2 coming... Ok, what I typed above wasn't quite what I intended... This is what I meant: audit_log_format(ab, "xattr="); audit_log_untrustedstring(ab, "."); But, I'll just move the normal case above the "." locking detection and log all cases the same way. > > Mimi > > - RGB - 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