From: David Miller <davem@davemloft.net>
To: keescook@chromium.org
Cc: syzbot+e2d6cfb305e9f3911dea@syzkaller.appspotmail.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
ebiggers3@gmail.com, james.morse@arm.com,
keun-o.park@darkmatter.ae, labbott@redhat.com,
linux-mm@kvack.org, mingo@kernel.org
Subject: Re: [PATCH v2] socket: Provide put_cmsg_whitelist() for constant size copies
Date: Mon, 05 Feb 2018 10:03:47 -0500 (EST) [thread overview]
Message-ID: <20180205.100347.176614123780866781.davem@davemloft.net> (raw)
In-Reply-To: <20180202102749.GA34019@beast>
From: Kees Cook <keescook@chromium.org>
Date: Fri, 2 Feb 2018 02:27:49 -0800
> @@ -343,6 +343,14 @@ struct ucred {
>
> extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
> extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
> +/*
> + * Provide a bounce buffer for copying cmsg data to userspace when the
> + * target memory isn't already whitelisted for hardened usercopy.
> + */
> +#define put_cmsg_whitelist(_msg, _level, _type, _ptr) ({ \
> + typeof(*(_ptr)) _val = *(_ptr); \
> + put_cmsg(_msg, _level, _type, sizeof(_val), &_val); \
> + })
I understand what you are trying to achieve, but it's at a real cost
here. Some of these objects are structures, for example the struct
sock_extended_err is 16 bytes.
And now we're going to copy it twice, once into the on-stack copy,
and then once again into the CMSG blob.
Please find a way to make hardened user copy happy without adding
new overhead.
Thank you.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-02-05 15:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 10:27 [PATCH v2] socket: Provide put_cmsg_whitelist() for constant size copies Kees Cook
2018-02-05 15:03 ` David Miller [this message]
2018-02-05 17:31 ` Kees Cook
2018-02-06 16:19 ` David Miller
2018-02-06 18:36 ` Kees Cook
2018-02-06 18:42 ` David Miller
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=20180205.100347.176614123780866781.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ebiggers3@gmail.com \
--cc=james.morse@arm.com \
--cc=keescook@chromium.org \
--cc=keun-o.park@darkmatter.ae \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzbot+e2d6cfb305e9f3911dea@syzkaller.appspotmail.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 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).