Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1421608pxj; Sat, 29 May 2021 13:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwPSJ8p1w0pOmYQtqrTIbuUmTjukgsNEh1DT0GuJOZmChdV+cJWvkwdEGqsFcLriG/BUyy X-Received: by 2002:a05:6e02:1be8:: with SMTP id y8mr11815174ilv.52.1622318671197; Sat, 29 May 2021 13:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622318671; cv=none; d=google.com; s=arc-20160816; b=bzbA2kvIxNDahqqGNuK4AP6aatCKHQ7ZFd6XZDryZKTmr1ajMxyanSbcJ0wAuc2sYL yLgNVo8T7qm8Mn/fUv/CyrAs0LQSpT7BZifvAZrTiUlemeOlCD5q/YzieQijsQx+gHwH S78JOHkpPRtZzhED3MPp3Dws80o5ROKocoDnF40YITeRuLxGxh5keyDVZbCXbW15JeUA K9naggWBLjlVWy3lE8rUZNn4k+MsHc+oKi0Bf584ZPoyGoxtPy6Zn8ywJz9z2P2kUWTB Cq0f217yLzDR57ipqQmBtM6elXH9Zt9Unuuqhxrs+7MJP1rGMvwd5yXTHliSJvcaddvg G+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a/h54JdNC5kR17fX7/LoX7g8+9V1SkM6LPGM//jz9YE=; b=LcqtQoB+eTK4wYdJLqm5n1xOM3tL4eNDChrr/RJurhqg8Os4pbD20WRbktl5ITMYAp 3ZdausxX31oJ0ErE66cxZtCq4qAoPy7HIY3S5wjRB4TpMNTXsZxBcFVt/kUylJl+zMq4 sVTFRnwQvaTvjgC90WboHJWsof86sZhKa/+pZGGV5S7LJ7Zu8Lrn1mkT7KJj2C8xCgye LTZ45TMyzbRfQc3rxBBoBPSGvj6ZSlRG2UgMQcR8n6PPW459rUC09lZdACUI5OjDDh/3 b0MSjZj4qk14FC0P4bbYifRggHo/utYNVkdKYKOBKrgXHbQP7tJOVOTlxF5xqlSQ2tUf g/ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VmVrhUYz; 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 x14si11072979jat.74.2021.05.29.13.04.10; Sat, 29 May 2021 13:04:31 -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=VmVrhUYz; 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 S229996AbhE2UEh (ORCPT + 99 others); Sat, 29 May 2021 16:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbhE2UEK (ORCPT ); Sat, 29 May 2021 16:04:10 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7C4FC0613ED for ; Sat, 29 May 2021 13:02:32 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id b25so8012147oic.0 for ; Sat, 29 May 2021 13:02:32 -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=VmVrhUYzXNmN1CdZ2TImKKYCJUPeXX1q1hDG3iDyWWU4vUIcGSF5Dmz2MPXiGvvIRT d5q/SMM4bpp2wkdrPV57CkCeyTQJg2OksYKcuN71CAcO+tUdkvTr+lRZp/jm1lnR0+AA KeDxbgFyG6szVkb1n0/CPysY+pudk9MDUprYahlHpuucHMs3hIJf2UMA+SHSHMYVMEOQ b+avDdJoV/t5pckQzELfBnWFU9854V+BmkXJVPgIEKci2HLPpdCBlQx3tNNYsZ5xoWD8 XX0SJcMmzI6Pb2TeOQU2H79fju2CfLeq1hy8XSZyN9xywW6/qXKBa5yoNkRxet2z7LXq 8qxw== 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=M7u44H3/GlXX6VtjWmPBG99q3VD+XNfRzhyeQdKaA1+s8DoTdvzuWPxwBDYyza9PBT L5rH19cMDEw1SYMVmKUTPkw+SiNmw0J5rba1uU5G8jtQjn0NIf+yu0QVbZE9a29krqZP Z2ftfpxFi4I6mL4p4YugkeAKEceNbyA1XporSxROdkuMcsDoUMRxUM3CqCCzUV0w4AtW qWxJhDmRC5zM7eLlDye5dlmxGnPb13JmPWVqCJdDDNPtG2xS0sdDIfhPdwnsQ7oZnsG6 yndGGHmxM9YJcBrc9/LA5ErIVDsAYtgsKWg7K6poEx0Y+L2Umogt5HcV9y/ZE2FWLXVB lVJQ== X-Gm-Message-State: AOAM5321h6Yma48pRQWpK3lo0q1lWIL0xn8VCXVlkjdFei3jSoNyReay 8XVKjrJwtfgjPJKuX+NiT/4= X-Received: by 2002:a54:4594:: with SMTP id z20mr12924109oib.100.1622318552253; Sat, 29 May 2021 13:02:32 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t39sm1868064ooi.42.2021.05.29.13.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 13:02:31 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie , lkp@intel.com Subject: [RFC PATCH v6 18/34] dyndbg: prevent build bugs via -DNO_DYNAMIC_DEBUG_TABLE Date: Sat, 29 May 2021 14:00:13 -0600 Message-Id: <20210529200029.205306-19-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529200029.205306-1-jim.cromie@gmail.com> References: <20210529200029.205306-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.31.1