Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp358189ybt; Wed, 24 Jun 2020 00:42:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUYadEwJoHivzMvuR9S8usb+piVxluft9zvb5ng/9LHZYviYanwwueDhL1/VkMtqTD4MxN X-Received: by 2002:a17:906:50b:: with SMTP id j11mr5725062eja.127.1592984533027; Wed, 24 Jun 2020 00:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592984533; cv=none; d=google.com; s=arc-20160816; b=RfcNW5z6GOv1PuunMOokCO/djoPSo8hZGpZufKMFu1gHHGw4lTZp3ldNqmPwE3LNX2 sHn8n9wvQlIbme6uP60YHFXG8p3QmOe09Qu0jnN/AyUql4IYSdUBS+gpu4JRU/It67Uq f49he8fjL3js+b9Xt/SzPKx01Z4nLsZWy7Xx8kkcXmt0n2KY6KDjWbJTDyuYoI/Q2Lyh Vi2Qqfja0D4h/tWMr28QKRJpeIrB1dHO/fT6TAleaMEHfUvtkmBD8AVsky15R1NOjHO+ oM0okDbgdw1XxwmKmIz5TtUiTUm5rOkA6VKsGGpG9kltXpn01wesQmCp3GVIkTCN3+x9 BsEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZjFgd7MYI2dHNgHaw1XgA8rETt57Q052rzjGYBMB+dc=; b=yhaV3MHMmECObx4Y6ZyK9GfF3uFL9Br1qQit6UAHScxxziUN1ipFFi9ifnzAPEaeTS 6v0LCbkBTV0N1iM5PfXw5Z4vwQyQgfyC3pC6zjOltdVf4/3wRHkgqkZXZ2C+Hr2rupsG nGG8u0cH16GS7Kuf/w3Hq1Q6gDKnejnNS5YPMejWt/sH26v2rU6XqZeDYCRul8Hwh8Y+ gV0StKS0G6Nzdd6apHsbneT0h/al193RL0cWhJHtetigramLUhB9AMduzGCP1quaAF9l Jq9rMRmjqovw9qaZ3WgtqsY1avQpXbRlq+mFwNTh2yhWI0dtwZ7SgySl564q0HaC86ha 9Hmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cNA6AWzF; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si12305667ejb.751.2020.06.24.00.41.49; Wed, 24 Jun 2020 00:42:13 -0700 (PDT) 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=@chromium.org header.s=google header.b=cNA6AWzF; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389940AbgFXHkd (ORCPT + 99 others); Wed, 24 Jun 2020 03:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388375AbgFXHkc (ORCPT ); Wed, 24 Jun 2020 03:40:32 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7710CC061573 for ; Wed, 24 Jun 2020 00:40:32 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id e8so1021361pgc.5 for ; Wed, 24 Jun 2020 00:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZjFgd7MYI2dHNgHaw1XgA8rETt57Q052rzjGYBMB+dc=; b=cNA6AWzFxJlRgnAaib3oOtJuR4F72L8/dpeH5qIUy5F9BBBCoSa2eE/MkJurridSQA zxE68LDinwkYqUj9hqLTFgu/aGoFGpunFqB4RtGr1ePuj0Wc5O6QcV7rtoh+A1tkpgol f+Re6nImXYLR0owDD2eLMwBJN7XUfBZOE/LoE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZjFgd7MYI2dHNgHaw1XgA8rETt57Q052rzjGYBMB+dc=; b=hPaxkNcJrBfbm4aTNRJYzDB9QB9hO+pppnMAwxS68quwRLrgGX4IAvMYhAEpfNjh+K VzLn+lrAEVgY87C5DWOKu+djK48rjqiOI/HNCMfMOb2Lccv57xJYLUO8N96jCmsgruVI UhU5AHM/ZyHAJjvVS02ucafVY05aEh3sjHi9D4bqiO3sdOJfWEUKNdo6LBuamDdFUbJv 657ZXLM9qQ+PM+8IhhPtgh3Smx6C2whVq5SiezKQG2rFJwO6DnUvmG+WFyTR4nBCLXFe sWHwX6PDrL67L6evae/Mc+Uql5p4hoJUdKruTFxT7oeW/QHxI7uwonDW7lWPiNlBF2lm F3Fg== X-Gm-Message-State: AOAM530Efz8lfcaKYOSOG0An5MxJvY+4qh49Qcmiwv5FLbCpfBmajfRb yN5/F3ab1gyCP1Dgl7OOIsNKDg== X-Received: by 2002:a63:f541:: with SMTP id e1mr20175113pgk.375.1592984431665; Wed, 24 Jun 2020 00:40:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f131sm14942421pgc.14.2020.06.24.00.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 00:40:30 -0700 (PDT) Date: Wed, 24 Jun 2020 00:40:29 -0700 From: Kees Cook To: Kristen Carlson Accardi Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, arjan@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, rick.p.edgecombe@intel.com Subject: Re: [PATCH v3 00/10] Function Granular KASLR Message-ID: <202006240030.60C3490@keescook> References: <20200623172327.5701-1-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623172327.5701-1-kristen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 10:23:17AM -0700, Kristen Carlson Accardi wrote: > Function Granular Kernel Address Space Layout Randomization (fgkaslr) I've built and booted this successfully with both GCC/bfd and Clang/lld: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 GNU ld (GNU Binutils for Ubuntu) 2.34 clang version 11.0.0 (https://github.com/llvm/llvm-project.git c32d695b099109118dbd50dd697fffe23cd9a529) LLD 11.0.0 (https://github.com/llvm/llvm-project.git c32d695b099109118dbd50dd697fffe23cd9a529) Tested-by: Kees Cook Clang + objtool is a bit noisy, but I haven't investigated why: kernel/panic.o: warning: objtool: .text.nmi_panic: unexpected end of section kernel/panic.o: warning: objtool: .text.__warn_printk: unexpected end of section kernel/cred.o: warning: objtool: .text.exit_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.get_task_cred: unexpected end of section kernel/cred.o: warning: objtool: .text.cred_alloc_blank: unexpected end of section kernel/cred.o: warning: objtool: .text.abort_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.prepare_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.copy_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.override_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.revert_creds: unexpected end of section kernel/cred.o: warning: objtool: .text.prepare_kernel_cred: unexpected end of section And when interacting with my orphan-section series[1], this patch is needed to keep from getting A LOT of warnings. ;) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index af3d004d9a7e..de687ffa4966 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -57,9 +57,14 @@ ifndef CONFIG_FG_KASLR endif endif +ifndef CONFIG_FG_KASLR # We never want expected sections to be placed heuristically by the # linker. All sections should be explicitly named in the linker script. +# However, without a way to provide a wildcard mapping from input +# sections named .text.* to identically named output sections, this +# can only be used with FGKASLR is disabled. LDFLAGS_vmlinux += --orphan-handling=warn +endif # # Prevent GCC from generating any FP code by mistake. [1] https://lore.kernel.org/lkml/20200624014940.1204448-1-keescook@chromium.org/ -- Kees Cook