All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] seq_buf: always inline seq_buf_terminate()
@ 2026-11-15 15:34 Sasha Levin
  2026-11-16  0:51 ` kernel test robot
  2026-11-16  1:57 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2026-11-15 15:34 UTC (permalink / raw)
  To: Kees Cook
  Cc: Steven Rostedt, Nathan Chancellor, Andy Shevchenko, Petr Mladek,
	linux-hardening, llvm, oe-kbuild-all, linux-kernel

Commit 7b8cd26b6aab8 ("seq_buf: Mark a seq_buf overflowed when terminating it
loses a byte") made __seq_buf_terminate() bigger, and clang no longer inlines
seq_buf_terminate() into its two callers in kernel/trace/trace_events.c. Both
pass bootup_event_seq, which is __initdata, so the out-of-line copy sits in
.text with that address in it and modpost warns:

  WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_terminate+0x12 (section: .text) -> bootup_event_seq (section: .init.data)

Both callers are __init, so nothing uses the buffer after it is freed.  But the
warning shows up in allmodconfig builds, and it is an error with
CONFIG_SECTION_MISMATCH_WARN_ONLY=n.

Mark seq_buf_terminate() and __seq_buf_terminate() __always_inline.  Marking
only seq_buf_terminate() is not enough, as the same thing then happens to
__seq_buf_terminate().

Fixes: 7b8cd26b6aab8 ("seq_buf: Mark a seq_buf overflowed when terminating it loses a byte")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202611110802.zPIiPSnJ-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202611120138.Fwm5Ljmj-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202611122226.vTBpAmtr-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202611122323.IvGv8FYK-lkp@intel.com/
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
7b8cd26b6aab8 is on both for-next/kspp and for-linus/hardening.

 include/linux/seq_buf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
index 6b915c67d2358..f72dd258206fb 100644
--- a/include/linux/seq_buf.h
+++ b/include/linux/seq_buf.h
@@ -134,7 +134,7 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
  *
  * Returns: the offset of the NUL.
  */
-static inline size_t __seq_buf_terminate(struct seq_buf *s)
+static __always_inline size_t __seq_buf_terminate(struct seq_buf *s)
 {
 	size_t end;
 
@@ -240,7 +240,7 @@ static inline size_t seq_buf_strlen(struct seq_buf *s)
  * After this function is called, s->buffer is safe to use
  * in string operations.
  */
-static inline void seq_buf_terminate(struct seq_buf *s)
+static __always_inline void seq_buf_terminate(struct seq_buf *s)
 {
 	if (s->size == 0)
 		return;

base-commit: 7b8cd26b6aab8cf147165610d13964f79200a5a7
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] seq_buf: always inline seq_buf_terminate()
@ 2026-11-16 21:02 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-11-16 21:02 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "too many reports for this commit"
:::::: 

BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20261115153430.1607764-1-sashal@kernel.org>
References: <20261115153430.1607764-1-sashal@kernel.org>
TO: Sasha Levin <sashal@kernel.org>
TO: Kees Cook <kees@kernel.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Nathan Chancellor <nathan@kernel.org>
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
CC: Petr Mladek <pmladek@suse.com>
CC: linux-hardening@vger.kernel.org
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org

Hi Sasha,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 7b8cd26b6aab8cf147165610d13964f79200a5a7]

url:    https://github.com/intel-lab-lkp/linux/commits/Sasha-Levin/seq_buf-always-inline-seq_buf_terminate/20261115-103429
base:   7b8cd26b6aab8cf147165610d13964f79200a5a7
patch link:    https://lore.kernel.org/r/20261115153430.1607764-1-sashal%40kernel.org
patch subject: [PATCH] seq_buf: always inline seq_buf_terminate()
:::::: branch date: 29 hours ago
:::::: commit date: 29 hours ago
config: x86_64-randconfig-1015-20261116 (https://download.01.org/0day-ci/archive/20261117/202611170443.Mk0PC85z-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/202611170443.Mk0PC85z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202611170443.Mk0PC85z-lkp@intel.com/

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_set_overflow+0x3 (section: .text.seq_buf_set_overflow) -> bootup_event_seq (section: .init.data)
WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_set_overflow+0xa (section: .text.seq_buf_set_overflow) -> bootup_event_seq (section: .init.data)
WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_set_overflow+0x16 (section: .text.seq_buf_set_overflow) -> bootup_event_seq (section: .init.data)
WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_set_overflow+0x24 (section: .text.seq_buf_set_overflow) -> bootup_event_seq (section: .init.data)
WARNING: modpost: vmlinux: section mismatch in reference: seq_buf_set_overflow+0x2e (section: .text.seq_buf_set_overflow) -> bootup_event_seq (section: .init.data)

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-16 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 15:34 [PATCH] seq_buf: always inline seq_buf_terminate() Sasha Levin
2026-11-16  0:51 ` kernel test robot
2026-11-16  1:57 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-11-16 21:02 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.