From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa2-f13.google.com (mail-oa2-f13.google.com [74.125.231.77]) (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 0B984481FAE for ; Wed, 23 Sep 2026 22:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.77 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790202890; cv=none; b=niVqxW56066hZffYRljpDU0LvdS9Qh+1InHpf4BbtOv5RzYBR8T+zwlTS9B+01pLOgJIeJeC3s7vceuA/9RyVUyVqh7bDBRXaMNXS5QvJ+cOFxS8HnHTqsloElnYMh+/NvgI9VKuv3cCaJUAiAKpYAQ5s/+lj9F0c8PVWdDrFyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790202890; c=relaxed/simple; bh=KafV4Ai050cNwyxUNFExAF+ZpbeZ3M0y4ugVhMxmCII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DlbNtK6g7OtB6Eu3A3Zz5o1V2EnOvkWUzD3eotSovGfIUHWdZA3to2m8QrzmG+Pq4iQsfudin0PPDzuaAY2wD8CFuBDljuLBHyAs6Se+OBBzgtGMpAjsenOoi7tzQnwB0GdAWsdxveYoGcrO+2g2eIDUYiJtaoswrPkOoLXd3fM= 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=mj3ymEOs; arc=none smtp.client-ip=74.125.231.77 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="mj3ymEOs" Received: by mail-oa2-f13.google.com with SMTP id 586e51a60fabf-46dae65dc5cso744194fac.1 for ; Wed, 23 Sep 2026 15:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790202886; x=1790807686; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=X1uGbOIzIyWw0k5unFoP8BUkOpwCAhzQ9m2N8luGZ8E=; b=mj3ymEOs7RsfSWOeNfMmFBSk3DLRSLGKpqtctn/i+EK1qFFVk51j7VOGoRNzgBbWp8 la2QakfoLD5iL2LR3YeGN/N6bwMKqhpTZ5T2M5gybvTDQ7yLZLvIISA91ZVk4aKbC2cr 8QoEnAZBgdeiksHNFxFDiA1s4i9dg6XYgnMSFe+5onwqz5akUt9nnbin0QF+cX4m455n rOOsTXYeZbvnhtUVunMKhqn+ZPyeXCo6q0KuWmRx+ME/WSatxx0w5S7LjDMLgs8n/TEA Y2KQwlSR+vT09wITQIwdRcX9YwfEM+eIhkYhZ7w4HeRJTrzSQxXq2XLxRLYgWRfptukz +Xag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790202886; x=1790807686; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=X1uGbOIzIyWw0k5unFoP8BUkOpwCAhzQ9m2N8luGZ8E=; b=FjutFQBH0sr1GzJszBusCzMdnQ0M+MSInGeWs/0Hf3Hsx7OjDp7/4uet2tW8L83mR5 M0hkNohtcS+mCMWv+SKys1iCSW2CI7f3HK/ORgkOpwkuHHYs+SL0ti8gW36piP+VXiF+ GPmSMiQfDyz5+QAHCK1yyhenUKOmgRaPgo7iGEE0LpJfG9m4kCWmcGrdZ1Ir6qxQrNVb XRuLEcWsfHJbISjCaDayq6x+LuJsmHCmJYKbrYZL1iJ27Jx85rkOgKdfldbYAQMe2dqd uhyST6dL8JZMMvKENeSZtu/crvCKv2IAdWxrinXfIZEDKj8ajwGPvfLfIT3vphyhaPJK zYkw== X-Gm-Message-State: AFuF++mVYsxu/NMmWGzt47tBg7SmtkMofHJupZ8VFpO5CKCAOVfjmaUK MgpSgmA2oCfdtSoOcbD+1OQ7zuTnO0CLhu36aYaqWrIclcMX2796FHuk X-Gm-Gg: AYBFou2jRKHmc7T4RZ3I9WefEFzimNU1AYO+onjE0baC0LVBvTlr0hJPNq20KyNryXS Fb5HOIBz4Q9uRwPLpi6/Js+XrGaiVmzxUCsKj2HDn6LnGoSfDQNPVwdEo2AJAGvqFzcw0MNiVRZ 7Ub25uxxIblk2hHRVJ33IOEegV57riiAyQ3DQ0qc6pGvHeS62qtZArYL+wbgJQee5tknCutKSBu iwuzID2LLDuYXCFnBmdY7Ui4I/Hr12c44VR6d7TIfxvOmbvZEQ6p6qAnQku/cYEx1qRzkdd9SUJ kJ2P4Z0DjFvvfUOP5EEtNvft0A02M5jIA+DtQ4dcdVxkpr49+YTnSHljfY2GQ25EMhiCgdzDCZY 70f5ymtWkT8Ax5mKLVloSS9WJTqdkFYlPmiMZupr/VhkiECEPcyBHHl4SudO6o7PZtVER9OF3rV xyB/C+pqEU5+4T1IGoIRbaLyGNXAmCU9OIJdDy+RAow3uXNVLq+X/YX1bgSe5Lm1d3nLOFxmT6f MPe2TX4SM5AgMmPQ+1OZm2Je6mimYF8e4wv/QJw9A0Vir4S35KFBYxU2rTmB4PbevobMja14EBb hMhsjvG0yC3BvzDHYzc= X-Received: by 2002:a05:6808:4f6c:b0:4c4:d8a0:2773 with SMTP id 5614622812f47-4d72df6d951mr659351b6e.32.1790202886518; Wed, 23 Sep 2026 15:34:46 -0700 (PDT) Received: from [100.82.231.29] (c-98-38-17-99.hsd1.co.comcast.net. [98.38.17.99]) by smtp.googlemail.com with ESMTPSA id 586e51a60fabf-491ee1ac486sm559401fac.16.2026.09.23.15.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 15:34:45 -0700 (PDT) From: Jim Cromie Date: Wed, 23 Sep 2026 16:34:28 -0600 Subject: [PATCH v11 04/38] vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260923-dd-cmap-part2-clean-v11-4-9b6c217fdf2f@gmail.com> References: <20260923-dd-cmap-part2-clean-v11-0-9b6c217fdf2f@gmail.com> In-Reply-To: <20260923-dd-cmap-part2-clean-v11-0-9b6c217fdf2f@gmail.com> To: Jason Baron , Shuah Khan , Andrew Morton , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Arnd Bergmann , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Jonathan Corbet , Greg Kroah-Hartman , Nathan Chancellor , Nicolas Schier , Shuah Khan , Randy Dunlap , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Jonathan Corbet , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-pm@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1790202874; l=6221; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=KafV4Ai050cNwyxUNFExAF+ZpbeZ3M0y4ugVhMxmCII=; b=max867D2x5WnedlXC8Xh7KRH7w+xDMU16hhtAfusSKWn2//sTylUayWziSo5V8k/X2EU7YocO X4wQg6/urptCHhEJgHfL+RVoCPVPNK6nj+dAfldy7sGiLNwU+hIZvQ2 X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Almost all uses of the BOUNDED_SECTION macros are ALIGN(8), either explicitly, or by being below an aligned section containing x*8 byte objects. The noteworthy exception is BOUNDED_SECTION(__dyndbg), which immediately follows BOUNDED_SECTION(__dyndbg_classes). On i386, struct _ddebug_classmap is 28 bytes, so without an explicit ALIGN(8) in the macro, the following __dyndbg section gets misaligned, causing a NULL ptr deref in dynamic_debug_init(). So fix this with an explicit ALIGN(8) in the existing BOUNDED_SECTION macros, and introduce _ALIGNED variants to handle the cases with an explicit . = ALIGN(x) Also add explicit alignments for: EXCEPTION_TABLE, ORC_UNWIND_TABLE, TRACEDATA, INIT_SETUP, and NOTES. update BOUNDED_SECTION uses inside . = ALIGN(x) stanzas to use _ALIGNED variants, but keep the outer ALIGNs so the symbols between them are not "re-aligned". In particular, scripts/sorttable.c does not tolerate sloppy padding. At the top of ORC_UNWIND_TABLE, add . = ALIGN(4) to match the struct orc_header __align() call in the code: commit b9f174c811e3 ("x86/unwind/orc: Add ELF section with ORC version identifier") Suggested-by: Louis Chauvet # _ALIGNED variants. Link: https://lore.kernel.org/lkml/177402491426.6181.12855763650074831089.b4-review@b4/ Signed-off-by: Jim Cromie --- v3: sashiko complained about NOTES and .BTF_ids. gemini asserts that NOTES are natively 4-byte aligned, add comment repeating it. .BTF_ids doesnt use BOUNDED_BY, since start/end isnt needed; sashiko evidently got confused by immediately preceding usage. v2: sashiko picked up 2 cases, added to the explicit list above https://sashiko.dev/#/patchset/20260515-asm-generic-1-v3-0-680b273666d4%40gmail.com --- include/asm-generic/bounded_sections.lds.h | 17 ++++++++++++++--- include/asm-generic/vmlinux.lds.h | 18 ++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/asm-generic/bounded_sections.lds.h b/include/asm-generic/bounded_sections.lds.h index 268cdc34389b..8ff3e3420f60 100644 --- a/include/asm-generic/bounded_sections.lds.h +++ b/include/asm-generic/bounded_sections.lds.h @@ -3,19 +3,30 @@ #ifndef _ASM_GENERIC_BOUNDED_SECTIONS_H #define _ASM_GENERIC_BOUNDED_SECTIONS_H -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ +#define BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, _ALIGNED_) \ + . = ALIGN(_ALIGNED_); \ _BEGIN_##_label_ = .; \ KEEP(*(_sec_)) \ _END_##_label_ = .; -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, 8) + +#define BOUNDED_SECTION_POST_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, _ALIGNED_) \ + . = ALIGN(_ALIGNED_); \ _label_##_BEGIN_ = .; \ KEEP(*(_sec_)) \ _label_##_END_ = .; +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + BOUNDED_SECTION_POST_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, 8) + #define BOUNDED_SECTION_BY(_sec_, _label_) \ BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) -#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) +#define BOUNDED_SECTION_BY_ALIGNED(_sec_, _label_, _ALIGNED_) \ + BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, __start, __stop, _ALIGNED_) + +#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) #endif /* _ASM_GENERIC_BOUNDED_SECTIONS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 019072d3d391..b77a1bec38fc 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -640,7 +640,7 @@ #define EXCEPTION_TABLE(align) \ . = ALIGN(align); \ __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(__ex_table, ___ex_table) \ + BOUNDED_SECTION_BY_ALIGNED(__ex_table, ___ex_table, align) \ } /* @@ -650,7 +650,7 @@ #define BTF \ . = ALIGN(PAGE_SIZE); \ .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.BTF, _BTF) \ + BOUNDED_SECTION_BY_ALIGNED(.BTF, _BTF, PAGE_SIZE) \ } \ . = ALIGN(PAGE_SIZE); \ .BTF_ids : AT(ADDR(.BTF_ids) - LOAD_OFFSET) { \ @@ -842,16 +842,17 @@ #ifdef CONFIG_UNWINDER_ORC #define ORC_UNWIND_TABLE \ + . = ALIGN(4); \ .orc_header : AT(ADDR(.orc_header) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_header, _orc_header) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_header, _orc_header, 4) \ } \ . = ALIGN(4); \ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_unwind_ip, _orc_unwind_ip) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_unwind_ip, _orc_unwind_ip, 4)\ } \ . = ALIGN(2); \ .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.orc_unwind, _orc_unwind) \ + BOUNDED_SECTION_BY_ALIGNED(.orc_unwind, _orc_unwind, 2) \ } \ text_size = _etext - _stext; \ . = ALIGN(4); \ @@ -879,7 +880,7 @@ #define TRACEDATA \ . = ALIGN(4); \ .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ - BOUNDED_SECTION_POST_LABEL(.tracedata, __tracedata, _start, _end) \ + BOUNDED_SECTION_POST_LABEL_ALIGNED(.tracedata, __tracedata, _start, _end, 4) \ } #else #define TRACEDATA @@ -908,13 +909,14 @@ *(.note.gnu.property) \ } \ .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ - BOUNDED_SECTION_BY(.note.*, _notes) \ + /* *(.note.*) are natively 4-byte aligned */ \ + BOUNDED_SECTION_BY_ALIGNED(.note.*, _notes, 4) \ } NOTES_HEADERS \ NOTES_HEADERS_RESTORE #define INIT_SETUP(initsetup_align) \ . = ALIGN(initsetup_align); \ - BOUNDED_SECTION_POST_LABEL(.init.setup, __setup, _start, _end) + BOUNDED_SECTION_POST_LABEL_ALIGNED(.init.setup, __setup, _start, _end, initsetup_align) #define INIT_CALLS_LEVEL(level) \ __initcall##level##_start = .; \ -- 2.55.0