Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2452652pxu; Mon, 7 Dec 2020 07:03:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHQizjddppa9Rurpswf49ucKiAvVKtCYhO//0BW8wI7dYhMpiQOodTZJn70/Q59S+yAQN9 X-Received: by 2002:a17:906:76c9:: with SMTP id q9mr19591327ejn.484.1607353430126; Mon, 07 Dec 2020 07:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607353430; cv=none; d=google.com; s=arc-20160816; b=I9DSkUuceCG2+hiOH1zoYnIPYLtbVOYU5bzXkvgOCRS9UW/Dc3rDUAkFebSr7Rul4f rnlGR1oczqvqdIqthAsNKmc/366/0YNQstQ67uWHbV/uytPd1c1l1YKv8q00Al2dO1A+ 3YdjnGt0uA9yka9eDAlqJ/B9BjJIhlNAZyHM5+jWBdQI7JWWpDTqRAAW8zEAd+TaZnRk td+WvjNm/bKtIngYX5L899g2d+OyHP3tWT8HeMonXjGuWdBhUc6pNCYlJ/NIlXeG3tlt 8UbZEKwBrUvLSnFFn3ouGmyHzlJ4BEiAf8CZEmRor6d5erK55wOxU026OYPtJgcMcuRG XriA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=6b/b5Dxe605BC5GsozJi2jrq8Z2Th2EsN7f8+8G/lm4=; b=tYejA4zDBYJgP57fE7IVKmg28rcPxpjuBPdWxq+SJUUrszj840rAst3WHGCVRPgwEe 4SqZS2AKQAqQOZRE2HJ7AgY15eeL4/76Cf4CkXSWCP060YLseWeM40YkbgGXL+yv083E 7WZUvKbzwaZguLzPwVgUAz4QEOHejqvI4DXA83KbOBdct+38PYzH0xU4MIl9A03PW2mm BCWgyRd8148rT02pPV+pR7Y6gFQX8yA3hS/d+xI8G1iCi5FDltGiuOeRhEbhDSj1TwYQ CkKSPmT75tQDUfNDRcrCx5exuIE1+T9N5JBeVGbU+/1+5oG454+k3pE4DNRa12zYT8ki YTDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=g4rAs4oq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si8454465edm.399.2020.12.07.07.03.25; Mon, 07 Dec 2020 07:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=g4rAs4oq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbgLGO7g (ORCPT + 99 others); Mon, 7 Dec 2020 09:59:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43202 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbgLGO7g (ORCPT ); Mon, 7 Dec 2020 09:59:36 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B7EbJNs020191; Mon, 7 Dec 2020 09:58:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=6b/b5Dxe605BC5GsozJi2jrq8Z2Th2EsN7f8+8G/lm4=; b=g4rAs4oqnDgqpOwA0rAY9SsZ9PrfQhbHu4niNfOCs8IwbWotJykuqzJMMdLyVQuOKnDc WU9npB/Im5C8FmnWEAKtcygzPWeUDlqe05mBomL3LlNwgQRm1Ka+49xGCx7bcUfOWTJ6 KzXjKODkFlE2AOimM69/O6yIE1l48BDeyAiC0MfrQxUudRxeCnT8RrZ24xkK1+4+S027 qh7xGl6tfDCP1cMBlj/OSsgZzj4QbXSAG+bX9+qYdOYAOwVIIO9wqUwxivDJnL3b+g4Z 1jHVGNSFmobt/I8uCCASgM61Kl6mmB1Fzs5SHVwkq1vpsZTpYxmb+E/ABQfvkGQNpHyn 0Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 359p0dsbts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 09:58:07 -0500 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B7EbALl019040; Mon, 7 Dec 2020 09:58:06 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 359p0dsbst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 09:58:06 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B7EqRFq020474; Mon, 7 Dec 2020 14:58:03 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3581fhjk8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 14:58:03 +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 0B7Ew1R364815572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Dec 2020 14:58:01 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3649DA4064; Mon, 7 Dec 2020 14:58:01 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2ED88A4054; Mon, 7 Dec 2020 14:57:55 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.115.213]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 7 Dec 2020 14:57:55 +0000 (GMT) Message-ID: <49408f07b91685e058f94844e73c753bb2033d35.camel@linux.ibm.com> Subject: Re: [PATCH v10 7/8] powerpc: Move arch_ima_add_kexec_buffer to ima From: Mimi Zohar To: Lakshmi Ramasubramanian , Thiago Jung Bauermann Cc: robh@kernel.org, gregkh@linuxfoundation.org, james.morse@arm.com, catalin.marinas@arm.com, sashal@kernel.org, will@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, robh+dt@kernel.org, frowand.list@gmail.com, vincenzo.frascino@arm.com, mark.rutland@arm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, pasha.tatashin@soleen.com, allison@lohutok.net, kstewart@linuxfoundation.org, takahiro.akashi@linaro.org, tglx@linutronix.de, masahiroy@kernel.org, bhsharma@redhat.com, mbrugger@suse.com, hsinyi@chromium.org, tao.li@vivo.com, christophe.leroy@c-s.fr, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, prsriva@linux.microsoft.com, balajib@linux.microsoft.com Date: Mon, 07 Dec 2020 09:57:54 -0500 In-Reply-To: <0f60b35e-eff6-20c6-363d-82f0b10a1c1f@linux.microsoft.com> References: <20201204195149.611-1-nramas@linux.microsoft.com> <20201204195149.611-8-nramas@linux.microsoft.com> <87k0twlytt.fsf@manicouagan.localdomain> <0f60b35e-eff6-20c6-363d-82f0b10a1c1f@linux.microsoft.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-12.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-07_11:2020-12-04,2020-12-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012070094 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2020-12-06 at 18:03 -0800, Lakshmi Ramasubramanian wrote: > On 12/5/20 1:36 PM, Thiago Jung Bauermann wrote: > > > > Lakshmi Ramasubramanian writes: > > >> diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c > >> index 4d354593aecf..5263dafe8f4d 100644 > >> --- a/security/integrity/ima/ima_kexec.c > >> +++ b/security/integrity/ima/ima_kexec.c > >> @@ -74,6 +74,28 @@ static int ima_dump_measurement_list(unsigned long *buffer_size, void **buffer, > >> return ret; > >> } > >> > >> +/** > >> + * arch_ima_add_kexec_buffer - do arch-specific steps to add the IMA buffer > >> + * > >> + * @image: kimage struct to set IMA buffer data > >> + * @load_addr: Starting address where IMA buffer is loaded at > >> + * @size: Number of bytes in the IMA buffer > >> + * > >> + * Architectures should use this function to pass on the IMA buffer > >> + * information to the next kernel. > >> + * > >> + * Return: 0 on success, negative errno on error. > >> + */ > >> +static int arch_ima_add_kexec_buffer(struct kimage *image, > >> + unsigned long load_addr, > >> + size_t size) > >> +{ > >> + image->arch.ima_buffer_addr = load_addr; > >> + image->arch.ima_buffer_size = size; > >> + > >> + return 0; > >> +} > >> + > > > > Both powerpc and arm64 use the definition above for > > arch_ima_add_kexec_buffer(), so it makes sense to share them as you do > > in this patch. This file isn't the best one to put arch-specific code > > which happens to be identical among architectures, but I can't think of > > somewhere else to put it. > > > > For now this isn't an issue since powerpc and arm64 are the only arches > > implementing tihs feature. If a third arch implemented it and also used > > the same function definition as above, it wouldn't be an issue either so > > perhaps this is good enough for the time being? :-) > > If Mimi doesn't have any objection, I'll leave this function in this > file. The other option is to move this function also to > "drivers/of/kexec.c". > > Please let me know. Defining arch_ima_add_kexec_buffer() function, as static, here in ima_kexec.c is weird. For this reason, I specifically asked Thiago to look at it. Thanks, Thiago, for looking and reviewing the rest of the patch set. Duplicating the code or defining it in drivers/of, doesn't make sense either. As Thiago suggested, define it here until there is a reason to move it. thanks, Mimi