From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754400AbcHVDjJ (ORCPT ); Sun, 21 Aug 2016 23:39:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21895 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752226AbcHVDjH (ORCPT ); Sun, 21 Aug 2016 23:39:07 -0400 X-IBM-Helo: d24dlp01.br.ibm.com X-IBM-MailFrom: bauerman@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-security-module@vger.kernel.org From: Thiago Jung Bauermann To: Dave Young Cc: kexec@lists.infradead.org, Benjamin Herrenschmidt , Balbir Singh , Paul Mackerras , "H. Peter Anvin" , linux-ima-devel@lists.sourceforge.net, Stewart Smith , Baoquan He , Michael Ellerman , x86@kernel.org, Ingo Molnar , Mimi Zohar , Vivek Goyal , Petko Manolov , Thomas Gleixner , Eric Richter , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, David Laight , Eric Biederman , Andrew Morton , Samuel Mendoza-Jonas , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 2/6] powerpc: kexec_file: Add buffer hand-over support for the next kernel Date: Mon, 22 Aug 2016 00:38:57 -0300 User-Agent: KMail/4.14.3 (Linux/3.13.0-93-generic; KDE/4.14.13; x86_64; ; ) In-Reply-To: <20160822032135.GB30489@dhcp-128-65.nay.redhat.com> References: <1471058305-30198-1-git-send-email-bauerman@linux.vnet.ibm.com> <1471058305-30198-3-git-send-email-bauerman@linux.vnet.ibm.com> <20160822032135.GB30489@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082203-1523-0000-0000-00000216E2B9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082203-1524-0000-0000-000027FCEE72 Message-Id: <5233171.lLzbU6ABRT@hactar> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-22_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608220039 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, 22 August 2016, 11:21:35 schrieb Dave Young: > On 08/13/16 at 12:18am, Thiago Jung Bauermann wrote: > > diff --git a/arch/powerpc/kernel/machine_kexec_64.c > > b/arch/powerpc/kernel/machine_kexec_64.c index > > a484a6346146..190c652e49b7 100644 > > --- a/arch/powerpc/kernel/machine_kexec_64.c > > +++ b/arch/powerpc/kernel/machine_kexec_64.c > > @@ -490,6 +490,60 @@ int arch_kimage_file_post_load_cleanup(struct > > kimage *image)> > > return image->fops->cleanup(image->image_loader_data); > > > > } > > > > +bool kexec_can_hand_over_buffer(void) > > +{ > > + return true; > > +} > > + > > +int arch_kexec_add_handover_buffer(struct kimage *image, > > + unsigned long load_addr, unsigned long size) > > +{ > > + image->arch.handover_buffer_addr = load_addr; > > + image->arch.handover_buffer_size = size; > > + > > + return 0; > > +} > > + > > +int kexec_get_handover_buffer(void **addr, unsigned long *size) > > +{ > > + int ret; > > + u64 start_addr, end_addr; > > + > > + ret = of_property_read_u64(of_chosen, > > + "linux,kexec-handover-buffer-start", > > + &start_addr); > > + if (ret == -EINVAL) > > + return -ENOENT; > > + else if (ret) > > + return -EINVAL; > > + > > + ret = of_property_read_u64(of_chosen, > > "linux,kexec-handover-buffer-end", + &end_addr); > > + if (ret == -EINVAL) > > + return -ENOENT; > > + else if (ret) > > + return -EINVAL; > > + > > + *addr = __va(start_addr); > > + /* -end is the first address after the buffer. */ > > + *size = end_addr - start_addr; > > + > > + return 0; > > +} > > This depends on dtb, so if IMA want to extend it to arches like x86 in > the future you will have to think about other way to pass it. > > How about think about a general way now? The only general way I can think of is by adding a kernel command line parameter which the first kernel would pass to the second kernel, but IMHO that is ugly, because such parameter wouldn't be useful to a user, and it would also be something that, from the perspective of the user, would magically appear in the kernel command line of the second kernel... -- []'s Thiago Jung Bauermann IBM Linux Technology Center