]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: af_unix: validate SO_PEEK_OFF advancement and reset
authorSoichiro Ueda <the.latticeheart@gmail.com>
Tue, 10 Mar 2026 07:28:31 +0000 (16:28 +0900)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Mar 2026 01:20:17 +0000 (18:20 -0700)
commit34c0378b156f02f5fd8149f24a7aa75b255e8cda
tree2d22c3f2725ad0e306dfdc59af379d1e17052922
parent482aac8b56ca21d06c588517970579474d56736e
selftests: af_unix: validate SO_PEEK_OFF advancement and reset

Extend the so_peek_off selftest to ensure the socket peek offset is handled
correctly after both MSG_PEEK and actual data consumption.

Verify that the peek offset advances by the same amount as the number of
bytes read when performing a read with MSG_PEEK.

After exercising SO_PEEK_OFF via MSG_PEEK, drain the receive queue with a
non-peek recv() and verify that it can receive all the content in the
buffer and SO_PEEK_OFF returns back to 0.

The verification after actual data consumption was suggested by Miao Wang
when the original so_peek_off selftest was introduced.

Link: https://lore.kernel.org/all/7B657CC7-B5CA-46D2-8A4B-8AB5FB83C6DA@gmail.com/
Suggested-by: Miao Wang <shankerwangmiao@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Soichiro Ueda <the.latticeheart@gmail.com>
Link: https://patch.msgid.link/20260310072832.127848-1-the.latticeheart@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/af_unix/so_peek_off.c