* [LTP] [PATCH] safe_open: Add missing mode from some calls
@ 2023-03-23 16:05 Teo Couprie Diaz
2023-03-28 8:26 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Teo Couprie Diaz @ 2023-03-23 16:05 UTC (permalink / raw)
To: ltp
safe_open expects a mode when creating or using a temporary file, which is
read via a variadic argument.
Add the mode when it is missing for a few tests.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
---
This was detected on Morello[0] as the missing mode triggered an access
outside of capability bounds when processing the variadic argument.
CI Build: https://github.com/Teo-CD/ltp/actions/runs/4502201455
[0]: https://www.morello-project.org/
.../kernel/syscalls/name_to_handle_at/name_to_handle_at01.c | 2 +-
.../kernel/syscalls/open_by_handle_at/open_by_handle_at01.c | 2 +-
testcases/kernel/syscalls/utimensat/utimensat01.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c
index 9677b06719e3..6535fdf5c0ed 100644
--- a/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c
+++ b/testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c
@@ -72,7 +72,7 @@ static void setup(void)
dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
SAFE_CHDIR(TEST_DIR);
SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
+ file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
}
diff --git a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c
index 76be720cad78..6171229f0b6f 100644
--- a/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c
+++ b/testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c
@@ -55,7 +55,7 @@ static void setup(void)
dir_fd = SAFE_OPEN(TEST_DIR, O_DIRECTORY);
SAFE_CHDIR(TEST_DIR);
SAFE_TOUCH(TEST_FILE, 0600, NULL);
- file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT);
+ file_fd = SAFE_OPEN("foo_file", O_RDWR | O_CREAT, 0600);
f_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
d_fhp = allocate_file_handle(AT_FDCWD, TEST_FILE);
diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c
index ac267e7d9f84..a2897b42288d 100644
--- a/testcases/kernel/syscalls/utimensat/utimensat01.c
+++ b/testcases/kernel/syscalls/utimensat/utimensat01.c
@@ -233,7 +233,7 @@ static void run(unsigned int i)
dfd = SAFE_OPEN(TEST_DIR, tc->oflags);
if (tc->pathname) {
- fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT);
+ fd = SAFE_OPEN(tc->pathname, O_WRONLY | O_CREAT, 0200);
pathname = tc->pathname;
SAFE_CHMOD(tc->pathname, tc->mode);
reset_time(pathname, dfd, tc->flags, i);
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] safe_open: Add missing mode from some calls
2023-03-23 16:05 [LTP] [PATCH] safe_open: Add missing mode from some calls Teo Couprie Diaz
@ 2023-03-28 8:26 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2023-03-28 8:26 UTC (permalink / raw)
To: Teo Couprie Diaz; +Cc: ltp
Hi!
Good catch, applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-28 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 16:05 [LTP] [PATCH] safe_open: Add missing mode from some calls Teo Couprie Diaz
2023-03-28 8:26 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox