From patchwork Wed Aug 16 22:46:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9904701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04C4060244 for ; Wed, 16 Aug 2017 22:47:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED51D28577 for ; Wed, 16 Aug 2017 22:47:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB9AD28A8B; Wed, 16 Aug 2017 22:47:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id BBEA128577 for ; Wed, 16 Aug 2017 22:47:23 +0000 (UTC) Received: (qmail 26141 invoked by uid 550); 16 Aug 2017 22:47:14 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 26024 invoked from network); 16 Aug 2017 22:47:12 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XVeMT/CNZr1QAG9F8sd/QR3GesaGK+pfakjxdqMpBhE=; b=gVfhsvoYk1NRxi/ssjFvATVnyu/uO38SKrSGD6UKVsJZqnvxfqKCefgOU94eS8gmii rYy2FS3cKIiWTzAcUxqQ2EbLyEjevBn0z64bRf0r8KNevpGlY1j2pmitpQgak5YbbSY+ BlvNPbvdSMPqwbJ4GmjrQkG+cHJgnUSKLIOlMbhB00dE9K4XuLOcrfjj4SQ+F3/mqYgI pJrBI7FUDBVbGzd75SN4bY0E/z3OTCKAWyNOlucLLUU994h+TiI7U9RBdhzJxNlj2F2I ojJEQWoZ2TR4uRId3wItDCxIodTFpsF1oK4QqalwJGljYevT32wyMkwB1Poud6yUNv8N oWfg== X-Gm-Message-State: AHYfb5jRifGea5/o/8fDCwSCPpOZDA9pUPw5+B26Ed4jSzQ1Ylm7/IjH Z8e8TTW1lrBdIxGuGOt05g== X-Received: by 10.55.46.135 with SMTP id u129mr4308418qkh.39.1502923621099; Wed, 16 Aug 2017 15:47:01 -0700 (PDT) From: Laura Abbott To: Kees Cook Cc: Daniel Micay , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Laura Abbott Date: Wed, 16 Aug 2017 15:46:50 -0700 Message-Id: <20170816224650.1089-3-labbott@redhat.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170816224650.1089-1-labbott@redhat.com> References: <20170816224650.1089-1-labbott@redhat.com> Subject: [kernel-hardening] [PATCHv2 2/2] extract early boot entropy from the passed cmdline X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Micay Existing Android bootloaders usually pass data useful as early entropy on the kernel command-line. It may also be the case on other embedded systems. Sample command-line from a Google Pixel running CopperheadOS: console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=sailfish user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=32M@0-0xffffffff buildvariant=user veritykeyid=id:dfcb9db0089e5b3b4090a592415c28e1cb4545ab androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=yellow androidboot.veritymode=enforcing androidboot.keymaster=1 androidboot.serialno=FA6CE0305299 androidboot.baseband=msm mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_samsung_ea8064tg_1080p_cmd:1:none:cfg:single_dsi androidboot.slot_suffix=_b fpsimd.fpsimd_settings=0 app_setting.use_app_setting=0 kernelflag=0x00000000 debugflag=0x00000000 androidboot.hardware.revision=PVT radioflag=0x00000000 radioflagex1=0x00000000 radioflagex2=0x00000000 cpumask=0x00000000 androidboot.hardware.ddr=4096MB,Hynix,LPDDR4 androidboot.ddrinfo=00000006 androidboot.ddrsize=4GB androidboot.hardware.color=GRA00 androidboot.hardware.ufs=32GB,Samsung androidboot.msm.hw_ver_id=268824801 androidboot.qf.st=2 androidboot.cid=11111111 androidboot.mid=G-2PW4100 androidboot.bootloader=8996-012001-1704121145 androidboot.oem_unlock_support=1 androidboot.fp_src=1 androidboot.htc.hrdump=detected androidboot.ramdump.opt=mem@2g:2g,mem@4g:2g androidboot.bootreason=reboot androidboot.ramdump_enable=0 ro root=/dev/dm-0 dm="system none ro,0 1 android-verity /dev/sda34" rootwait skip_initramfs init=/init androidboot.wificountrycode=US androidboot.boottime=1BLL:85,1BLE:669,2BLL:0,2BLE:1777,SW:6,KL:8136 Among other things, it contains a value unique to the device (androidboot.serialno=FA6CE0305299), unique to the OS builds for the device variant (veritykeyid=id:dfcb9db0089e5b3b4090a592415c28e1cb4545ab) and timings from the bootloader stages in milliseconds (androidboot.boottime=1BLL:85,1BLE:669,2BLL:0,2BLE:1777,SW:6,KL:8136). Signed-off-by: Daniel Micay [labbott: Line-wrapped command line] Signed-off-by: Laura Abbott --- init/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/init/main.c b/init/main.c index 21d599eaad06..cb051aec46ef 100644 --- a/init/main.c +++ b/init/main.c @@ -533,6 +533,7 @@ asmlinkage __visible void __init start_kernel(void) */ add_latent_entropy(); boot_init_stack_canary(); + add_device_randomness(command_line, strlen(command_line)); mm_init_cpumask(&init_mm); setup_command_line(command_line); setup_nr_cpu_ids();