Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2022974ybh; Tue, 14 Jul 2020 13:30:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwzjG6wu4nRM7MfH3Cl+TdD5E+6I53JsEFruwnq5zoANLhaUpy8t/hrEE8CR3GwdS9UfCH X-Received: by 2002:a05:6402:1d0b:: with SMTP id dg11mr6145298edb.212.1594758611945; Tue, 14 Jul 2020 13:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594758611; cv=none; d=google.com; s=arc-20160816; b=S/09CltvX3uz1oOs9mpV5V/9OfbQIA9eBVUVYPYnTj4keD+4dbyAZHTFQRgbhWxRVC IuXvEQ0YFGwKRWpL90fFLdZgBaGdrSnrjmVRNAtnJPHKq/VadwmOP5yWiTZm51ItsITM SdCTMuD/Fw+xbuyS5RlDfr0JOc6Dg4Qs2NIS8PW4HonXySWXRKZAcllVPeXKQhAB13E+ KxU2kaSKvGsGhHE1xl+oq7zcZ1Km5X4TRLdrUP8sAOTLBy7TUU22AIXG+3GXKK9DQeEb PagVvfsWlsO1oGuVkg+2+BbExC2zYIxGhSFegejIJeB5nZmWs69XKaeBnivEKvr82868 9xGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=2NQULvuOEAYnvgAO7OEbngziveI6HXFBIvKCbGUQGt8=; b=tkPJIt7agJ3Vg6jlwpqQOCxkGKhjGlgqPSMOD0NGAiSKwmNVdIg+CEgbXCy9BhjAWT /i/Nq5zNfhGs189JFDSA0C1f6h5grQqyaus+hFuyk+H342Yg2UcTNKLGa9yn5W0D7PM8 0Y2OXRN1UMPpwzRs4jMBX0Vg43XV1iQ0qQz7t+TgSfiruOjfQZOzfeur2inHyzGL0j93 FLKNhbgGEshF+IgW7gIT+K/SDJ42XhutC8/C14tpCvOJrfMHpzVtr3kFID1+TDjOUMUC RCph7x3U1+A2vRzokbzdXARtjv/IE/XSbhoL4+qGA0ibPwQUAs11YeLzs8XH3ugPCEbP M2jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jEOHcp6g; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si11412315ejb.631.2020.07.14.13.29.49; Tue, 14 Jul 2020 13:30:11 -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=@gmail.com header.s=20161025 header.b=jEOHcp6g; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726758AbgGNUYW (ORCPT + 99 others); Tue, 14 Jul 2020 16:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgGNUYU (ORCPT ); Tue, 14 Jul 2020 16:24:20 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B987C061794 for ; Tue, 14 Jul 2020 13:24:20 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id e64so18719593iof.12 for ; Tue, 14 Jul 2020 13:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=2NQULvuOEAYnvgAO7OEbngziveI6HXFBIvKCbGUQGt8=; b=jEOHcp6ge0HHz/3BHLQa/8i9Ro5rhqePy7mVFbkqOXznVWCPrYljvxZ/eR5Q9otJsF Oljv2JCI8WhjtZurE3LE2vyj8MJyKiEUN3Joqg81nj3dIKEDREw7ird+H3ZkTUafqlcG EY0P9scFPXGS/P9l4oavSTEwO44rWbws/Trp4miDtoD1BmbJW2gvj/dBuK1E5sEWtnXm bDp+Gdh0iDIfBO51tm/cQLHbBH/DRH3XjXRUzwDvad1E63RnPX3/3v7++LkgL6nRtF1b JITIcbyq6ocGKVXheZfbrsioM/HlOIyekcgoV58mUMbtIPa4QlopeqimQg4kSWHpay+q HexA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=2NQULvuOEAYnvgAO7OEbngziveI6HXFBIvKCbGUQGt8=; b=nAy8DniZu+FXlTilZ1ElBg2QkPnKXRVRs7tthNh9SxOnpBiM8oPRLbp5drF1SWlIxj jmocsOLUyFM6WeT1KSut/KCLNRbAeOkxTJOxdkCoBvBa8xJFKAMpouv0gaXRAoivlJ57 /FmOZdueRKj22fG18X5L1gGkNW7hPlbTU7XBE+8IXzRDJQKXE/hjtLI1k4ovqLnTbFDM sWZ376AT8Kv+LGzRs9YwvhyxhQ4wP8rgeT2Q5ecMJenVfpgtbNQy8pSRP4Ldcgsl9huZ DeDN9bj1hQmug69sEPPI2IlbgHj69VjWxx6K37TReSPTVkvwt41OWAop74qpkp4Zgf+b 4PFQ== X-Gm-Message-State: AOAM531eJ0cxug7F9SfcNt98C3Lnf7jw7EflQwWdZOX7o5N6A6hESmKX YAeHb6vlBuV5FB2bmUgAdE5jA/JNFTdPSBBBTP8= X-Received: by 2002:a05:6602:1555:: with SMTP id h21mr6612386iow.163.1594758259727; Tue, 14 Jul 2020 13:24:19 -0700 (PDT) MIME-Version: 1.0 References: <20200629140928.858507-1-nivedita@alum.mit.edu> <20200714023836.2310569-1-nivedita@alum.mit.edu> <20200714141550.GA329060@rani.riverdale.lan> <20200714192956.GA689174@rani.riverdale.lan> <20200714202100.GB902932@rani.riverdale.lan> In-Reply-To: <20200714202100.GB902932@rani.riverdale.lan> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Tue, 14 Jul 2020 22:24:07 +0200 Message-ID: Subject: Re: [PATCH v4 0/7] x86/boot: Remove runtime relocations from compressed kernel To: Arvind Sankar Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Nick Desaulniers , Fangrui Song , Dmitry Golovin , Clang-Built-Linux ML , Ard Biesheuvel , Masahiro Yamada , Daniel Kiper , Kees Cook , Nathan Chancellor , Arnd Bergmann , "H . J . Lu" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 10:21 PM Arvind Sankar wrote: > > On Tue, Jul 14, 2020 at 10:08:04PM +0200, Sedat Dilek wrote: > > > > > > > > In any case, I think the right fix here would be to add -pie and > > > > --no-dynamic-linker to LDFLAGS_vmlinux instead of KBUILD_LDFLAGS. > > > > > > Hmm, you might be right with moving to LDFLAGS_vmlinux. > > > > > > > We will need the "ifndef CONFIG_LD_IS_LLD" as -r and -pie cannot be > > used together. > > Is that the or not the fact when moving to LDFLAGS_vmlinux? > > LDFLAGS_vmlinux will only be used to link boot/compressed/vmlinux, > whereas KBUILD_LDFLAGS is used for all linker invocations, and in > particular the little link to do the modversions stuff ends up using it. > > So once we move -pie --no-dynamic-linker to the more correct > LDFLAGS_vmlinux and/or stop modversions running, we'll be fine. Being > able to use -pie with lld is one of the goals of this series. > OK, I am doing a new full kernel build with: $ git diff arch/x86/boot/compressed/Makefile diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 789d5d14d8b0..056a738e47c6 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -51,7 +51,7 @@ UBSAN_SANITIZE :=n KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) # Compressed kernel should be built as PIE since it may be loaded at any # address by the bootloader. -KBUILD_LDFLAGS += -pie $(call ld-option, --no-dynamic-linker) +LDFLAGS_vmlinux += -pie $(call ld-option, --no-dynamic-linker) LDFLAGS_vmlinux := -T hostprogs := mkpiggy - Sedat -