Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2023315ybh; Tue, 14 Jul 2020 13:30:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBHbjmxCfICk0U55fqiNqh52tUTZN46AsP3pZMisJZvvh3rl0VHMcMX+bq3fb0OfgWq/n2 X-Received: by 2002:a05:6402:1544:: with SMTP id p4mr6436181edx.334.1594758656117; Tue, 14 Jul 2020 13:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594758656; cv=none; d=google.com; s=arc-20160816; b=WP+NzI4NoTx6wkuGGqE+GDYbOJ2vNYSYASEYPq5s+I0hJeKysfirEO4QeqiKKGBnNr 8xK2VQaNrqJYPhRjEp8Rch/hcTZ5IycsMEnIDfUX0CYovVOgvg9rPTYoKiavXzpK4ME1 n/a214fLjxLlIV4Bo9oLlnHZyoAWRiYt4cxqxqmYY+WIkwhw6ZScR95ymMi7sdGgTnzt ZeltmMLrlHnQxNjl/Bw+j7sgC8zwY2A2R7KT034XQh5CBXBh+Lf7cDuMtPH5z7ym+MDK ATxpUjP12ooN4N0U+JRQrafhuuRl8oX3dDD1Vz+/VXjbU9zDfVfNs85LrJg9j7fF5U+D tHjg== 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=S61ooPbjIf+07WwP1E03FOEq3OylQk5m8w2sALNuVy0=; b=lH8PsFQ1o7T/VMMfGqHxbJ5B1kkK1HATsCFzBnsWYVN085KKkIhM6/+/hkK/j2ioyL 93BDtsUIZkcJ2mEJHWGQ9Juo1hfvuidXhL/2b/IZgorqA14OHXCx9vnhwidRqNANCoJP wC6vr+XTuxMZa9KGnjt0X0iTxrUq3feg+gdjFSk4pfiy6nYJBzyuHmtm2KjpNb/5i7a4 qzTUfTljl+oaOhPWvuWpi8b8/NNP0qVEP8+ABf6u+/BehNg86xEMaT+KnrXCZkL7QY8T Rn2aitlpMZWFBmaloG+d3EtN98EJA4O329O0YIM8kxuERMobGldYAMrGqx1yyztpZaWn ZVIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XEYMCQK/"; 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 lw21si11615268ejb.302.2020.07.14.13.30.31; Tue, 14 Jul 2020 13:30:56 -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="XEYMCQK/"; 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 S1726793AbgGNU1l (ORCPT + 99 others); Tue, 14 Jul 2020 16:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgGNU1k (ORCPT ); Tue, 14 Jul 2020 16:27:40 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 240C8C061794 for ; Tue, 14 Jul 2020 13:27:40 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id k23so18691308iom.10 for ; Tue, 14 Jul 2020 13:27:40 -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=S61ooPbjIf+07WwP1E03FOEq3OylQk5m8w2sALNuVy0=; b=XEYMCQK/E2f2HZFifidSVNUV/R2S0M4uHUl/nHp0fiNRmQMUqid5WGsmAFtR8l3/nj Z7dYO7nPXns1vXLMab8s1T2Fk6vE/yzO7i694SaNzSlp4JHOBEZbV6RlGRY8wLkyJ271 SjJozge+bFuFBHUzpJbgizGBvkPAMaDL0IG4vVANMR6ej9n7t7fDrLlsV5ber9+SoIpm mKJg86poUsz3VTF5RDgdtuwU1vkI1AU0T4iGWzx9sY8Ak2gMFzbGHrwD7B7aRYh/0lXy sdvyX9499f21mj0fgiR+NaQxZ8bSYA8G4cw6Drptb7j0sLoS9oNci+rwViaqktouq5cT pKbg== 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=S61ooPbjIf+07WwP1E03FOEq3OylQk5m8w2sALNuVy0=; b=FhqyugyU8S7qNqNU9SEpVtb8Uh+sCZiMUVxncrzM0J3k2q3bBfst0XdUm/olEQ/OAs 7OWHenjy5ZuGpY0n/Q6xwiX9CCS06HaVBLbadNJWqUnitp3gcrdAHWF/0XespTIz5loF vjrYFiq0pO5UPAnNABF1sXjt46p41U6Nn5VKRaG+Hf6XnCyhyUjM+ms4d0M9+8VM6jCp YR4LYi8jbk/7deJBl1LiSbTvjWia1XG+uVj7UPmIC1ej2sO+SxoTjppjTHtqCvLMMvSf i9p3yq5H0UzQgraok+V1H+9m5gcrO2SPq66nsVi4yShDZjihfjjE7ahpcPjIXpFPkMwC Y76A== X-Gm-Message-State: AOAM532CxE+Ulu0VcZrQ+1yh1AKCw2hx1isO4WAOn6J5TGcTQhL/KvQV Fc9EnIIUR2X8Of5KZDd4r4nSYyiQfKBnmWlN9Ao= X-Received: by 2002:a02:ce9a:: with SMTP id y26mr8005981jaq.121.1594758459500; Tue, 14 Jul 2020 13:27:39 -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: Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Tue, 14 Jul 2020 22:27:25 +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:24 PM Sedat Dilek wrote: > > 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 - Not my day - today. $ git diff arch/x86/boot/compressed/Makefile diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 789d5d14d8b0..9784ed37a5d7 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -51,8 +51,8 @@ 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 := -T +LDFLAGS_vmlinux += -pie $(call ld-option, --no-dynamic-linker) hostprogs := mkpiggy HOST_EXTRACFLAGS += -I$(srctree)/tools/include - Sedat -