Re: [PATCH net-next] net: devmem: drop iterator type check

Pavel Begunkov
2025-05-19T10:44:43Z

On 5/16/25 23:54, Stanislav Fomichev wrote:
> sendmsg() with a single iov becomes ITER_UBUF, sendmsg() with multiple
> iovs becomes ITER_IOVEC. Instead of adjusting the check to include
> ITER_UBUF, drop the check completely. The callers are guaranteed
> to happen from system call side and we don't need to pay runtime
> cost to verify it.

I asked for this because io_uring can pass bvecs. Only sendzc can
pass that with cmsg, so probably you won't be able to hit any
real issue, but io_uring needs and soon will have bvec support for
normal sends as well. One can argue we should care as it isn't
merged yet, but there is something very very wrong if an unrelated
and legal io_uring change is able to open a vulnerability in the
devmem path.

On the bright side, checking UBUF on top doesn't add extra overhead
as compilers can put it under the same test and generate sth like:

if (iter->type > ITER_IOVEC) /* fail */

--
Pavel Begunkov