Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp895056ybd; Sat, 22 Jun 2019 18:20:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhNbxTEV5V873rX4P/UsN+Teinve1t9Xil7mIXP8+ag6M2xP6Ih1/iUxzksht0u91MRO06 X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr64609586pls.134.1561252832018; Sat, 22 Jun 2019 18:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561252832; cv=none; d=google.com; s=arc-20160816; b=PLyoTFr/xmxhjCSqkRLxFUtmOh6j2mXuaCkdr5vmJ/YjbER7E+hdRyNVbgxOuOp/TZ zEkiPeKpl36ln+0CiiXZGoBZd4G2bLo7nYDJkDnR+8uAzvvDZyf7VcDubMyU4+oHxuTn k570jHdCKuK2He25PJ8eJJ8s80/J0X2ZrXxE83BGznfKPYJgX0tvJHBerN8Ke+G9fdp8 047va/x5K1+talC0JsNxGx5rHlCHwgpqk3iJjf7RoQMV4l95GCTZyDp3vfFRmq7C3Ehv Cqt6m0Hz6Xl430FdsVqlIHrRtQByb2X7YkfN02ukZ3TewZ22IFMkKO13CoxU/xqVnbON gU+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Muy8l67XTgQ8QvvYzm/lgbWW8wIRKwYpaJ4/hlcS4jk=; b=gDJPxgTu/I2yTtgHHTtU7qUyP7d5ndsm8K2UQ3CfVeTuQVSJUyoVi5G2wcJ9jtE7Kt 9oBoEHJ4Aqn40HkxMgHvFdIYyoQSwb/G+Bk9yfun+znMcpWrJYa2bJKTEFZlEHyXeeiY lPdIMDW1d1S2qDPPErm+5zvt4qiYOaQKNcJBep8Mu8W5zMAUeQFvq2BV1jKFxwnH4eJu 1WfVmhJ1KSU69eHkWMP+TSquJkaJ8XecasvsXDsH2Scb7jL+hU9owt0myTGCXG63mfvq gfTOMBbMJP4AfzQORjM182EPOe+AA2cCERfpecVPNiRWpYqpZcKKd0FKj8vkzqzXz7jm hHIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hGZBty9v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si6507861pfd.64.2019.06.22.18.19.34; Sat, 22 Jun 2019 18:20:32 -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=@chromium.org header.s=google header.b=hGZBty9v; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726485AbfFWAZb (ORCPT + 99 others); Sat, 22 Jun 2019 20:25:31 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39263 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbfFWAZa (ORCPT ); Sat, 22 Jun 2019 20:25:30 -0400 Received: by mail-pg1-f193.google.com with SMTP id 196so5135955pgc.6 for ; Sat, 22 Jun 2019 17:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Muy8l67XTgQ8QvvYzm/lgbWW8wIRKwYpaJ4/hlcS4jk=; b=hGZBty9vkwSEnFjKjjzvO41IQIGOS2M1st7Zs3Q2F5qYDxJa17E/2ppGWE/VoTbKE7 Ex+YYt8iotCN+AvqdKFQvogDBDELCpucsd4iGP9AfpIbPSn1IV8eFeA0d78v5BBaA1Yd VBtAB4e4wegcGRAoCgrMEViWixlEWgGZpr8bU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Muy8l67XTgQ8QvvYzm/lgbWW8wIRKwYpaJ4/hlcS4jk=; b=lwMbFpjhboz3pp+wxS8tk+5DY4tIB/0k7ARlQ52WJKwckReF6MN1yA8wC6D6d03ObR YelmFiqYF3JJ7ACzkHh0TBbJKaUagxq3Gz394+l+DwQgAuXryTlAIC81AHR3dVpx4Op2 GscIYGo3Buphadf/+PHOAdSWM9n/KsuhvrjR/Z4rDmHKyxAVVMGuIiczMLbuqiehyJ2f RCM37nAbVq5xYcpGWaf94GEAtp3FHZL7hSt7XSMQWP+OKC2F/enLZ68godWKEEKVos8p 4VJVaLzKL7vFrIOQtTs4y8FKq9ufIWikoOWK/rMqNmRDOU6GcUUS19DOTB1wMhXlxSFS 8OsA== X-Gm-Message-State: APjAAAXK5sTjNaGGa5F4nRXn9rPSTToKF8nMBS0ZN/a9UNwLmcBitW5S xC0oq7lgR4a/8Uwrs11xKPIItw== X-Received: by 2002:a17:90b:d8a:: with SMTP id bg10mr15802946pjb.92.1561249530062; Sat, 22 Jun 2019 17:25:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e20sm6764757pfi.35.2019.06.22.17.25.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Jun 2019 17:25:28 -0700 (PDT) Date: Sat, 22 Jun 2019 17:25:28 -0700 From: Kees Cook To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Matthew Garrett Subject: Re: [PATCH V34 29/29] lockdown: Print current->comm in restriction messages Message-ID: <201906221724.EF1BA1D@keescook> References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-30-matthewgarrett@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622000358.19895-30-matthewgarrett@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 05:03:58PM -0700, Matthew Garrett wrote: > Print the content of current->comm in messages generated by lockdown to > indicate a restriction that was hit. This makes it a bit easier to find > out what caused the message. > > The message now patterned something like: > > Lockdown: : is restricted; see man kernel_lockdown.7 > > Signed-off-by: David Howells > Signed-off-by: Matthew Garrett > --- > security/lockdown/lockdown.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c > index 98f9ee0026d5..9ca6f442fbc7 100644 > --- a/security/lockdown/lockdown.c > +++ b/security/lockdown/lockdown.c > @@ -83,8 +83,8 @@ static int lockdown_is_locked_down(enum lockdown_reason what) > { > if ((kernel_locked_down >= what)) { To satisfy my paranoia, can you just add here: if (WARN(what > LOCKDOWN_..._MAX)) return -EPERM; With that: Reviewed-by: Kees Cook -Kees > if (lockdown_reasons[what]) > - pr_notice("Lockdown: %s is restricted; see man kernel_lockdown.7\n", > - lockdown_reasons[what]); > + pr_notice("Lockdown: %s: %s is restricted; see man kernel_lockdown.7\n", > + current->comm, lockdown_reasons[what]); > return -EPERM; > } > > -- > 2.22.0.410.gd8fdbe21b5-goog > -- Kees Cook