Skip to content

Commit

Permalink
setsockop: Convert doc to docparse
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Sep 2, 2024
1 parent 62f25f6 commit 3c55fee
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 29 deletions.
22 changes: 16 additions & 6 deletions testcases/kernel/syscalls/setsockopt/setsockopt01.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* 07/2001 John George
* Copyright (c) 2020 Martin Doucha <mdoucha@suse.cz>
* Copyright (c) International Business Machines Corp., 2001
* Author: John George
* Copyright (c) 2020 Martin Doucha <mdoucha@suse.cz>
*/

/*
* Test Description:
* Verify that setsockopt() returns the proper errno for various failure cases
/*\
* [Description]
*
* Verify that setsockopt() fails and set errno:
*
* - EBADF on invalid file descriptor
* - ENOTSOCK on non-socket file descriptor
* - EFAULT on invalid option buffer
* - EINVAL on invalid optlen
* - ENOPROTOOPT on invalid level
* - ENOPROTOOPT on invalid option name (UDP)
* - ENOPROTOOPT on invalid option name (IP)
* - ENOPROTOOPT on invalid option name (TCP)
*/

#include <unistd.h>
Expand Down
6 changes: 5 additions & 1 deletion testcases/kernel/syscalls/setsockopt/setsockopt02.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
/*
* Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
*/
/* Test for CVE-2017-7308 on a raw socket's ring buffer

/*\
* [Description]
*
* Test for CVE-2017-7308 on a raw socket's ring buffer
*
* Try to set tpacket_req3.tp_sizeof_priv to a value with the high bit set. So
* that tp_block_size < tp_sizeof_priv. If the vulnerability is present then
Expand Down
5 changes: 4 additions & 1 deletion testcases/kernel/syscalls/setsockopt/setsockopt04.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
* Copyright (c) 2019 SUSE LLC
* Author: Christian Amann <camann@suse.com>
*/
/* Test for CVE-2016-9793
/*\
* [Description]
*
* CVE-2016-9793
*
* With kernels between version 3.11 and 4.8 missing commit b98b0bc8 it
* is possible to pass a very high unsigned integer as send buffer size
Expand Down
12 changes: 5 additions & 7 deletions testcases/kernel/syscalls/setsockopt/setsockopt05.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
* Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
*/

/*
/*\
* [Description]
*
* CVE-2017-1000112
*
* Check that UDP fragmentation offload doesn't cause memory corruption
* if the userspace process turns off UFO in between two send() calls.
* Kernel crash fixed in:
*
* commit 85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa
* Author: Willem de Bruijn <willemb@google.com>
* Date: Thu Aug 10 12:29:19 2017 -0400
*
* udp: consistently apply ufo or fragmentation
* Kernel crash fixed in 4.13
* 85f1bd9a7b5a ("udp: consistently apply ufo or fragmentation")
*/

#include <sys/types.h>
Expand Down
13 changes: 6 additions & 7 deletions testcases/kernel/syscalls/setsockopt/setsockopt06.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
* Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
*/

/*
/*\
* [Description]
*
* CVE-2016-8655
*
* Check for race condition between packet_set_ring() and tp_version. On some
* kernels, this may lead to use-after-free. Kernel crash fixed in:
*
* commit 84ac7260236a49c79eede91617700174c2c19b0c
* Author: Philip Pettersson <philip.pettersson@gmail.com>
* Date: Wed Nov 30 14:55:36 2016 -0800
* kernels, this may lead to use-after-free.
*
* packet: fix race condition in packet_set_ring
* Kernel crash fixed in 4.9
* 84ac7260236a ("packet: fix race condition in packet_set_ring")
*/

#include <unistd.h>
Expand Down
12 changes: 5 additions & 7 deletions testcases/kernel/syscalls/setsockopt/setsockopt07.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
* Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
*/

/*
/*\
* [Description]
*
* CVE-2017-1000111
*
* Check for race condition between packet_set_ring() and tp_reserve.
* The race allows you to set tp_reserve bigger than ring buffer size.
* While this will cause truncation of all incoming packets to 0 bytes,
* sanity checks in tpacket_rcv() prevent any exploitable buffer overflows.
* Race fixed in:
*
* commit c27927e372f0785f3303e8fad94b85945e2c97b7 (HEAD)
* Author: Willem de Bruijn <willemb@google.com>
* Date: Thu Aug 10 12:41:58 2017 -0400
*
* packet: fix tp_reserve race in packet_set_ring
* Race fixed in v4.13
* c27927e372f0 ("packet: fix tp_reserve race in packet_set_ring")
*/

#include <unistd.h>
Expand Down

0 comments on commit 3c55fee

Please sign in to comment.