1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-17 20:10:49 +00:00
David Howells 4fe38acdac net: Block MSG_SENDPAGE_* from being passed to sendmsg() by userspace
It is necessary to allow MSG_SENDPAGE_* to be passed into ->sendmsg() to
allow sendmsg(MSG_SPLICE_PAGES) to replace ->sendpage().  Unblocking them
in the network protocol, however, allows these flags to be passed in by
userspace too[1].

Fix this by marking MSG_SENDPAGE_NOPOLICY, MSG_SENDPAGE_NOTLAST and
MSG_SENDPAGE_DECRYPTED as internal flags, which causes sendmsg() to object
if they are passed to sendmsg() by userspace.  Network protocol ->sendmsg()
implementations can then allow them through.

Note that it should be possible to remove MSG_SENDPAGE_NOTLAST once
sendpage is removed as a whole slew of pages will be passed in in one go by
splice through sendmsg, with MSG_MORE being set if it has more data waiting
in the pipe.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Chuck Lever <chuck.lever@oracle.com>
cc: Boris Pismenny <borisp@nvidia.com>
cc: John Fastabend <john.fastabend@gmail.com>
cc: Jens Axboe <axboe@kernel.dk>
cc: Matthew Wilcox <willy@infradead.org>
Link: https://lore.kernel.org/r/20230526181338.03a99016@kernel.org/ [1]
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-06-08 19:40:30 -07:00
..
2023-04-27 12:07:50 -07:00
2023-05-03 11:25:01 -07:00
2023-04-26 16:07:23 -07:00
2023-04-26 16:07:23 -07:00
2023-06-02 13:38:55 -04:00
2023-04-27 17:17:12 -07:00
2023-04-26 12:52:58 -07:00
2023-04-26 12:52:58 -07:00
2023-05-20 05:38:01 -06:00
2023-06-01 21:40:10 -07:00
2023-04-28 14:02:54 -07:00
2023-05-25 09:26:19 +02:00
2023-04-27 10:09:05 -07:00
2023-04-25 12:39:01 -07:00
2023-05-25 09:26:19 +02:00
2023-05-05 13:11:02 -07:00
2023-04-30 13:00:38 -07:00
2023-05-01 12:06:20 -07:00
2023-05-28 07:15:33 -04:00
2023-04-28 14:53:30 -07:00
2023-04-27 16:36:55 -07:00
2023-05-24 18:08:49 +02:00
2023-04-27 12:07:50 -07:00
2023-04-27 12:07:50 -07:00
2023-04-30 11:51:51 -07:00
2023-04-28 15:57:53 -07:00
2023-05-18 19:52:31 -07:00
2023-04-29 10:29:57 -07:00
2023-04-27 11:53:57 -07:00
2023-04-27 11:42:11 -07:00
2023-05-02 11:56:43 -07:00