From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.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 58178426ED0 for ; Fri, 15 May 2026 08:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778835512; cv=none; b=X6Bs0dqVwk7n1uZnejekR7uqOryBYnOTTaMKrZBrDePyOPjWjZktzydvhEwm+mDnKzEGtTZRHMF0rdOqt8Yjmgu9y0iG3bZ5sAj+xJEUINpfV5m6mXGSXeJTSA7pFDjiAzn6BqlDXORkEnLlx1Cg5cDqG/h6jJ674adfAUfq5rY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778835512; c=relaxed/simple; bh=5GFT8c6pS8ZPOp8E9e2DvTwZwRrYlvW21YT8WQ/gfj0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UoiJEqwJjng++6EChhqAaqCiuZ9Ih3t1dA5lpdi66H7JUwL+kULR/rnG5RWZ+htngu6xFQcMM49xRak4x79KQF1dmO5QY0MDtLL7jjY1HSJGZAE5sawp77Z/JmmPfK/uCW/RmHXiZ4RQYlzuwyeutr50OkGZOgB/13tDH4GeFcE= 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=JX4McymA; arc=none smtp.client-ip=209.85.221.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="JX4McymA" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-44b330c5cc6so6459912f8f.1 for ; Fri, 15 May 2026 01:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778835509; x=1779440309; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vyDbCKNB7s28klaeaxcFwFyz+m8AFVwNSzp9KnR1vME=; b=JX4McymAgn46VrLR682iCMPePkKsDXIhHXKP8qBlR01LYyRTGREKSoyFhkt8BlF5UR SZA1Mqe3YD++M3XT8/GSbG/Ca0Fy0AHnmRKTDPNOX8oF1F0F4mq1WYe7TEBEd0ZFVxCG lMcb9vVMGX7e1vW4EhM69svEhl/wAD2PkMuO6+N8pXOOix5o4TJ0GqP4Afs0oTRtQEqS ZfmhLIE4M0Nz3CrxgGNRe9hynrfN1YIOQM1Uki2CHF6mtBRdYmZIrV0gPkmirOF4FLFJ cbmVF7nxresGc+7YVjeeAcDmgsH++dGg6AOlmSXQAY5e11f2NFH6YP1LICCrz6rA3wAZ AyLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778835509; x=1779440309; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vyDbCKNB7s28klaeaxcFwFyz+m8AFVwNSzp9KnR1vME=; b=c86nPS44cMLVAPdUdVlp1JamZWvY2UjWASGdepR+LwUzt7J7ZV4MywtEO3GOsJkg8C 25cwzMonJf3of/2NXfaCHdcPpA4LRxx7P5dpbddA8P+kgtSrwuhOHyyCLo1fUOmN0J14 aoMJtht8iHoDVGcfoQuBur+E53UBUipjzOCVV2Hi+T0lhY0CfC4wI4P5ZCESIMaAE87h 5zRxFXeoawnSISwGc+WWLvtLmeGPheEn/k1rw9x9HRjXxafvU9HIWw3s8jqj0aQcmPWL fo5Idi7NOyesrxEOcLRIPiPGuLhujnrpkyVM5ys/xi/3Cdxka9fSUEXJDh/CBHbswv0e 9s8A== X-Forwarded-Encrypted: i=1; AFNElJ/r+mqoCTdpHcoSswYsrtsLv2wol1hnBwPiVHoiQKPISI0hhk3yh33ayzYulmmiUnSveV0UI2FUbJU8zFs=@vger.kernel.org X-Gm-Message-State: AOJu0YzFNKcWv5R+N9reGupLImKv5Wnl2mrTA5BMa8WSx4oJwKzyrlH3 X5qUZCLOuUlA6CqejFO1zAEUTO8FYLyNuQvH7uP1HJLjpOMsR5rsRiIbXy0SfXMNm2M= X-Gm-Gg: Acq92OEyGtxYzSMLJTbnPZ48lKQ5x06umBql77bJV4rdObLhY4nyWqDztAPPCEYQ2vt idiLsl7TE9ZS+QtGhyvZoChY25X2m03kYExLBmIUcSYwGQYa3/dZUx0ByuZyaTHmj22RWPhT9DG gh5PBYaP57sdTpIRklYOvt+yFpT9ebzJhCGLradqQLq1MGw3yB6K+6M5JrVRtJXl6ygCaN3YPnn NNRW5vt7Mtto1Ze8iJXqAnmZwvARWkFBXghF5ha5/UFV7Q2zzMYO6REu2aJ6OdPpIquy7n5+O9g 04H2d7ZJZkSj/IaNBuQLbnLijtXx5YHUzKL//U9M8fvZ2QhD3CZ7QwJxn8PO/7DggZszNmhUB+y tZa0E/eI2CO3u1YoWS8rdItT+bsE/dWR37X6V+0CiJoa71/9V284w6AMcM60BzdaT0Vw8lxdRse jAnRBCb94hOpavEEE45b9fFKTSUuW+Z/53OQ32K4Ilgm8= X-Received: by 2002:a05:6000:1acc:b0:43f:e721:76b8 with SMTP id ffacd0b85a97d-45e5c60a375mr3885216f8f.37.1778835508407; Fri, 15 May 2026 01:58:28 -0700 (PDT) Received: from [192.168.1.210] ([2a00:23c8:33b9:3b01:f7b1:b7a0:6254:c325]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-45d9e768c4fsm13142610f8f.8.2026.05.15.01.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 01:58:27 -0700 (PDT) From: Jim Cromie Date: Fri, 15 May 2026 02:58:12 -0600 Subject: [PATCH v3 3/5] 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: <20260515-asm-generic-1-v3-3-680b273666d4@gmail.com> References: <20260515-asm-generic-1-v3-0-680b273666d4@gmail.com> In-Reply-To: <20260515-asm-generic-1-v3-0-680b273666d4@gmail.com> To: Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, Jim Cromie , Louis Chauvet X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778835503; l=4451; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=5GFT8c6pS8ZPOp8E9e2DvTwZwRrYlvW21YT8WQ/gfj0=; b=5d2E+jRpUIih+m4j+0pG1oniOu01tH5wE30jvuG/P0BgKGNvfuzlCkDhurcRsCPf8NxMTHEkf xRbMptwL/L/CF5XKctmw6hO7cxCWz0Uid/aVRzu0knLxqy1DCIjhhft 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) Explicit alignments: EXCEPTION_TABLE, ORC_UNWIND_TABLE update BOUNDED_SECTION uses inside . = ALIGN(x) 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 --- include/asm-generic/bounded_sections.lds.h | 17 ++++++++++++++--- include/asm-generic/vmlinux.lds.h | 9 +++++---- 2 files changed, 19 insertions(+), 7 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 9c61dd083f26..6892cbec0554 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) \ } /* @@ -832,16 +832,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); \ -- 2.54.0