Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5973140ybl; Tue, 10 Dec 2019 14:45:18 -0800 (PST) X-Google-Smtp-Source: APXvYqxNSCUkq2nscFCCViLxTA4SPJxY4rV43lfzPp/HQj3w3zPdFpxWYpaLCwXeWDm1Bc1WgUed X-Received: by 2002:aca:ef85:: with SMTP id n127mr390712oih.54.1576017918155; Tue, 10 Dec 2019 14:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576017918; cv=none; d=google.com; s=arc-20160816; b=tmk8xDHR+XH8u0+8mgOtSihLsgWdVx7pV3XixakflqzAy22euNS6kH8+3uu+kPEJEc /mNQ6iX6B8UGg3pV6NNKMLZeLf/wv4BOreifOXogzlL2TOxzaAHP+Emg/cBIAo/D7QJA D+wnfn4pjSlEAVABfI430qdKxzt5lBvFHp/0stzaRHFHsarKgeB2dr/f/ZyL7Vy3ooPd grIR38Yudss9mkntF4xvk4+MKuDWPqK0pbjRxNVVn4Q1p2Ddh5IZMTqV9BX3OmivY13W 9jJk7TfhRMi6GS+DcDT2WNVXxnTrpk759JhPG68lFrJvei+SPYuWC9pdniuU50ltadL3 YC1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=7/zbpUXg+dFPPNqkLlVFgNcMqR5lkIiMHnJ5wBbokaA=; b=t1rZvlc7fH09tmSA5HBteTT5MdHhwG9W4r6clQKTP7z5YUOqYYIrrvnK4nrlQR+m2M Swl//T/XL5IdZ45WGES3+0h2KX9LXzlSWZE4LKNXmPxxUncIAxFEGn5ipNNE1ijdYjEl DLzAoooQorjYBb9TKybZdOOsxnLIo43q89JWS0ABDAj97sFta5NkSBzhjih3DNgTvTux q4OycSEYZeqJR3AuMvsyghdNQ09XhUwQdKENUvlCRzgG6NOVF/jwpJD0VigmYzkGU0Ym LLGOj6eCKnRNufD+acY9n/0kq+RIk9Z//qGkIQsj6jznIr1SXx18YojuERaAKH0p0tp6 clqw== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si2730043otn.311.2019.12.10.14.45.05; Tue, 10 Dec 2019 14:45:18 -0800 (PST) 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730507AbfLJWml (ORCPT + 99 others); Tue, 10 Dec 2019 17:42:41 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:18972 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729511AbfLJWmj (ORCPT ); Tue, 10 Dec 2019 17:42:39 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBAMbZh9004984 for ; Tue, 10 Dec 2019 17:42:38 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2wtbt187c6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 10 Dec 2019 17:42:38 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Dec 2019 22:42:36 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 10 Dec 2019 22:42:32 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xBAMgVBZ47382822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Dec 2019 22:42:31 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76564A4069; Tue, 10 Dec 2019 22:42:31 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49ECBA4068; Tue, 10 Dec 2019 22:42:30 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.214.111]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 10 Dec 2019 22:42:30 +0000 (GMT) Subject: Re: [PATCH v10 1/6] IMA: Check IMA policy flag From: Mimi Zohar To: Lakshmi Ramasubramanian , linux-integrity@vger.kernel.org Cc: eric.snowberg@oracle.com, dhowells@redhat.com, mathew.j.martineau@linux.intel.com, matthewgarrett@google.com, sashal@kernel.org, jamorris@linux.microsoft.com, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Date: Tue, 10 Dec 2019 17:42:29 -0500 In-Reply-To: <20191204224131.3384-2-nramas@linux.microsoft.com> References: <20191204224131.3384-1-nramas@linux.microsoft.com> <20191204224131.3384-2-nramas@linux.microsoft.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19121022-0028-0000-0000-000003C757F1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19121022-0029-0000-0000-0000248A899B Message-Id: <1576017749.4579.40.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-10_07:2019-12-10,2019-12-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 adultscore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912100186 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-12-04 at 14:41 -0800, Lakshmi Ramasubramanian wrote: > Return immediately from process_buffer_measurement() > if the IMA policy flag is set to zero. Not doing this > can result in kernel panic when process_buffer_measurement() > is called before IMA is initialized (for instance, when > the IMA hook is called when a key is added to > the .builtin_trusted_keys keyring). > > This change adds the check in process_buffer_measurement() > to return immediately if ima_policy_flag is set to zero. Patch descriptions aren't suppose to be written as pseudo code.  Start with the current status and problem description. For example, "process_buffer_measurement() may be called prior to IMA being initialized, which would result in a kernel panic.  This patch ..." Mimi > > Signed-off-by: Lakshmi Ramasubramanian > --- > security/integrity/ima/ima_main.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c > index d7e987baf127..9b35db2fc777 100644 > --- a/security/integrity/ima/ima_main.c > +++ b/security/integrity/ima/ima_main.c > @@ -655,6 +655,9 @@ void process_buffer_measurement(const void *buf, int size, > int action = 0; > u32 secid; > > + if (!ima_policy_flag) > + return; > + > /* > * Both LSM hooks and auxilary based buffer measurements are > * based on policy. To avoid code duplication, differentiate