Skip to content

Commit ffcc093

Browse files
committed
execve: Convert docs to docparse
Also use link to man (as :man2:`execve`) in already converted tests. Remove unused headers in execve01.c. Signed-off-by: Petr Vorel <[email protected]>
1 parent 81e669f commit ffcc093

File tree

6 files changed

+23
-46
lines changed

6 files changed

+23
-46
lines changed

testcases/kernel/syscalls/execve/execve01.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
3-
* Copyright (c) 2018 Linux Test Project
3+
* Copyright (c) 2018-2025 Linux Test Project
44
* Copyright (C) 2015 Cyril Hrubis <[email protected]>
55
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
6-
* AUTHOR : William Roske
7-
* CO-PILOT : Dave Fenner
6+
* Authors: William Roske, Dave Fenner
87
*/
98

10-
#include <errno.h>
119
#include <string.h>
12-
#include <signal.h>
1310
#include <stdio.h>
14-
#include <stdlib.h>
15-
#include <sys/types.h>
16-
#include <sys/wait.h>
17-
1811
#include "tst_test.h"
1912

13+
/*\
14+
* Test :man2:`execve` passes correctly argv[1] and environment variable to the
15+
* executed binary.
16+
*/
17+
2018
static void verify_execve(void)
2119
{
2220
pid_t pid;

testcases/kernel/syscalls/execve/execve02.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* 21/04/2008 Renaud Lottiaux ([email protected])
99
*/
1010

11-
/*
12-
* Attempt to execve(2) an executable owned by root with no execute permissions
13-
* for the other users, fails when execve(2) is used as a non-root user, the
14-
* errno should be EACCES.
11+
/*\
12+
* Attempt to :man2:`execve` an executable owned by root with no execute
13+
* permissions for the other users, fails when :man2:`execve` is used as
14+
* a non-root user, the errno should be EACCES.
1515
*/
1616

1717
#define _GNU_SOURCE

testcases/kernel/syscalls/execve/execve03.c

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,15 @@
66
* Ported to LTP: Wayne Boyer
77
*/
88

9-
/*
10-
* Testcase to check execve sets the following errnos correctly:
11-
* 1. ENAMETOOLONG
12-
* 2. ENOENT
13-
* 3. ENOTDIR
14-
* 4. EFAULT
15-
* 5. EACCES
16-
* 6. ENOEXEC
17-
*
18-
* ALGORITHM
19-
* 1. Attempt to execve(2) a file whose name is more than
20-
* VFS_MAXNAMLEN fails with ENAMETOOLONG.
21-
*
22-
* 2. Attempt to execve(2) a file which doesn't exist fails with
23-
* ENOENT.
24-
*
25-
* 3. Attempt to execve(2) a pathname (executabl) comprising of a
26-
* directory, which doesn't exist fails with ENOTDIR.
27-
*
28-
* 4. Attempt to execve(2) a filename not within the address space
29-
* of the process fails with EFAULT.
30-
*
31-
* 5. Attempt to execve(2) a filename that does not have executable
32-
* permission - fails with EACCES.
9+
/*\
10+
* Test to check :man2:`execve` sets the following errnos correctly:
3311
*
34-
* 6. Attempt to execve(2) a zero length file with executable
35-
* permissions - fails with ENOEXEC.
12+
* 1. ENAMETOOLONG -- the file name is greater than VFS_MAXNAMELEN
13+
* 2. ENOENT -- the filename does not exist
14+
* 3. ENOTDIR -- the path contains a directory name which doesn't exist
15+
* 4. EFAULT -- the filename isn't part of the process address space
16+
* 5. EACCES -- the filename does not have execute permission
17+
* 6. ENOEXEC -- the file is zero length with execute permissions
3618
*/
3719

3820
#define _GNU_SOURCE
@@ -66,11 +48,8 @@ static struct tcase {
6648
{no_dir, ENOENT},
6749
/* the path contains a directory name which doesn't exist - ENOTDIR */
6850
{test_name3, ENOTDIR},
69-
/* the filename isn't part of the process address space - EFAULT */
7051
{NULL, EFAULT},
71-
/* the filename does not have execute permission - EACCES */
7252
{test_name5, EACCES},
73-
/* the file is zero length with execute permissions - ENOEXEC */
7453
{test_name6, ENOEXEC}
7554
};
7655

testcases/kernel/syscalls/execve/execve04.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
/*\
12-
* Attempt to execve(2) a file which is being opened by another process for
12+
* Attempt to :man2:`execve` a file which is being opened by another process for
1313
* writing fails with ETXTBSY.
1414
*/
1515

testcases/kernel/syscalls/execve/execve05.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
/*\
10-
* This tests the functionality of the execve(2) system call by spawning
11-
* a few children, each of which would execute "execve_child" simultaneously,
10+
* This tests the functionality of the execve(2) :man2:`execve` call by spawning
11+
* a few children, each of which would execute "execve_child" binary simultaneously,
1212
* and finally the parent ensures that they terminated correctly.
1313
*/
1414

testcases/kernel/syscalls/execve/execve06.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/*\
77
* Test that kernel adds dummy argv[0] if empty argument list was passed to
8-
* execve(). This fixes at least one CVE where userspace programs start to
8+
* :man2:`execve`. This fixes at least one CVE where userspace programs start to
99
* process argument list blindly from argv[1] such as polkit pkexec
1010
* CVE-2021-4034.
1111
*

0 commit comments

Comments
 (0)