From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJjbq-00079c-Jn for kexec@lists.infradead.org; Fri, 18 May 2018 17:56:08 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4IHhXsP127807 for ; Fri, 18 May 2018 13:55:54 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j22xkhsah-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 May 2018 13:55:54 -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 Subject: Re: [PATCH v2 3/9] security: define security_kernel_read_blob() wrapper From: Mimi Zohar 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> Mime-Version: 1.0 Message-Id: <1526666133.3404.67.camel@linux.vnet.ibm.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: James Morris , "Eric W. Biederman" Cc: Kees Cook , Ard Biesheuvel , Greg Kroah-Hartman , kexec@lists.infradead.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , "Luis R . Rodriguez" , Andres Rodriguez , Casey Schaufler , linux-integrity@vger.kernel.org T24gU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ljIGFuZCBDYXNleSdz IHN1Z2dlc3Rpb25zLCBob3cgYWJvdXQgY2hhbmdpbmcgdGhlIG5hbWUgb2YgdGhlIAo+IGhvb2sg dG8gc2VjdXJpdHlfa2VybmVsX3JlYWRfZGF0YSgpID8KClRoYW5rcywgSmFtZXMuIMKgU29tZWhv dyBJIG1pc3NlZCB0aGlzIG9wdGlvbi4gwqBSZW5hbWluZyB0aGUgZXhpc3RpbmcKaG9vaywgd291 bGQgYmUgdGhlIGVhc2llc3Qgc29sdXRpb24uIMKgRXJpYywgYXJlIHlvdSBpbiBhZ3JlZW1lbnQg d2l0aApKYW1lcycgbmFtaW5nIHN1Z2dlc3Rpb24vc29sdXRpb24/Cgo+IFRoZW4gaW1hX3JlYWRf ZmlsZSgpIGNhbiBiZSBjaGFuZ2VkIHRvIGltYV9yZWFkX2RhdGEoKSwgYW5kIHRoZW4gaW5zdGVh ZCAKPiBvZiB0d28gaWYgKCFmaWxlICYmIHJlYWRfaWQgPT0gWCkgY2hlY2tzLCBoYXZlOgo+IAo+ IAlpZiAoIWZpbGUpIHsKPiAJCXN3aXRjaCAocmVhZF9pZCkgewo+IAkJfQo+IAl9Cj4gCj4gCj4g Cj4gCgoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Ka2V4 ZWMgbWFpbGluZyBsaXN0CmtleGVjQGxpc3RzLmluZnJhZGVhZC5vcmcKaHR0cDovL2xpc3RzLmlu ZnJhZGVhZC5vcmcvbWFpbG1hbi9saXN0aW5mby9rZXhlYwo= From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41726 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751545AbeERRzy (ORCPT ); Fri, 18 May 2018 13:55:54 -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 w4IHhZOP124214 for ; Fri, 18 May 2018 13:55:53 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j236fh691-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 May 2018 13:55:53 -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 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" Mime-Version: 1.0 Message-Id: <1526666133.3404.67.camel@linux.vnet.ibm.com> Sender: linux-integrity-owner@vger.kernel.org List-ID: 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) { > } > } > > > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: zohar@linux.vnet.ibm.com (Mimi Zohar) Date: Fri, 18 May 2018 13:55:33 -0400 Subject: [PATCH v2 3/9] security: define security_kernel_read_blob() wrapper 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> Message-ID: <1526666133.3404.67.camel@linux.vnet.ibm.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.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) { > } > } > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AB8JxZoN4A9rFoa7JgNohDSTQU8iow4wM6Qab0xkIg5gle38S1CejYRBTSiyJgYdhr5yW7lNYJ7V ARC-Seal: i=1; a=rsa-sha256; t=1526666155; cv=none; d=google.com; s=arc-20160816; b=RaEe0kALj+5npdNItOa+szN91yK4PRAkb2gsihQCgFUDKXCDlrrUqWjaZXhAiup/bt WlfSWFu8ASoJWI854bYOT1993roKJhYvMfTIELwtNa7UHAft963GOwlTONm8PNg7FYRQ 7IJ7d4fPpQPtvhQ2J5uzK1Q9Qrt3mZ+MVQbLFF2+vyO3xx3YpNGBlePIZrE+Iky9zeCr WE5+P3XYqVlOU9a3Onx1aHJugOjIHjlebm1I1/GH/ScfKquCxkJCHQIbiEQwOtP+xPK4 9Yst1Jof/aLCfwwoAJSS4udK2iz8HH+KUSKBcZhD8CMzRtNVmXYrnKuD5etEpfTBEold 15/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:content-transfer-encoding:mime-version:references :in-reply-to:date:cc:to:from:subject:arc-authentication-results; bh=WtYPgqJTJGWFe+92TVR8voWfkbn9JJD9YukTAHT7aKs=; b=q7Kiogso3W9ZqLp3WSs5lLSNA0ggpQBU3P+A0SbSSWTGLQ7xH5icr+4OX1XLJ7Xz6H l5G9YOQdoCFqQu+5BqSrDcFGf8GT7RapoHQRB8yT/ijZWKut2R2DwfAaqun84K57GrHt JMjY05Xp14Za0LL/zZwiEE21H9ARadFEb5WMAQrFjq9YdfNZIvVWOs19Wk2AgkoCwBns RJfWqyJEfEZOIyC/65547DDiSZHgbjiy2q0I5iBxPl5Rx4iRTSdIUzJtBiJz0ptC+OeD i1pVm4O1sLH0IAqbZ+XzgbjsQLW7Cbf2LMY7djs31yluB1icov0NufWt9O3GR3fUOKYm +jAw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of zohar@linux.vnet.ibm.com) smtp.mailfrom=zohar@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of zohar@linux.vnet.ibm.com) smtp.mailfrom=zohar@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1600723179870285580?= X-GMAIL-MSGID: =?utf-8?q?1600825490993096475?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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) { > } > } > > > >