From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F9EC322522 for ; Wed, 8 Apr 2026 20:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775678542; cv=none; b=kG9XeiiTSVzoKeQAQ3zY70DAuuUrt3gE1rc/iBpWkwddDkqGsea9YLT2LT3m6NsDBYhRUZ4MKy8001c6Ui8hUDxfJP4LbGifVptHeKPymA1rgFW3VXAfeJ8CcxjHKSPiLWx2Qp+1GAxFBOWNIQczR7DTnz8kr9IRKGFpWaKGySc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775678542; c=relaxed/simple; bh=BBEPtf+MkETNuagrJrkwWSnSZr8x+EAveVod63of4Us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S/XVzxZ/2NfbzonlewDPFylnAUdCIebaLHwGPZ3tVP4Jl8/bxBWBSvSdnQGJlEqtBiRXHXC38/bvS8Re7zFUhKmG4t/O+fl1+KzWeXZznR9BQT0V+SIviPYPt9FQe/Djdy9+RQNc2tlCfKOP+yqLBofPjiOhkYKaDKiB8kBOZPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DhomcSMp; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DhomcSMp" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-68244d317e5so86755eaf.0 for ; Wed, 08 Apr 2026 13:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775678540; x=1776283340; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OqKdylESk9B/a6b5Oi5X2s5Hl7NPYjGcR39u69Tcphw=; b=DhomcSMpkuqU8h0d/tq3veUO8QGWvWEYKtEZ338GBDBQmcbylCLcBU9hDbaa5Tksvf x1ER2d3zyf8/sAw+kjnP3USmgt7TV6r7O8EQwQJyJqmYhYmO2AGLW0yV6tG2FHGqQa8S HS6cnv4VzbAdLc8kZUxY/zyTcNGJUJWBna/nwkHkGEcv4VDGIgm8/Gz4N5+pq/dMba2D sn6mNeDqoP3lU6dzw/mlPg5HM6L47UK/Ky90kadvlO07BARes7F8ChAu135SQfpKG4pt uhAF8BL5Anz2l2C6E4GZinpbjsueaO2kOBK2Zd/+etXxdlMOH/Yk793QKlWVuBWToj4Z m1Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775678540; x=1776283340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OqKdylESk9B/a6b5Oi5X2s5Hl7NPYjGcR39u69Tcphw=; b=r9cRCjhb9J+NX/p9S5sLwCSaLypHtTc3a6X0li1FfQqERceoyc598V7XLimWUfZkyr Fyw1QNBSDQCjna8wPiicwI+isSmLPpF5f1NAOavFvz9y00OC3chbonuysqjbpLt8+GlU BJy5wQQvQ1nD7rahlgfwWaq1Sh9rIF34J1WbpbVctBm/1jPrN0SM3rMn52nw7/5dmCCy AdM2kGEpWz5Vyq3cQY83kekJuxqSlMnxZBTMkFU+q+bs9qbnDmf0YdQ1J6ZHNLHonvEv CS8dOO5vU4UZ1D2A56VJ/Q7xyMCmTzA4PzFRTzemEzQmVAQwh2/wr70u0itk7PY3VnZb jgGw== X-Gm-Message-State: AOJu0Yx26goZoaN9OOX8mTY8GzBKfa1Gay/dTl2a4gOxChiwNlyfjwIh QM51S99qzwp465BrMi7mJkIQt0owhZ9h9WmRpiG4a9sn9XZjXrJc3DD13e22yA== X-Gm-Gg: AeBDieu2oBlbA1pKze1a1O54AtGTbhKdgHvoRgkz6g1ot/PHQ5eQucflgq3FITckX8X 4uhVa7ktN/daB/JzP7FC2qrsFoyxTysGejY+fpMii+9q6qn5VDHkofXU36srhr8W8DiAVwUKaA1 rWoYNkWQaoSZysPXzPjN42b2FwcKVOZip1cAZOKYAtxZalrT5wd8YLvAeFcWzaMbTRCAMGxpMBI DnVGpsUkmoFBhb7M70z42maFBXqvR/6CG5DkzYaN6UzoLbmv6fw1sZ2EPDfwKp21QlgyrnG8opr wD5MISbmjtMQpwuhZ5AxPcWPGsIaMDFiVIQaO1qa9ZXNeg+6mOQDocFdZrF0kmkHsOpt7iVI768 m+/troZq3o4xt5kMqwchU9mu1mH0DEL2MUOHiWiHEAiGZ+eIf8Kax8n6AoNJ2Fkj7sHdcvWyXCi 73FHrqzgEQDwHY1xlvT7yFmfa1NAqoAF+WSw6+Hg1I1EdsbKyxhO2OnN4Dcst4h85wi+ryRu5Fy QA= X-Received: by 2002:a05:6820:4c07:b0:67c:c44:1e8f with SMTP id 006d021491bc7-6821db69541mr12588668eaf.17.1775678540015; Wed, 08 Apr 2026 13:02:20 -0700 (PDT) Received: from frodo.raven-morpho.ts.net (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 006d021491bc7-680a63c7fd1sm12254208eaf.8.2026.04.08.13.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 13:02:19 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, jbaron@akamai.com, louis.chauvet@bootlin.com, Jim Cromie Subject: [PATCH v13 03/36] dyndbg.lds.S: fix lost dyndbg sections in modules Date: Wed, 8 Apr 2026 14:01:38 -0600 Message-ID: <20260408200211.43821-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408200211.43821-1-jim.cromie@gmail.com> References: <20260408200211.43821-1-jim.cromie@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In an (unused) experimental variation of this series, I had trouble with __dyndbg* sections getting lost in drm drivers. While it didn't happen in this series, it exposed a non-obvious weakness. So fix it, by following the model demonstrated in codetag.lds.h. Introduce include/asm-generic/dyndbg.lds.h, with 2 macros: DYNDBG_SECTIONS moves the 2 BOUNDED_SECTION_BY calls from DATA_DATA in vmlinux.lds.h, which now includes the file and calls the new macro. MOD_DYNDBG_SECTIONS also has the 2 BOUNDED_SECTION_BY calls, but wraps them with output section syntax to keep them as known and separate ELF sections in the module.ko. dyndbg.lds.h includes (reuses) bounded-section.lds.h scripts/module.lds.S: now calls MOD_DYNDBG_SECTIONS right before the CODETAG macro (consistent with their placements in vmlinux.lds.h), and also includes dyndbg.lds.h This isolates vmlinux.lds.h from further __dyndbg section additions. Signed-off-by: Jim Cromie --- include/asm-generic/dyndbg.lds.h | 19 +++++++++++++++++++ include/asm-generic/vmlinux.lds.h | 6 ++---- scripts/module.lds.S | 2 ++ 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 include/asm-generic/dyndbg.lds.h diff --git a/include/asm-generic/dyndbg.lds.h b/include/asm-generic/dyndbg.lds.h new file mode 100644 index 000000000000..f95683aa16b6 --- /dev/null +++ b/include/asm-generic/dyndbg.lds.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_GENERIC_DYNDBG_LDS_H +#define __ASM_GENERIC_DYNDBG_LDS_H + +#include +#define DYNDBG_SECTIONS() \ + . = ALIGN(8); \ + BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) + +#define MOD_DYNDBG_SECTIONS() \ + __dyndbg : { \ + BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + } \ + __dyndbg_classes : { \ + BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ + } + +#endif /* __ASM_GENERIC_DYNDBG_LDS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 462f124ad457..b59f343818b0 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -340,6 +340,7 @@ /* * .data section */ +#include #define DATA_DATA \ *(.xiptext) \ *(DATA_MAIN) \ @@ -353,10 +354,7 @@ *(.data..do_once) \ STRUCT_ALIGN(); \ *(__tracepoints) \ - /* implement dynamic printk debug */ \ - . = ALIGN(8); \ - BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ - BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + DYNDBG_SECTIONS() \ CODETAG_SECTIONS() \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 054ef99e8288..8a7b0741bf8d 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -10,6 +10,7 @@ #endif #include +#include SECTIONS { /DISCARD/ : { @@ -60,6 +61,7 @@ SECTIONS { *(.rodata..L*) } + MOD_DYNDBG_SECTIONS() MOD_SEPARATE_CODETAG_SECTIONS() } -- 2.53.0