linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Tycho Andersen <tycho@tycho.ws>,
	linux-sparse@vger.kernel.org,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC v1] copy_{to,from}_user(): only inline when !__CHECKER__
Date: Sun, 9 Dec 2018 21:56:51 +0000	[thread overview]
Message-ID: <20181209215651.GD2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20181209213951.kumz33u6prb2seqz@ltop.local>

On Sun, Dec 09, 2018 at 10:39:52PM +0100, Luc Van Oostenryck wrote:

> There are several more or less bad/good solutions, like:
> * add raw_copy_{to,from}_user() in the list of checked function
>   (not inlined in most archs).
> * add a new annotation to force sparse to check the byte count
>   (I'm thinking about __range__/OP_RANGE or something similar).
> * do these checks before functions are inlined (but then some
>   constant count could not yet be seen as constant).
  * just spell it out in copy_to_user() itself - as in
#ifdef C_T_U_SIZE_LIMIT
	if (__builtin_constant_p(count) && count > C_T_U_SIZE_LIMIT)
		/* something warning-triggering */
#endif
in the beginning of copy_from_user().  Or simply
#ifdef C_T_U_SIZE_LIMIT
	BUILD_BUG_ON(__builtin_constant_p(count) && count > C_T_U_SIZE_LIMIT);
#endif
in there...

  parent reply	other threads:[~2018-12-09 21:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-09 20:44 [RFC v1] copy_{to,from}_user(): only inline when !__CHECKER__ Tycho Andersen
2018-12-09 21:02 ` Al Viro
2018-12-09 21:25   ` Tycho Andersen
2018-12-09 21:39     ` Luc Van Oostenryck
2018-12-09 21:53       ` Tycho Andersen
2018-12-09 21:56       ` Al Viro [this message]
2018-12-09 22:08         ` Luc Van Oostenryck
2018-12-09 21:46     ` Al Viro
2018-12-09 21:56       ` Tycho Andersen

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=20181209215651.GD2217@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=tycho@tycho.ws \
    /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;
as well as URLs for NNTP newsgroup(s).