Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4804761imm; Fri, 18 May 2018 10:56:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr1dvpGC1JtAUdUa18SDQRfKUlEdOXrv9FoT6CANKHV26dOuJXKxP4IX2xdIgvsUTuVxWzZ X-Received: by 2002:a17:902:781:: with SMTP id 1-v6mr10548934plj.150.1526666185190; Fri, 18 May 2018 10:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526666185; cv=none; d=google.com; s=arc-20160816; b=V1aXKb/Uk5e3i1jkGHdan+B0mSK+Ih6rHiDZnpwTnZGpA3knqp2+yyq3bJNCBaDWb1 Yk9MX/SN5zvJe+cLLx4vXG9/NcK75YIizqq6jyVt29T7rpBQDUc++u4hwhF9hfyxhCYL koKviTHzgAFmBL6UllcV2+XmEc0+cfyHKnbBwenYwCB8Pp7HDah1nF0ZCpShbCzcm5iZ v2Cnmyt5Ww8XzeOlSsPE3b3hkBsZp4UOLbGFxduEtmpw4K8Dheiuw2HfRRH2AIT80HlH YCY+m1AvIUNrwmNkikYaRyzUsVXv5kOugU0jycu3F1ssXwVCW4aLk7LEC37jZXyf6gK4 K3AA== 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 :arc-authentication-results; bh=WtYPgqJTJGWFe+92TVR8voWfkbn9JJD9YukTAHT7aKs=; b=UfXm31WMsZtlYVEx6fyUoslO1VsnQCSqIOWDbtqus/uNARS9kGEM1/Vxa2wKrY8Vvj cYdvUMa7B9t7LI7OCM7Fnk56PdUKmb0tuGY4j1n083PTE9ytyIsad0ldbqeZZ/YbL2kX War8xVmm0GqjwgQh5W3Jx8coAlxXsIVXxQkBZkzUE3zP/9brpHcZp9HOPUheqofRgLnK Qu5qHnj5ZCh5sfBQSfNkWpqAy3AveAgl5QNmPmebj4/I1SVgaa3QyFIfoEFXNzfch6VY qarLuF3m40pq/uRQwrmTx3mgrJYGuBfrIi0XtT6Q47ORBAaLwyy5BvMK8V4NYlWlEKb6 bPXg== 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 f4-v6si6246958pgs.16.2018.05.18.10.56.10; Fri, 18 May 2018 10:56:25 -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 S1752119AbeERRz5 (ORCPT + 99 others); Fri, 18 May 2018 13:55:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38720 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751534AbeERRzx (ORCPT ); Fri, 18 May 2018 13:55:53 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4IHi6PW114603 for ; Fri, 18 May 2018 13:55:53 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j23etrhdf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 May 2018 13:55:52 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 18 May 2018 18:55:51 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 18 May 2018 18:55:46 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4IHtkYW65208564; Fri, 18 May 2018 17:55:46 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 00C2EA404D; Fri, 18 May 2018 18:47:13 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6C284A4040; Fri, 18 May 2018 18:47:11 +0100 (BST) Received: from localhost.localdomain (unknown [9.80.88.24]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 18 May 2018 18:47:11 +0100 (BST) Subject: Re: [PATCH v2 3/9] security: define security_kernel_read_blob() wrapper From: Mimi Zohar To: James Morris , "Eric W. Biederman" Cc: Casey Schaufler , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , kexec@lists.infradead.org, Andres Rodriguez , Greg Kroah-Hartman , Ard Biesheuvel , Kees Cook Date: Fri, 18 May 2018 13:55:33 -0400 In-Reply-To: References: <1526568530-9144-1-git-send-email-zohar@linux.vnet.ibm.com> <1526568530-9144-4-git-send-email-zohar@linux.vnet.ibm.com> <74c096ca-1ad1-799e-df3d-7b1b099333a7@schaufler-ca.com> <87y3ghhbws.fsf@xmission.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: 18051817-0040-0000-0000-0000045AF81B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051817-0041-0000-0000-000020FF3A38 Message-Id: <1526666133.3404.67.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-18_06:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805180191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2018-05-19 at 03:13 +1000, James Morris wrote: > On Thu, 17 May 2018, Eric W. Biederman wrote: > > > Nacked-by: "Eric W. Biederman" > > > > Nack on this sharing nonsense. These two interfaces do not share any > > code in their implementations other than the if statement to distinguish > > between the two cases. > > Hmm, it's not even doing that. > > There's already an if(!file && read_id == X) { } check and this is another > one being added. > > > If we want comprehensible and maintainable code in the security modules > > we need to split these two pieces of functionality apart. > > All ima_read is doing in both the old and new case is checking if there's > no file then if it's a certain operation, returning an error. > > To echo Eric and Casey's suggestions, how about changing the name of the > hook to security_kernel_read_data() ? Thanks, James.  Somehow I missed this option.  Renaming the existing hook, would be the easiest solution.  Eric, are you in agreement with James' naming suggestion/solution? > Then ima_read_file() can be changed to ima_read_data(), and then instead > of two if (!file && read_id == X) checks, have: > > if (!file) { > switch (read_id) { > } > } > > > >