[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1751747518.git.alx@kernel.org>
Date: Sat, 5 Jul 2025 22:33:47 +0200
From: Alejandro Colomar <alx@...nel.org>
To: linux-mm@...ck.org, linux-hardening@...r.kernel.org,
Kees Cook <kees@...nel.org>
Cc: Alejandro Colomar <alx@...nel.org>,
Christopher Bazley <chris.bazley.wg14@...il.com>, shadow <~hallyn/shadow@...ts.sr.ht>,
linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev@...glegroups.com, Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>, Marco Elver <elver@...gle.com>, Christoph Lameter <cl@...ux.com>,
David Rientjes <rientjes@...gle.com>, Vlastimil Babka <vbabka@...e.cz>,
Roman Gushchin <roman.gushchin@...ux.dev>, Harry Yoo <harry.yoo@...cle.com>
Subject: [RFC v1 0/3] Add and use seprintf() instead of less ergonomic APIs
Hi Kees,
As I anticipated in private, here's an API that we're using in the
shadow project. I've added it in the kernel, and started replacing some
existing calls to s*printf() calls, and it was a bug mine.
I haven't even built the code yet. I present it for discussion only at
the moment. (Thus, RFC, not PATCH.) Also, I've used ==NULL style for
null checks, to be more explicit, even if that's against the coding
style. I'll change that for the actual patches, but for now during
discussion, I prefer having the explicit tests for my own readability.
The improvement seems quite obvious. Please let me know your opinion.
I also have a few questions for the maintainers of the specific code, or
at least for someone who deeply understands it, as I found some
questionable code. (See the individual commit messages, and code
comments for those.)
On top of that, I have a question about the functions I'm adding,
and the existing kernel snprintf(3): The standard snprintf(3)
can fail (return -1), but the kernel one doesn't seem to return <0 ever.
Should I assume that snprintf(3) doesn't fail here? (I have a comment
in the source code of the implementation asking for that.)
What do you think?
Alejandro Colomar (3):
vsprintf: Add [v]seprintf(), [v]stprintf()
stacktrace, stackdepot: Add seprintf()-like variants of functions
mm: Use seprintf() instead of less ergonomic APIs
include/linux/stackdepot.h | 13 +++++
include/linux/stacktrace.h | 3 +
kernel/stacktrace.c | 28 ++++++++++
lib/stackdepot.c | 12 ++++
lib/vsprintf.c | 109 +++++++++++++++++++++++++++++++++++++
mm/kfence/kfence_test.c | 24 ++++----
mm/kmsan/kmsan_test.c | 4 +-
mm/mempolicy.c | 18 +++---
mm/page_owner.c | 32 ++++++-----
mm/slub.c | 5 +-
10 files changed, 208 insertions(+), 40 deletions(-)
Range-diff against v0:
-: ------------ > 1: 2d20eaf1752e vsprintf: Add [v]seprintf(), [v]stprintf()
-: ------------ > 2: ec2e375c2d1e stacktrace, stackdepot: Add seprintf()-like variants of functions
-: ------------ > 3: be193e1856aa mm: Use seprintf() instead of less ergonomic APIs
--
2.50.0
Powered by blists - more mailing lists