Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp161411img; Wed, 20 Mar 2019 16:49:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNQdQNjIo78O7gEppgFoeFxVn6c23WM/tiARYafPlxX6ciTZbS4MCRUJdeTbZCIIuhJoGJ X-Received: by 2002:a65:6644:: with SMTP id z4mr633324pgv.198.1553125761485; Wed, 20 Mar 2019 16:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553125761; cv=none; d=google.com; s=arc-20160816; b=t2do4A4qF5CxNEP75Ohnom3nW4u12z84VebAwioUQNJIKYCfW0D7AtFh7LmHG2pgy4 L7WP4H8fgbm/KWBbomCKcQj5iNmigKlszIoxtyczGRN9cEDt3+s0gjtnaeFdrN1WfNl/ qmrfSssfWZFVHowrZOY8v1A0QLE9nKtJO4wPBKHIV4vCxCvbjl24KsZc9LJ1p1zRj3Yg Yf0Szsjj4+v32OOlbX+FG+qJ/xcqRpl9qsxwIvq4pVRM2L8XQ8VoXDzQG/PBY0A5mozu HgecTaFF7PPkHFxlULDZkYhcOkoItU0wqqH+4Kq7MlOoDBSoVkGcnhSFtccNueL3CoJU VR9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UJAjnNyQyoI4jcj7/tfz9qZtFR2QTmyN6OQ6+gk8aHo=; b=n+MjjTdaryX+EMRk8vMdpcqYnTxnpuS6ZNzcIqSF1zNTumOmIvF9tHvT15l3jbTxQs mK0bRYiT22K5C0u6qO0vd0J0Ir2iNwJcSa8bMoM/AYj1Wcm9PvKL+6uyE6SUqPJbwXHl XXX1NuFa/MXQtv+8bmMRKdpVYycnRsCT0TEgov0U/aRVB3l+PFDiFjaeuVZhHYgc4slu y3/ZTtitW4U478H6zan1bllq14+djHLejwrRo8Il93BVhp9XI+1r7o4YeO6ZJ+zTThhq L9LoInI2nXJPHEwECV89PuTgNxPLTwH/25cdX4cRyYvPn8vd2AfX9krhcPDk/Q1RT37k 8znw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=GNlxODKY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si2832081pga.567.2019.03.20.16.49.06; Wed, 20 Mar 2019 16:49:21 -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; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=GNlxODKY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727743AbfCTXsZ (ORCPT + 99 others); Wed, 20 Mar 2019 19:48:25 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:33294 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727728AbfCTXsX (ORCPT ); Wed, 20 Mar 2019 19:48:23 -0400 Received: by mail-lj1-f194.google.com with SMTP id f23so3850063ljc.0 for ; Wed, 20 Mar 2019 16:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UJAjnNyQyoI4jcj7/tfz9qZtFR2QTmyN6OQ6+gk8aHo=; b=GNlxODKY2cXGyDHBJEhylwuxzug2kEMQAVHe9ybfvYikmW4u8u7H0YWR6hjaL8nhM6 0QWC+dqjBlwh8WvBs2n8RLbXrazQTIclC/ckW49RJ/QYVszS58s6151LARHFVaN53bRi LQVMi2joNkMRgIs9XGXQ+auxkKVuf0mdnmdN7sECNRgKm/BrIszzV4Qlzs42xhlQbID9 1X5aVYh/0S4eOZnj9wwIXpQChYorQeGj0EEcAXyjmbs5aJFCqZJxQTX2WqHKhuvBQ3jN GdafozoBuv/MCXJx0CJzaaYbxVcFNVYVR2VVoA2ysURCJpiicDDlCIcfgtser2cwltFZ SFzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UJAjnNyQyoI4jcj7/tfz9qZtFR2QTmyN6OQ6+gk8aHo=; b=YvhTWH0H1CODzvs5cCM7dZRxHclHDWyXKvhpBpCjw8y+czHYshm6eKkGQfN93STXI7 faKVdsryVIXKzB/yEKpDYL5twuvRiVgEvsh7BkRpWLz6uM9DXygrSpmLd6GhLkTvkGYx 185PamIHsYC9VzFG7Oy6mbkuYG3D5WVOqiWMfMKP4Rfa+gzjaW1PgbXlhUrxk/IkkFGa pIEzEWxF9zcbg23fB6CO9064jU4SjGWq+h0+JAVpNkNKHyQs7A+N3q3h6Xk0zB+NF213 H8zhZgwncCWfp1or3QSb7J1590GiOr3dqbK9X5hGq2sWOHgKBs8FdwMl8KGhzK7wvztV wpmw== X-Gm-Message-State: APjAAAUqwtwh8WaahechV5ccEd5BaIy7PM7SrX01GLLu1n/gBvrEVt1A 2876Sm/1gemq4A47TnYla9iumchKZitWCG5r89iP X-Received: by 2002:a2e:500d:: with SMTP id e13mr345820ljb.169.1553125700851; Wed, 20 Mar 2019 16:48:20 -0700 (PDT) MIME-Version: 1.0 References: <81d0122d14c4fbb3a2ad33d25fdf2dd001c7dcc7.1552737854.git.rgb@redhat.com> In-Reply-To: <81d0122d14c4fbb3a2ad33d25fdf2dd001c7dcc7.1552737854.git.rgb@redhat.com> From: Paul Moore Date: Wed, 20 Mar 2019 19:48:09 -0400 Message-ID: Subject: Re: [PATCH ghak109 V1] audit: link integrity evm_write_xattrs record to syscall event To: Richard Guy Briggs Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Linux-Audit Mailing List , LKML , sgrubb@redhat.com, omosnace@redhat.com, Eric Paris , Serge Hallyn , zohar@linux.ibm.com, mjg59@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 16, 2019 at 8:10 AM Richard Guy Briggs wrote: > In commit fa516b66a1bf ("EVM: Allow runtime modification of the set of > verified xattrs"), the call to audit_log_start() is missing a context to > link it to an audit event. Since this event is in user context, add > the process' syscall context to the record. > > In addition, the orphaned keyword "locked" appears in the record. > Normalize this by changing it to "xattr=(locked)". > > Please see the github issue > https://github.com/linux-audit/audit-kernel/issues/109 > > Signed-off-by: Richard Guy Briggs > --- > security/integrity/evm/evm_secfs.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/security/integrity/evm/evm_secfs.c b/security/integrity/evm/evm_secfs.c > index 015aea8fdf1e..4171d174e9da 100644 > --- 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? * I'm not sure you can ever have parens in a xattr (I would hope not), but if we are going to use the xattr field, perhaps we should simply stick with the name as provided (".") so we don't ever run afoul of xattr names? I'm curious to hear what the IMA/EVM folks think of this. -- paul moore www.paul-moore.com