public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: laniel_francis@privacyrequired.com
Cc: linux-hardening@vger.kernel.org, dja@axtens.net
Subject: Re: [RFC PATCH v4 0/5] Fortify strscpy()
Date: Tue, 17 Nov 2020 14:06:07 -0800	[thread overview]
Message-ID: <202011171404.2CFCB24344@keescook> (raw)
In-Reply-To: <20201116145012.24471-1-laniel_francis@privacyrequired.com>

On Mon, Nov 16, 2020 at 03:50:07PM +0100, laniel_francis@privacyrequired.com wrote:
> This patch set answers to this issue:
> https://github.com/KSPP/linux/issues/46
> 
> I based my modifications on top of two patches from Daniel Axtens which modify
> calls to __builtin_object_size to ensure the true size of char * are returned
> and not the surrounding structure size.
> 
> To sum up, in my first patch I implemented a fortified version of strscpy.
> This new version ensures the following before calling vanilla strscpy:
> 1. There is no read overflow because we either size is smaller than src length
> or we shrink size to src length by calling fortified strnlen.
> 2. There is no write overflow because we either failed during compilation or at
> runtime by checking that size is smaller than dest size.
> The second patch brings a new file in LKDTM driver to test this new version.
> The test ensures the fortified version still returns the same value as the
> vanilla one while panic'ing when there is a write overflow.
> The third just corrects some typos in LKDTM related file.
> 
> If you see any problem or way to improve the code, feel free to share it.

Thanks! This looks really good. You can drop the "RFC" parts, and for
v5, please use

	To: Andrew Morton <akpm@linux-foundation.org>

and add to Cc:

	linux-mm@kvack.org
	linux-kernel@vger.kernel.org

I think going via -mm is the most sensible, since that's where the other
fortify pieces landed.

-- 
Kees Cook

  parent reply	other threads:[~2020-11-17 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 14:50 [RFC PATCH v4 0/5] Fortify strscpy() laniel_francis
2020-11-16 14:50 ` [PATCH v4 1/5] string.h: detect intra-object overflow in fortified string functions laniel_francis
2020-11-16 14:50 ` [PATCH v4 2/5] lkdtm: tests for FORTIFY_SOURCE laniel_francis
2020-11-16 14:50 ` [RFC PATCH v4 3/5] string.h: Add FORTIFY coverage for strscpy() laniel_francis
2020-11-17 22:02   ` Kees Cook
2020-11-16 14:50 ` [RFC PATCH v4 4/5] Add new file in LKDTM to test fortified strscpy laniel_francis
2020-11-17 22:04   ` Kees Cook
2020-11-16 14:50 ` [RFC PATCH v4 5/5] Correct wrong filenames in comment laniel_francis
2020-11-17 22:06 ` Kees Cook [this message]
2020-11-18 10:41   ` [RFC PATCH v4 0/5] Fortify strscpy() Francis Laniel

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=202011171404.2CFCB24344@keescook \
    --to=keescook@chromium.org \
    --cc=dja@axtens.net \
    --cc=laniel_francis@privacyrequired.com \
    --cc=linux-hardening@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox