From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C864C433B4 for ; Wed, 12 May 2021 14:55:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B016B61420 for ; Wed, 12 May 2021 14:55:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B016B61420 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 30F376B0036; Wed, 12 May 2021 10:55:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E6896B006E; Wed, 12 May 2021 10:55:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 186746B0070; Wed, 12 May 2021 10:55:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id DA0A36B0036 for ; Wed, 12 May 2021 10:55:32 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 72B145831 for ; Wed, 12 May 2021 14:55:32 +0000 (UTC) X-FDA: 78132877704.07.25A0EB4 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id 5A61D3FF for ; Wed, 12 May 2021 14:55:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id BDD5B6157F for ; Wed, 12 May 2021 14:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620831330; bh=DvKCo+D/uNmFT6p2+ZAdmHSuFl+XPHUCcdtAgp8SinQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=s5UJXp5A1ehWLquNUtUygQzPoAeGL5vtitKRKqK7MMfGQM/4qJn2NWXsr8zyxrZ/f HVOO6bUKiOk+O0GZJb/rcyUJjbSOy1I8xiww4X3IxU1yGTogCaAilw0MakKjs1PRcH frdF8sGqgOtHULizm4fHwXMlYKr5RomnwES0YNA163ZT3kWYtzIK0Pch44oBAiyN4W SAf4wOMGM42IYPgwOPYpC3CH+FQehusJtnW72j8gB6j7jjFTgkK74L6VQdmFjbTaj0 CBwWNOzBK1NzWOzItpfXq91+yiTuujcXFW4lojWbqTqx3KlX2F4pKS5OPUzK6XPSif Yzjrm2O71TopA== Received: by mail-ot1-f46.google.com with SMTP id t4-20020a05683014c4b02902ed26dd7a60so10652453otq.7 for ; Wed, 12 May 2021 07:55:30 -0700 (PDT) X-Gm-Message-State: AOAM5302Kc01Iv4d6bztxgffdyLaOpIftktDbZ+5an0dOkyDaJ4wwH6C qYp5znIH2hcQ29nmB5bPX5HBP9Ox5VBnhMv117c= X-Google-Smtp-Source: ABdhPJzYb9Oaloykf1CG+pTRbJVzjiXnCPWHMEzD/y4/q2A9ig0gIcqKYlTWZovopNvMJ5IO7bPdtjymQwkgeuAUOVI= X-Received: by 2002:a05:6830:4da:: with SMTP id s26mr30866699otd.77.1620831329825; Wed, 12 May 2021 07:55:29 -0700 (PDT) MIME-Version: 1.0 References: <20210511185057.3815777-1-jim.cromie@gmail.com> <20210511185057.3815777-18-jim.cromie@gmail.com> In-Reply-To: <20210511185057.3815777-18-jim.cromie@gmail.com> From: Ard Biesheuvel Date: Wed, 12 May 2021 16:55:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v5 17/28] dyndbg: prevent build bugs via -DNO_DYNAMIC_DEBUG_TABLE To: Jim Cromie Cc: Russell King , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Andy Lutomirski , Kees Cook , Nick Desaulniers , Masahiro Yamada , Linus Walleij , Nathan Chancellor , Geert Uytterhoeven , Bill Wendling , Sami Tolvanen , Arvind Sankar , Joerg Roedel , Nick Terrell , Dave Young , Pingfan Liu , Atish Patra , Linux ARM , Linux Kernel Mailing List , "open list:SPARC + UltraSPARC (sparc/sparc64)" , linux-efi , Linux Memory Management List , kbuild test robot Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 5A61D3FF Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=s5UJXp5A; spf=pass (imf04.hostedemail.com: domain of ardb@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=ardb@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam04 X-Stat-Signature: khmjde5sqf1dhj17yaswf9u4tpq51fii Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf04; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620831325-251723 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 11 May 2021 at 20:51, Jim Cromie wrote: > > The next patch adds DEFINE_DYNAMIC_DEBUG_TABLE(), which broke several > subtrees, including efi, vdso, and some of arch/*/boot/compressed, > with various relocation errors, iirc. > > Avoid those problems by adding a define to suppress the "transparent" > DEFINE_DYNAMIC_DEBUG_TABLE() invocation. I found the x86 problems > myself, lkp@intel.com found arm & sparc problems, and may yet find > others. > Given that I was only cc'ed on this patch in isolation, would you mind adding more clarification here? What is DEFINE_DYNAMIC_DEBUG_TABLE() supposed to do, and why is it breaking standalone binaries? > Reported-by: # on [jimc:lkp-test/dyndbg-diet] recently > Signed-off-by: Jim Cromie > --- > arch/arm/boot/compressed/Makefile | 2 ++ > arch/sparc/vdso/Makefile | 2 ++ > arch/x86/boot/compressed/Makefile | 1 + > arch/x86/entry/vdso/Makefile | 3 +++ > arch/x86/purgatory/Makefile | 1 + > drivers/firmware/efi/libstub/Makefile | 3 ++- > 6 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > index fd94e27ba4fa..72f056a00ad4 100644 > --- a/arch/arm/boot/compressed/Makefile > +++ b/arch/arm/boot/compressed/Makefile > @@ -82,6 +82,8 @@ compress-$(CONFIG_KERNEL_LZMA) = lzma > compress-$(CONFIG_KERNEL_XZ) = xzkern > compress-$(CONFIG_KERNEL_LZ4) = lz4 > > +KBUILD_CFLAGS += -DNO_DYNAMIC_DEBUG_TABLE > + > libfdt_objs := fdt_rw.o fdt_ro.o fdt_wip.o fdt.o > > ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) > diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile > index c5e1545bc5cf..960ed0fb6804 100644 > --- a/arch/sparc/vdso/Makefile > +++ b/arch/sparc/vdso/Makefile > @@ -30,6 +30,8 @@ obj-y += $(vdso_img_objs) > targets += $(vdso_img_cfiles) > targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so) > > +KBUILD_CFLAGS += -DNO_DYNAMIC_DEBUG_TABLE > + > CPPFLAGS_vdso.lds += -P -C > > VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 --no-undefined \ > diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile > index e0bc3988c3fa..ada4eb960d95 100644 > --- a/arch/x86/boot/compressed/Makefile > +++ b/arch/x86/boot/compressed/Makefile > @@ -31,6 +31,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ > KBUILD_CFLAGS := -m$(BITS) -O2 > KBUILD_CFLAGS += -fno-strict-aliasing -fPIE > KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING > +KBUILD_CFLAGS += -DNO_DYNAMIC_DEBUG_TABLE > cflags-$(CONFIG_X86_32) := -march=i386 > cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone > KBUILD_CFLAGS += $(cflags-y) > diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile > index 05c4abc2fdfd..619878f2c427 100644 > --- a/arch/x86/entry/vdso/Makefile > +++ b/arch/x86/entry/vdso/Makefile > @@ -29,6 +29,9 @@ vobjs32-y := vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o > vobjs32-y += vdso32/vclock_gettime.o > vobjs-$(CONFIG_X86_SGX) += vsgx.o > > +# avoid a x86_64_RELATIVE error > +KBUILD_CFLAGS += -DNO_DYNAMIC_DEBUG_TABLE > + > # files to link into kernel > obj-y += vma.o extable.o > KASAN_SANITIZE_vma.o := y > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > index 95ea17a9d20c..95ba7b18410f 100644 > --- a/arch/x86/purgatory/Makefile > +++ b/arch/x86/purgatory/Makefile > @@ -35,6 +35,7 @@ PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel > PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 > PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING > PURGATORY_CFLAGS += -fno-stack-protector > +PURGATORY_CFLAGS += -DNO_DYNAMIC_DEBUG_TABLE > > # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That > # in turn leaves some undefined symbols like __fentry__ in purgatory and not > diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile > index c23466e05e60..def8febefbd3 100644 > --- a/drivers/firmware/efi/libstub/Makefile > +++ b/drivers/firmware/efi/libstub/Makefile > @@ -13,7 +13,8 @@ cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ > -Wno-pointer-sign \ > $(call cc-disable-warning, address-of-packed-member) \ > $(call cc-disable-warning, gnu) \ > - -fno-asynchronous-unwind-tables > + -fno-asynchronous-unwind-tables \ > + -DNO_DYNAMIC_DEBUG_TABLE > > # arm64 uses the full KBUILD_CFLAGS so it's necessary to explicitly > # disable the stackleak plugin > -- > 2.31.1 >