From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, ndesaulniers@google.com,
nathan@kernel.org, keescook@chromium.org, elver@google.com,
dvyukov@google.com, andy@kernel.org, glider@google.com,
akpm@linux-foundation.org
Subject: [merged] string-use-__builtin_memcpy-in-strlcpy-strlcat.patch removed from -mm tree
Date: Wed, 31 May 2023 21:12:48 -0700 [thread overview]
Message-ID: <20230601041249.45562C433EF@smtp.kernel.org> (raw)
The quilt patch titled
Subject: string: use __builtin_memcpy() in strlcpy/strlcat
has been removed from the -mm tree. Its filename was
string-use-__builtin_memcpy-in-strlcpy-strlcat.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Alexander Potapenko <glider@google.com>
Subject: string: use __builtin_memcpy() in strlcpy/strlcat
Date: Tue, 30 May 2023 10:39:11 +0200
lib/string.c is built with -ffreestanding, which prevents the compiler
from replacing certain functions with calls to their library versions.
On the other hand, this also prevents Clang and GCC from instrumenting
calls to memcpy() when building with KASAN, KCSAN or KMSAN:
- KASAN normally replaces memcpy() with __asan_memcpy() with the
additional cc-param,asan-kernel-mem-intrinsic-prefix=1;
- KCSAN and KMSAN replace memcpy() with __tsan_memcpy() and
__msan_memcpy() by default.
To let the tools catch memory accesses from strlcpy/strlcat, replace the
calls to memcpy() with __builtin_memcpy(), which KASAN, KCSAN and KMSAN
are able to replace even in -ffreestanding mode.
This preserves the behavior in normal builds (__builtin_memcpy() ends up
being replaced with memcpy()), and does not introduce new instrumentation
in unwanted places, as strlcpy/strlcat are already instrumented.
Link: https://lkml.kernel.org/r/20230530083911.1104336-1-glider@google.com
Link: https://lore.kernel.org/all/20230224085942.1791837-1-elver@google.com/
Signed-off-by: Alexander Potapenko <glider@google.com>
Suggested-by: Marco Elver <elver@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/string.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/lib/string.c~string-use-__builtin_memcpy-in-strlcpy-strlcat
+++ a/lib/string.c
@@ -110,7 +110,7 @@ size_t strlcpy(char *dest, const char *s
if (size) {
size_t len = (ret >= size) ? size - 1 : ret;
- memcpy(dest, src, len);
+ __builtin_memcpy(dest, src, len);
dest[len] = '\0';
}
return ret;
@@ -260,7 +260,7 @@ size_t strlcat(char *dest, const char *s
count -= dsize;
if (len >= count)
len = count-1;
- memcpy(dest, src, len);
+ __builtin_memcpy(dest, src, len);
dest[len] = 0;
return res;
}
_
Patches currently in -mm which might be from glider@google.com are
reply other threads:[~2023-06-01 4:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230601041249.45562C433EF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=andy@kernel.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.