diff options
| author | Alexandre Courbot <acourbot@nvidia.com> | 2026-05-27 20:52:17 +0900 |
|---|---|---|
| committer | Nathan Chancellor <nathan@kernel.org> | 2026-05-28 09:57:13 -0700 |
| commit | d7231d8cb262b1e350c00271bf53d54414b4f3b1 (patch) | |
| tree | d57fc42056ee6365862f0dcbcbbded1445da4c22 /scripts/Makefile.vmlinux | |
| parent | 159921d63da16ff1d4764e73ddf9e1556b54dfc8 (diff) | |
scripts: modpost: detect and report truncated buf_printf() output
buf_printf() uses a fixed-size stack buffer. vsnprintf() returns the
number of bytes that *would* have been written to that buffer, which can
be larger than the size of said buffer if the formatted string is too
long.
The problem is that whenever this happens buf_printf() currently passes
this length, unchecked, to buf_write(), which silently reads past the
stack buffer and copies invalid data into the output buffer.
Fix this by detecting vsnprintf() failures and truncations before
appending to the output buffer, and report a fatal error instead of
producing corrupt symbol names.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20260527-nova-exports-v2-1-06de4c556d55@nvidia.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/Makefile.vmlinux')
0 files changed, 0 insertions, 0 deletions
