From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Eric Paris <eparis@redhat.com>
Subject: [PATCH] fanotify: prove that structure size is correct
Date: Sun, 28 Sep 2014 16:35:38 -0700 [thread overview]
Message-ID: <20140928233538.GA31345@www.outflux.net> (raw)
When building with CONFIG_DEBUG_STRICT_USER_COPY_CHECKS, this copy_to_user
wasn't provably correct (the length was in a variable but the structure
wasn't). The compiler wasn't able to check that the length was being
statically assigned, so include a BUG_ON to notice if this ever changes.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/notify/fanotify/fanotify_user.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index b13992a41bd9..7bdb43222875 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -216,6 +216,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
fd = fanotify_event_metadata.fd;
ret = -EFAULT;
+ BUG_ON(fanotify_event_metadata.event_len != FAN_EVENT_METADATA_LEN);
if (copy_to_user(buf, &fanotify_event_metadata,
fanotify_event_metadata.event_len))
goto out_close_fd;
--
1.9.1
--
Kees Cook
Chrome OS Security
next reply other threads:[~2014-09-28 23:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-28 23:35 Kees Cook [this message]
2014-10-02 18:56 ` Heinrich Schuchardt
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=20140928233538.GA31345@www.outflux.net \
--to=keescook@chromium.org \
--cc=eparis@redhat.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®