From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758589AbdDSAHJ (ORCPT ); Tue, 18 Apr 2017 20:07:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50430 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757227AbdDSAHH (ORCPT ); Tue, 18 Apr 2017 20:07:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 70EB461BAB Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bhe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 70EB461BAB Date: Wed, 19 Apr 2017 08:07:00 +0800 From: Baoquan He To: Kees Cook Cc: LKML , Dave Jiang , Dan Williams , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Dave Young , Ingo Molnar , "x86@kernel.org" , Yinghai Lu , Borislav Petkov Subject: Re: [PATCH 2/4] KASLR: Parse all memmap entries in cmdline Message-ID: <20170419000700.GF14395@x1> References: <1492436099-4017-1-git-send-email-bhe@redhat.com> <1492436099-4017-3-git-send-email-bhe@redhat.com> <20170418225222.GD14395@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 19 Apr 2017 00:07:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/18/17 at 04:32pm, Kees Cook wrote: > On Tue, Apr 18, 2017 at 3:52 PM, Baoquan He wrote: > > On 04/18/17 at 01:22pm, Kees Cook wrote: > >> > +#define COMMAND_LINE_SIZE 256 > >> > +static int handle_mem_memmap(void) > >> > +{ > >> > + char *args = (char *)get_cmd_line_ptr(); > >> > + char tmp_cmdline[COMMAND_LINE_SIZE]; > >> > >> Can't this use a dynamic allocation instead of the 256 limit? > > > > This is in boot/compressed code, no mm allocator built yet? Am I right? > > misc.c uses malloc for phdrs, and the boot_heap is create to build an > area for those calls, see include/linux/decompress/mm.h. I *think* it > should be safe to use malloc here. It should be a pretty small > allocation normally. Yes, didn't notice this. Will use it to do dynamic malloc. Thanks for telling!