[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180205.100347.176614123780866781.davem@davemloft.net>
Date: Mon, 05 Feb 2018 10:03:47 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: keescook@...omium.org
Cc: syzbot+e2d6cfb305e9f3911dea@...kaller.appspotmail.com,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
ebiggers3@...il.com, james.morse@....com,
keun-o.park@...kmatter.ae, labbott@...hat.com, linux-mm@...ck.org,
mingo@...nel.org
Subject: Re: [PATCH v2] socket: Provide put_cmsg_whitelist() for constant
size copies
From: Kees Cook <keescook@...omium.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.
Powered by blists - more mailing lists