[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161230.152057.1192922867281184266.davem@davemloft.net>
Date: Fri, 30 Dec 2016 15:20:57 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: cugyly@....com
Cc: netdev@...r.kernel.org, Linyu.Yuan@...atel-sbell.com.cn
Subject: Re: [PATCH v2] scm: fix possible control message header alignment
issue
From: yuan linyu <cugyly@....com>
Date: Thu, 29 Dec 2016 20:39:32 +0800
> From: yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
>
> 1. put_cmsg{_compat}() may copy data to user when buffer free space less than
> control message header alignment size.
> 2. scm_detach_fds{_compat}() may calc wrong fdmax if control message header
> have greater alignment size.
>
> Signed-off-by: yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
But can this actually happen, in practice?
Take, for example, COMPAT_CMSG_DATA().
It aligns "struct compat_cmsghdr" to a multiple of a u32.
I cannot think of any possibly way that, on any architecture
whatsoever:
CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))
evaludates to any value other than, exactly:
sizeof(struct compat_cmsghdr)
If you can come up with a case where this does happen in
practice, I will continue to consider this patch.
Otherwise, we should make the assumptions that exist explicit
and get rid of all of the code that does that funny alignment
upon the cmsghdr structure.
Thanks.
Powered by blists - more mailing lists