io_uring/net: don't alias send user pointer reads
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 22 Oct 2024 14:43:14 +0000 (15:43 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Oct 2024 13:27:21 +0000 (07:27 -0600)
commitbacf9f93e39cba8eca02f0d44c82d44875610095
tree21365718fd9dc8fdaa0bc8afae91a9211516c200
parent31ce5dd1fb48bce9db8fb51ab5828a1cecf07e07
io_uring/net: don't alias send user pointer reads

We keep user pointers in an union, which could be a user buffer or a
user pointer to msghdr. What is confusing is that it potenitally reads
and assigns sqe->addr as one type but then uses it as another via the
union. Even more, it's not even consistent across copy and zerocopy
versions.

Make send and sendmsg setup helpers read sqe->addr and treat it as the
right type from the beginning. The end goal would be to get rid of
the use of struct io_sr_msg::umsg for send requests as we only need it
at the prep side.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/685d788605f5d78af18802fcabf61ba65cfd8002.1729607201.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/net.c