Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp143486imm; Thu, 27 Sep 2018 17:52:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV61xH3Ll90Q1o0OKfIFH+vJWmXrJKU0ziJngwSLJMpor5hHxtITDdZJO8ImclJ69oXnK06tq X-Received: by 2002:a17:902:7009:: with SMTP id y9-v6mr13390019plk.328.1538095943133; Thu, 27 Sep 2018 17:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538095943; cv=none; d=google.com; s=arc-20160816; b=t2fK1/ku5kuNI+BwOOgi3LegDWmmZ9FHNfAc2JugT4K9V3+aq4jsVZ5WBU8WTRfC5L k5l/LqGZyShrA+ejkXfRybRv1JQQtEf5V7VGpu2FQX7ejncApMv/JkUA3zDTqxQ4f8Uv ATexSQLVBEbU7P97twpAgPt+AbJ2lDdHm9dl0RQok7oVd+XjRf66eqfhi42uzIo6WQ+r shorRZ22gOX4scEo9BdA0iYcATCB149DzAPYNkpJvWJ+ELG5dbpiPljEm2JwK4Tu9VyX Ci0Wo2WMNb1v5f3gZWsXKYJc7JMbaEY17lc5pXoIjza3ETufwsHd83UFYF5rNyuYnjph W3pg== 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=snISDUHqJP4Im8CHzyqIBF0MLrbdrwf7TEgBqCnSYvQ=; b=AQ/pf4UQWubkSgQujaJtHPhsNqvQ8Uh8O/15MepzRyJagfcCtiWoxCTi2+o+cAWEOX ynsJ3ppgqwP+45Bo5kTbir9jNmbP+0RmfeXTFm42JIE3+W9esVZfIrhtsyFNqktKmpNg g/DtH4rc4GM3lNd6yGAlwRHzoTy8fg9D03fgAHWmoZuEadzQrq5gTlGyF/7Wx9mHcHqV FWDTiVsjPQ5Rv+J+G+zSBr5GMOI4WZNE58ivm5kk+AwezvGkQwrIFl75Af1psOaPmiAn COVaWPj/KgGNYSY26bNN1N4Tfv11RP0kjCqp3PF8GEj8YcGLr8P1gJzJI5EFJ8FKeEY/ 0fow== 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 a75-v6si3454760pfc.106.2018.09.27.17.52.04; Thu, 27 Sep 2018 17:52:23 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbeI1HM7 (ORCPT + 99 others); Fri, 28 Sep 2018 03:12:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37864 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbeI1HM6 (ORCPT ); Fri, 28 Sep 2018 03:12:58 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8S0mqQZ027131 for ; Thu, 27 Sep 2018 20:51:56 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ms7jrmndt-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 27 Sep 2018 20:51:56 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Sep 2018 01:51:54 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 28 Sep 2018 01:51:50 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8S0pnI263045758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 28 Sep 2018 00:51:50 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3EB215204F; Fri, 28 Sep 2018 03:51:30 +0100 (BST) Received: from localhost.localdomain (unknown [9.80.85.160]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 508ED5204E; Fri, 28 Sep 2018 03:51:29 +0100 (BST) Subject: Re: [PATCH v4 3/6] ima: refactor ima_init_policy() From: Mimi Zohar To: Nayna Jain , linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, jforbes@redhat.com Date: Thu, 27 Sep 2018 20:51:38 -0400 In-Reply-To: <20180926122210.14642-4-nayna@linux.vnet.ibm.com> References: <20180926122210.14642-1-nayna@linux.vnet.ibm.com> <20180926122210.14642-4-nayna@linux.vnet.ibm.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: 18092800-0012-0000-0000-000002AF8F14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18092800-0013-0000-0000-000020E3AF28 Message-Id: <1538095898.3459.140.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-27_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809280007 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nayna, On Wed, 2018-09-26 at 17:52 +0530, Nayna Jain wrote: > +static void add_rules(struct ima_rule_entry *entries, int count, > + enum policy_rule_list file) Using "file" to refer to the policy_rule_list enumeration is unusual.  Please change the variable name to something more appropriate. Mimi > +{ > + int i = 0; > + > + for (i = 0; i < count; i++) { > + struct ima_rule_entry *entry; > + > + if (file & IMA_DEFAULT_POLICY) > + list_add_tail(&entries[i].list, &ima_default_rules); > + > + if (file & IMA_CUSTOM_POLICY) { > + entry = kmemdup(&entries[i], sizeof(*entry), > + GFP_KERNEL); > + if (!entry) > + continue; > + > + INIT_LIST_HEAD(&entry->list); > + list_add_tail(&entry->list, &ima_policy_rules); > + } > + if (entries[i].action == APPRAISE) > + temp_ima_appraise |= ima_appraise_flag(entries[i].func); > + if (entries[i].func == POLICY_CHECK) > + temp_ima_appraise |= IMA_APPRAISE_POLICY; > + } > +} > +