Skip to content

Commit

Permalink
syscalls/statmount07: change "invalid buffer size" test
Browse files Browse the repository at this point in the history
The manpage doesn't say that 'smbuf' needs to be valid
for entire range of 'bufsize'.

This check relies on access_ok() check, which can be skipped
on some arches/configs, for example on s390x with
CONFIG_ALTERNATE_USER_ADDRESS_SPACE=y. Test then fails with:
  statmount07.c:117: TFAIL: invalid buffer size succeeded

Change the test to use buffer that crosses partially
into PROT_NONE area.

Link: https://lore.kernel.org/ltp/d53bcc8476d4c2ef37b92543b2f7fe8338420f0b.1728992854.git.jstancek@redhat.com/
Reviewed-by: Cyril Hrubis <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Jan Stancek <[email protected]>
  • Loading branch information
jstancek authored and pevik committed Oct 18, 2024
1 parent 7685390 commit 4b839bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions testcases/kernel/syscalls/statmount/statmount07.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
static struct statmount *st_mount;
static struct statmount *st_mount_null;
static struct statmount *st_mount_small;
static struct statmount *st_mount_bad;
static uint64_t mnt_id;
static uint64_t mnt_id_dont_exist = -1;
static size_t buff_size;
static size_t buff_size_invalid = -1;

struct tcase {
int exp_errno;
Expand Down Expand Up @@ -90,12 +90,12 @@ struct tcase {
},
{
EFAULT,
"invalid buffer size",
"buffer crosses to PROT_NONE",
&mnt_id,
0,
0,
&buff_size_invalid,
&st_mount
&buff_size,
&st_mount_bad
},
{
EFAULT,
Expand Down Expand Up @@ -139,6 +139,7 @@ static struct tst_test test = {
.bufs = (struct tst_buffers []) {
{&st_mount, .size = sizeof(struct statmount)},
{&st_mount_small, .size = sizeof(struct statmount)},
{&st_mount_bad, .size = 1},
{}
}
};

0 comments on commit 4b839bb

Please sign in to comment.