From: Teo Couprie Diaz <teo.coupriediaz@arm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] safe_open: Add missing mode from some calls
Date: Thu, 23 Mar 2023 16:05:07 +0000 [thread overview]
Message-ID: <20230323160508.672397-1-teo.coupriediaz@arm.com> (raw)
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
next reply other threads:[~2023-03-23 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 16:05 Teo Couprie Diaz [this message]
2023-03-28 8:26 ` [LTP] [PATCH] safe_open: Add missing mode from some calls Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230323160508.672397-1-teo.coupriediaz@arm.com \
--to=teo.coupriediaz@arm.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox