Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4431119img; Tue, 26 Mar 2019 09:15:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM26HPokwjpOtKLRAubEBUpAoyKgJRDB5Av9sJqZ+NQIU467x0GuLFreg5SOCj3hw79vgd X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr33073179pla.178.1553616911192; Tue, 26 Mar 2019 09:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553616911; cv=none; d=google.com; s=arc-20160816; b=w57l/9NOLV6XW2pd68wNcPwRLFJlvDT3fqyWoj5O37pV09u4v8hNqQE3U7oISFuPpi puEJb97Npoko1w2T/XlczFXQ9tRdxchqcVLMoOolDSmtoPlIC9tYOCWi42sI8lA3iJFZ 4EWsouDz2E0mTmn/TCR8va8H4i+eon9VLu8I5rFfvomW4w8ATmPraorUrldoSE079zzW QaMdo/Q8GWjaq7ujljJxWxWGYjgMv0Z0eV06YIsUokmgIbqnlFay2tahaOkJXvhKYRFv 25ftzFBkV2T4z/q/xcSo5qlntav07rrHeY4POsWvrcXee4fvXBaSGNblUsMpYrO74mQR ofzA== 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=yYuX5cwrI9bpsheenVi5mHM9d43bhk+g4RQgNi8Z8NM=; b=FukOGotSaYdWWW+sN9HHQ4d7iQmetAocWOxng52V4rL8n0rwbjK60hpIH8opKmFYHK XAH1a6fSjWBIEoI+9zvPyRIptWzpSOMT4cKfwizjdwv2bm+pzI/xEn7urzx/0vX9oiLe bJt7IrPSNPNzdbofUwiFPdjfoAL+ABPyPiuFx6jmQRLpwzM0/Ur+WMz8Xo+jyKaQhOM1 ChxJCBXmHPXmdkDlyHc9AjF6a3/OjT3gyeAhNy53a8xv0XtF9J8hTQZOJML7EzFLYakv tU2mxuB25TJWKw7Jf94UL020wjxS3rE/6z8ZTiEWNec3U/ZWvtgTwaA+ZfU13y+4BuRX i31A== 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 r4si11142466pgh.171.2019.03.26.09.14.55; Tue, 26 Mar 2019 09:15:11 -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 S1731653AbfCZQOU (ORCPT + 99 others); Tue, 26 Mar 2019 12:14:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfCZQOU (ORCPT ); Tue, 26 Mar 2019 12:14:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA74881F2F; Tue, 26 Mar 2019 16:14:19 +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 C84535D73F; Tue, 26 Mar 2019 16:14:12 +0000 (UTC) Date: Tue, 26 Mar 2019 12:14:09 -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: <20190326161409.3wej7hcwnqalf4or@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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1553614157.4115.17.camel@linux.ibm.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 26 Mar 2019 16:14:20 +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 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... > Mimi - 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