Skip to content

Commit

Permalink
setsockopt: socket{call,pair,} send{msg,to}: Convert docs 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 3c55fee commit ec54069
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 48 deletions.
14 changes: 8 additions & 6 deletions testcases/kernel/syscalls/sendmsg/sendmsg03.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2020 SUSE LLC <mdoucha@suse.cz>
*/

/*\
* [Description]
*
* CVE-2017-17712
*
* Test for race condition vulnerability in sendmsg() on SOCK_RAW sockets.
* Changing the value of IP_HDRINCL socket option in parallel with sendmsg()
* call may lead to uninitialized stack pointer usage, allowing arbitrary code
* execution or privilege escalation. Fixed in:
* execution or privilege escalation.
*
* commit 8f659a03a0ba9289b9aeb9b4470e6fb263d6f483
* Author: Mohamed Ghannam <simo.ghannam@gmail.com>
* Date: Sun Dec 10 03:50:58 2017 +0000
*
* net: ipv4: fix for a race condition in raw_sendmsg
* Fixed in 4.15
* 8f659a03a0ba ("net: ipv4: fix for a race condition in raw_sendmsg")
*/

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
Expand Down
13 changes: 6 additions & 7 deletions testcases/kernel/syscalls/sendto/sendto02.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
/*
* Copyright(c) 2016 Fujitsu Ltd.
* Author: Xiao Yang <yangx.jy@cn.fujitsu.com>
* Copyright (c) Linux Test Project, 2017-2019
*/

/*
* Test Name: sendto02
/*\
* [Description]
*
* Description:
* When sctp protocol is selected in socket(2) and buffer is invalid,
* When SCTP protocol created wih socket(2) and buffer is invalid,
* sendto(2) should fail and set errno to EFAULT, but it sets errno
* to ENOMEM.
*
* This is a regression test and has been fixed by kernel commit:
* 6e51fe7572590d8d86e93b547fab6693d305fd0d (sctp: fix -ENOMEM result
* with invalid user space pointer in sendto() syscall)
* This is a regression test fixed by kernel 3.7
* 6e51fe757259 (sctp: fix -ENOMEM result with invalid user space pointer in sendto() syscall)
*/

#include <errno.h>
Expand Down
13 changes: 6 additions & 7 deletions testcases/kernel/syscalls/sendto/sendto03.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
* Copyright (c) 2019 SUSE LLC <mdoucha@suse.cz>
*/

/*
/*\
* [Description]
*
* CVE-2020-14386
*
* Check for vulnerability in tpacket_rcv() which allows an unprivileged user
* to write arbitrary data to a memory area outside the allocated packet
* buffer. Kernel crash fixed in:
*
* commit acf69c946233259ab4d64f8869d4037a198c7f06
* Author: Or Cohen <orcohen@paloaltonetworks.com>
* Date: Thu Sep 3 21:05:28 2020 -0700
* buffer.
*
* net/packet: fix overflow in tpacket_rcv
* Kernel crash fixed in 5.9
* acf69c946233 ("net/packet: fix overflow in tpacket_rcv")
*/

#include <stdio.h>
Expand Down
22 changes: 15 additions & 7 deletions testcases/kernel/syscalls/socket/socket01.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Copyright (c) Linux Test Project, 2003-2024
*/

/*
* Test Name: socket01
*
* Test Description:
* Verify that socket() returns the proper errno for various failure cases
*
*/
/*\
* [Description]
*
* Test creating TCP, UDP, and Unix doman dgram sockets with socket() syscall.
*
* Also verify that socket() fails and set proper errno
*
* - EAFNOSUPPORT on invalid domain
* - EINVAL on invalid type
* - EPROTONOSUPPORT on raw open as non-root
* - EPROTONOSUPPORT on UDP stream
* - EPROTONOSUPPORT on TCP dgram
* - EPROTONOSUPPORT on ICMP stream
*/

#include <stdio.h>
#include <unistd.h>
Expand Down
13 changes: 6 additions & 7 deletions testcases/kernel/syscalls/socket/socket02.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
/*
* Copyright (c) Ulrich Drepper <drepper@redhat.com>
* Copyright (c) International Business Machines Corp., 2009
* Copyright (c) Linux Test Project, 2010-2022
*/

/*
* Test Name: socket02
*
* Description:
* This program tests the new flag SOCK_CLOEXEC and SOCK_NONBLOCK introduced
* in socket() in kernel 2.6.27.
*/
/*\
* [Description]
*
* Test socket() with SOCK_CLOEXEC and SOCK_NONBLOCK flags.
*/

#include <stdio.h>
#include <unistd.h>
Expand Down
8 changes: 7 additions & 1 deletion testcases/kernel/syscalls/socketcall/socketcall01.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
* Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
* Copyright (c) Linux Test Project, 2017-2020
* Author: Sowmya Adiga <sowmya.adiga@wipro.com>
*/

/*\
* [Description]
*
* Basic test for the socketcall(2) raw syscall.
*
* This is a basic test for the socketcall(2) system call.
* Test creating TCP, UDP, raw socket and unix domain dgram.
*/

#include <unistd.h>
Expand Down
24 changes: 18 additions & 6 deletions testcases/kernel/syscalls/socketpair/socketpair01.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2001
* Copyright (c) Linux Test Project, 2003-2022
*/

/*
* Test Name: socketpair01
*
* Test Description:
* Verify that socketpair() returns the proper errno for various failure cases
*/
/*\
* [Description]
*
* Verify that socketpair(2) fails and set proper errno
*
* - EAFNOSUPPORT on invalid domain
* - EINVAL on invalid type
* - EPROTONOSUPPORT on raw open as non-root
* - EFAULT on bad aligned pointer
* - EFAULT on bad unaligned pointer
* - EOPNOTSUPP on UDP socket
* - EPROTONOSUPPORT on TCP dgram
* - EOPNOTSUPP on TCP socket
* - EPROTONOSUPPORT on ICMP stream
*
* Also test creating UNIX domain dgram.
*/

#include <stdio.h>
#include <unistd.h>
Expand Down
13 changes: 6 additions & 7 deletions testcases/kernel/syscalls/socketpair/socketpair02.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
/*
* Copyright (c) Ulrich Drepper <drepper@redhat.com>
* Copyright (c) International Business Machines Corp., 2009
* Copyright (c) Linux Test Project, 2010-2022
*/

/*
* Test Name: socketpair02
*
* Description:
* This Program tests the new flag SOCK_CLOEXEC and SOCK_NONBLOCK introduced
* in socketpair() in kernel 2.6.27.
*/
/*\
* [Description]
*
* Test socket() with SOCK_CLOEXEC and SOCK_NONBLOCK flags.
*/

#include <errno.h>
#include <pthread.h>
Expand Down

0 comments on commit ec54069

Please sign in to comment.