Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3112158ybt; Mon, 22 Jun 2020 15:30:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYgxTbyHlX/4aJ58cuUnD5KwiU5NqivrgcGCzSMBFaXedWf7ifXLmTBILnO9Q6B1kR2cq+ X-Received: by 2002:a17:906:7c3:: with SMTP id m3mr830732ejc.30.1592865012294; Mon, 22 Jun 2020 15:30:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592865012; cv=none; d=google.com; s=arc-20160816; b=O5PpR5lTBglkdUNBriIzYHJUDsB8I1YZL8nTP7ega9B+HvtvM4utUDED2HBEeMXjo7 DhX2VupP474mlNVpPgMoqxoytypfx08youb38MWF77FBANU3JUnLbrK/VunkmhNulpUG iaTBCwSCvDAuHyUiQm6z7+Jp9H73kU64to1rlvcYW6t6g/L3/gRa/OZ7/Q36Cfc0Bbli 4XBExurgAvkN1Go0OXXflYAPfdo62cIPyuUt/CHIWAtbSHtnRHsWC++WXdLyXnrJopgw eMKw4MfDfeIqsPUDcErOwWp/qEJaPY8GjSSzk8XRdKRrEVW+ehjdqQstwQB44FYkTFMS STQA== 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=JI0wkwVCNwXzxyeXGfReWogDJ8TItG8DNO4AEUQrZHU=; b=LaIkDlv0sB5qffhG8wGjZ2xe5frpk92gD2ZatlUIeEkapkUv5tCMzagGTOQSCfVJn+ 54ZldtFeHH8AKZqUd9JRk/BC+3slM5e8n+u9p3ST0guxsemkzaoN2uvpSozt1rHSh/uw JhSkKAU1SgMebkSketcC3CaVRFLHMy7TXmGeQdh5LtwTC9P38Zv7yI8EyoEQ7ZL1t8kA uBReLa5q1NE3n8Y2GApD4FA8vFVjp9lRoop3IaI+vH1DQubALMX06JT6eFUSo46cpZWA Uy+78Dn3HA1Gjy97rkrLRnTCIAjBNDUbQIx4n6UWDlt8j8DxchYa94S3bqA5zkWWdPAz /6sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dXhvjxgs; 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 w4si9911707ejj.300.2020.06.22.15.29.50; Mon, 22 Jun 2020 15:30:12 -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=dXhvjxgs; 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 S1731121AbgFVW1z (ORCPT + 99 others); Mon, 22 Jun 2020 18:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731096AbgFVW1u (ORCPT ); Mon, 22 Jun 2020 18:27:50 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C0F0C061573 for ; Mon, 22 Jun 2020 15:27:50 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id x207so9073970pfc.5 for ; Mon, 22 Jun 2020 15:27:50 -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=JI0wkwVCNwXzxyeXGfReWogDJ8TItG8DNO4AEUQrZHU=; b=dXhvjxgsKaYVqQPZKIedonRiQSDzKyvMILv82JolQOk3j6k4i+l8LLeVQR0zMdWyMF NV4K5H1nj1Fe6XqV4PoiAxy70HQrCiGYUADhUS3shyAnm3nLjJyCum+9jvjgntLPNBNg s10y2Bg2EUA1xvV2Tk/e1CQRLU91b62R9aXyw= 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=JI0wkwVCNwXzxyeXGfReWogDJ8TItG8DNO4AEUQrZHU=; b=lY+jhLAAkW0s5zaCgnzwY2ubhKuFHOMDJAgaF69emS62NIJ0r3KIb2fG1nBvU6Fq00 mbzI7KV15s0rTNzlSl1Q83WgN/L+fYvqxCNLgVijqzG9R3bDOWaJWx8LjQ0R5TAU33ww eOONltEYqzehFRcuG45ESKYC9A+cnPqDEKZRuKfGjR5Pq/EEQFPD+RtToLHm134ua2EP P4BKUKti086nloXdeBVKYNvn+AU0/lROhUkj4IL2OMAXwyl+m7LdIM0Vrf+fl4+ilGHT OmIXAYiWF1sgX8LAbOSeoXq3ZSh97LUg++U7FNii/ZoOrHfCQ9djnsZNLEVlgQhZbXUE V1xA== X-Gm-Message-State: AOAM530Lu3W4dOIzHXunjR6iaLI1hOK4iBryqxcS7ap6TWayFMj+zL48 LmOVMSUNer8kTtv5uEo05sssVw== X-Received: by 2002:a62:2743:: with SMTP id n64mr21722151pfn.163.1592864869777; Mon, 22 Jun 2020 15:27:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id fv7sm453463pjb.41.2020.06.22.15.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 15:27:49 -0700 (PDT) Date: Mon, 22 Jun 2020 15:27:47 -0700 From: Kees Cook To: Fangrui Song Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] vmlinux.lds.h: Add .gnu.version* to DISCARDS Message-ID: <202006221524.CEB86E036B@keescook> References: <20200622205341.2987797-1-keescook@chromium.org> <20200622205341.2987797-2-keescook@chromium.org> <20200622220043.6j3vl6v7udmk2ppp@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200622220043.6j3vl6v7udmk2ppp@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 03:00:43PM -0700, Fangrui Song wrote: > On 2020-06-22, Kees Cook wrote: > > For vmlinux linking, no architecture uses the .gnu.version* section, > > so remove it via the common DISCARDS macro in preparation for adding > > --orphan-handling=warn more widely. > > > > Signed-off-by: Kees Cook > > --- > > include/asm-generic/vmlinux.lds.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > > index db600ef218d7..6fbe9ed10cdb 100644 > > --- a/include/asm-generic/vmlinux.lds.h > > +++ b/include/asm-generic/vmlinux.lds.h > > @@ -934,6 +934,7 @@ > > *(.discard) \ > > *(.discard.*) \ > > *(.modinfo) \ > > + *(.gnu.version*) \ > > } > > > > /** > > -- > > 2.25.1 > > I wonder what lead to .gnu.version{,_d,_r} sections in the kernel. This looks like a bug in bfd.ld? There are no versioned symbols in any of the input files (and no output section either!) The link command is: $ ld -m elf_x86_64 --no-ld-generated-unwind-info -z noreloc-overflow -pie \ --no-dynamic-linker --orphan-handling=warn -T \ arch/x86/boot/compressed/vmlinux.lds \ arch/x86/boot/compressed/kernel_info.o \ arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o \ arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o \ arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o \ arch/x86/boot/compressed/cpuflags.o \ arch/x86/boot/compressed/early_serial_console.o \ arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/kaslr_64.o \ arch/x86/boot/compressed/mem_encrypt.o \ arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o \ -o arch/x86/boot/compressed/vmlinux None of the inputs have the section: $ for i in arch/x86/boot/compressed/kernel_info.o \ arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o \ arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o \ arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o \ arch/x86/boot/compressed/cpuflags.o \ arch/x86/boot/compressed/early_serial_console.o \ arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/kaslr_64.o \ arch/x86/boot/compressed/mem_encrypt.o \ arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o \ ; do echo -n $i": "; readelf -Vs $i | grep 'version'; done arch/x86/boot/compressed/kernel_info.o: No version information found in this file. arch/x86/boot/compressed/head_64.o: No version information found in this file. arch/x86/boot/compressed/misc.o: No version information found in this file. arch/x86/boot/compressed/string.o: No version information found in this file. arch/x86/boot/compressed/cmdline.o: No version information found in this file. arch/x86/boot/compressed/error.o: No version information found in this file. arch/x86/boot/compressed/piggy.o: No version information found in this file. arch/x86/boot/compressed/cpuflags.o: No version information found in this file. arch/x86/boot/compressed/early_serial_console.o: No version information found in this file. arch/x86/boot/compressed/kaslr.o: No version information found in this file. arch/x86/boot/compressed/kaslr_64.o: No version information found in this file. arch/x86/boot/compressed/mem_encrypt.o: No version information found in this file. arch/x86/boot/compressed/pgtable_64.o: No version information found in this file. arch/x86/boot/compressed/acpi.o: No version information found in this file. And it's not in the output: $ readelf -Vs arch/x86/boot/compressed/vmlinux | grep version No version information found in this file. So... for the kernel we need to silence it right now. -- Kees Cook