lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <YxGEwdc69waEXhnV@debian.me>
Date: Fri, 2 Sep 2022 11:21:21 +0700
From: Bagas Sanjaya <bagasdotme@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Guenter Roeck <linux@...ck-us.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>,
Len Baker <len.baker@....com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Francis Laniel <laniel_francis@...vacyrequired.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2] string: Introduce strtomem() and strtomem_pad()
On Thu, Sep 01, 2022 at 12:09:52PM -0700, Kees Cook wrote:
> + * Do not use this function. While FORTIFY_SOURCE tries to avoid
> + * over-reads of @q, it cannot defend against writing unterminated
> + * results to @p. Using strncpy() remains ambiguous and fragile.
> + * Instead, please choose an alternative, so that the expectation
> + * of @p's contents is unambiguous:
> + *
> + * @p needs to be: | padded to @size | not padded
> + * --------------------+-----------------+------------+
> + * NUL-terminated | strscpy_pad() | strscpy() |
> + * --------------------+-----------------+------------+
> + * not NUL-terminated | strtomem_pad() | strtomem() |
> + * --------------------+-----------------+------------+
> + *
My htmldocs build doesn't catch any new warnings, but I think the table
above can be fixed up:
---- >8 ----
diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
index eed2119b23c523..3413a8e561fc62 100644
--- a/include/linux/fortify-string.h
+++ b/include/linux/fortify-string.h
@@ -95,12 +95,13 @@ extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size)
* Instead, please choose an alternative, so that the expectation
* of @p's contents is unambiguous:
*
- * @p needs to be: | padded to @size | not padded
- * --------------------+-----------------+------------+
- * NUL-terminated | strscpy_pad() | strscpy() |
- * --------------------+-----------------+------------+
- * not NUL-terminated | strtomem_pad() | strtomem() |
- * --------------------+-----------------+------------+
+ * +--------------------+-----------------+------------+
+ * |@p needs to be: | padded to @size | not padded |
+ * +====================+=================+============+
+ * | NUL-terminated | strscpy_pad() | strscpy() |
+ * +--------------------+-----------------+------------+
+ * | not NUL-terminated | strtomem_pad() | strtomem() |
+ * +--------------------+-----------------+------------+
*
* Note strscpy*()'s differing return values for detecting truncation,
* and strtomem*()'s expectation that the destination is marked with
> + * Note strscpy*()'s differing return values for detecting truncation,
> + * and strtomem*()'s expectation that the destination is marked with
> + * __nonstring when it is a character array.
> + *
Regardless, I don't see these new table above in the output (am I missing
something?).
Thanks.
--
An old man doll... just what I always wanted! - Clara
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists