From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbcIBNXP (ORCPT ); Fri, 2 Sep 2016 09:23:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37858 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751097AbcIBNXN (ORCPT ); Fri, 2 Sep 2016 09:23:13 -0400 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: zohar@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-security-module@vger.kernel.org Subject: Re: [PATHC v2 5/9] ima: on soft reboot, save the measurement list From: Mimi Zohar To: Dave Young Cc: linux-security-module , Thiago Jung Bauermann , linux-ima-devel@lists.sourceforge.net, kexec@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Andrew Morton Date: Fri, 02 Sep 2016 09:22:59 -0400 In-Reply-To: <20160901015712.GA3425@dhcp-128-65.nay.redhat.com> References: <1472596811-9596-1-git-send-email-zohar@linux.vnet.ibm.com> <1472596811-9596-6-git-send-email-zohar@linux.vnet.ibm.com> <20160901015712.GA3425@dhcp-128-65.nay.redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090213-0004-0000-0000-0000018E9564 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090213-0005-0000-0000-000008985AD0 Message-Id: <1472822579.3669.13.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-02_04:,, 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-1609020179 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dave, On Thu, 2016-09-01 at 09:57 +0800, Dave Young wrote: > On 08/30/16 at 06:40pm, Mimi Zohar wrote: > > + * Called during kexec_file_load so that IMA can add a segment to the kexec > > + * image for the measurement list for the next kernel. > > + */ > > +void ima_add_kexec_buffer(struct kimage *image) > > +{ > > + static int registered = 0; > > + struct kexec_buf kbuf = { .image = image, .buf_align = PAGE_SIZE, > > + .buf_min = 0, .buf_max = ULONG_MAX, > > + .top_down = true, .skip_checksum = true }; > > + int ret; > > + > > + if (!kexec_can_hand_over_buffer()) > > + return; > > + > > + kexec_segment_size = ALIGN(ima_get_binary_runtime_size() + PAGE_SIZE, > > + PAGE_SIZE); > > + > > + if (kexec_segment_size >= (ULONG_MAX - sizeof(long))) { > > + pr_err("Binary measurement list too large.\n"); > > + return; > > + } > > Now we added a limitation that total segment size can not be larger than > half of totalram. see kernel/kexec_core.c sanity_check_segment_list() > > So can it fail early here if kexec_segment_size is over half of total > ram? Sure, I'll include this change in the next post. Mimi