From patchwork Tue May 11 18:50:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 12251887 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 7E2C8C433ED for ; Tue, 11 May 2021 18:53:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDDCB61185 for ; Tue, 11 May 2021 18:53:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDDCB61185 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZxKy1zOy+dMsq1uCi4V9kNN5LfMICQ1QP3hb269NhnU=; b=dEwduyxPujzs/6iBmBtvKGsPe UUGdMwXN1KYxdE5dRJZPj4M3KH/I0NTjmjwwLnFy3B4tgc9xtcCFdsVtfZ5VWRwM6bcU31EJTJD3X 9N++TiaJaXUyNe9fTxFPr74b/BXkFL2p+1h7WQXQQE3I+O9l3mgexIK+xvN9dwkiytbhVDGQvHaPZ oQbc8h9s/EXX5SJtkWcggebgfnsZqpc04XxSUhH8yQYJz7xjKwrUgWiPyt+pQsUY1vroawhSxKoo9 c6XMeB7pSXxyrGCnODlKoI5EL175grzfAHGUTvyZprUcjHhnTwUB0ktuU4o1qcA8438JRkIAim389 KwilIq6Bg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgXU1-0013EM-4D; Tue, 11 May 2021 18:51:53 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgXTx-0013DO-JQ for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 18:51:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=a/h54JdNC5kR17fX7/LoX7g8+9V1SkM6LPGM//jz9YE=; b=42CuWiuz8HP7CkYi469ewJ8SKQ /+GYB+EgJPKEdQvAZnu/012B18g1A9xI7zFAFCSjZKC4s0yzIcAyvXmWG+OHEByuneLfbfesCd3QN V3p2ajZSA1FZ7xWEG6QZwpRoWdxgkGacK8CrnH0BqqiyvT8yPOdxw1JH/0xxtrU6is5RK0m9q1spe h+hYFyJvyp9VvXCLmQJcTOWgzukelZWeqv++HDQtd5eaM/knu+OtVpWVdp5W8Z15DPnMDfYkMEbUJ jr2CXYAn5xL0tOL3UilOeOAk6FRxulbI2yLd4WtF45S+E+DNukbgI5RLMqZHduXqnXMgWYQB7VYpa ZCkd1nSw==; Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgXTu-009qvR-PP for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 18:51:48 +0000 Received: by mail-il1-x136.google.com with SMTP id h6so18057982ila.7 for ; Tue, 11 May 2021 11:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a/h54JdNC5kR17fX7/LoX7g8+9V1SkM6LPGM//jz9YE=; b=TyuPG2wOFQrgKxI20nIja2mzk8NJAyGwIiLGj/NpdzrU1nuGJ3oPGW2TGiZg9bh6wd 30l/Phnddorg+Dvatg6e2gDVLUG7R3rAPN2Tgd3NmEqqFan8p6PHC/BHRVy8iRfaJKO/ amPeFT9M8GsyJElzvFaLAn6XDBv4c2LfW0nsjuUlmr8W6BpEzw+zMNtu2oMoNGHvcG8n gogAnm+letvJoMK/VTjaueLYu4SHHfVbY1uWf04y/zmGK7thYghUd94dqrU5FliesezB 8v5dWnyTDFWI0iz9wFXKfwg5Mi5uV4qoD9KMqGpRrSNSx29CnxRTbSnLd/H57hp6QPlO bPRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a/h54JdNC5kR17fX7/LoX7g8+9V1SkM6LPGM//jz9YE=; b=lN40wctn6pnz8hPkvMyJz94gfNtFUmqJy66JKyUJ2jxkrZ1qZUzvSdgTweouMVqFMS VMl5DpZo0rhy7Nr2UHGYvXi52arZhJJmwTJuNJHJc3SdAlRRcHXd7mVFKs0Ym6VBmkrX yzaukjyWoBWe9YGTxNUrZqfMxAZwTpoqhn5u/4BirZyIvVCSrlmRcoz9d6agY5aJ4TUw mFG6HFqMzcGBTH7NwCqO6hmmaFZlo+LIffCGjH5dzZkR2C+qt8NBMYug0ghUNFLt/vqT B56V4bAU74MSn9bMC6XHhpEuFlfeT700t9YBQgnjJqaarjsA3W4B3wsIDD1F4OdER/IZ K0CQ== X-Gm-Message-State: AOAM531n8pmGBda7h+90v0arxAA/ivFSrMtO3FWrJnJH/C7Bz5p7yeCM VbILXRgt+XV8en/fDNPwgzk= X-Google-Smtp-Source: ABdhPJzcb33bvz5DI0nPKr87rXTBl99c1OgYhzBNlqj59Pxj7WEvcQRq6DDiruZk26m5IctEX86qCA== X-Received: by 2002:a05:6e02:1b85:: with SMTP id h5mr186059ili.303.1620759105380; Tue, 11 May 2021 11:51:45 -0700 (PDT) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t10sm405096ils.36.2021.05.11.11.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 11:51:44 -0700 (PDT) From: Jim Cromie To: Russell King , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Ard Biesheuvel , Kees Cook , Nick Desaulniers , Masahiro Yamada , Linus Walleij , Nathan Chancellor , Geert Uytterhoeven , Bill Wendling , Sami Tolvanen , Jim Cromie , Arvind Sankar , Joerg Roedel , Nick Terrell , Dave Young , Pingfan Liu , Atish Patra , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-efi@vger.kernel.org Cc: linux-mm@kvack.org, lkp@intel.com Subject: [RFC PATCH v5 17/28] dyndbg: prevent build bugs via -DNO_DYNAMIC_DEBUG_TABLE Date: Tue, 11 May 2021 12:50:46 -0600 Message-Id: <20210511185057.3815777-18-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511185057.3815777-1-jim.cromie@gmail.com> References: <20210511185057.3815777-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210511_115146_845599_5F4FE833 X-CRM114-Status: GOOD ( 17.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. 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