Skip to contentSkip to conversation

syscalls/ustat: convert to new lib, use direct syscall

PATCH New Steve Muckle 5 participants 7 messages Feb 2, 2019 – Feb 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 syscalls/ustat: convert to new lib, use direct syscall

Use direct syscall to expand test compatibility to Android.

Change-Id I7c88e18990509458ca6066a09685d1d09b24907a
---
 include/lapi/ustat.h                      | 19 +++++
 testcases/kernel/syscalls/ustat/ustat01.c | 84 +++++----------------
 testcases/kernel/syscalls/ustat/ustat02.c | 92 +++++------------------
 3 files changed, 56 insertions(+), 139 deletions(-)
 create mode 100644 include/lapi/ustat.h
include/lapi/ustat.h new file +19 -0
new file mode 100644
index 000000000..b32749925
@@ -0,0 +1,19 @@
+//SPDX-License-Identifier: GPL-2.0-or-later
+
+#ifndef LAPI_USTAT_H
+#define LAPI_USTAT_H
+
+#include <sys/types.h>
+
+#ifdef HAVE_SYS_USTAT_H
+# include <sys/ustat.h>
+#else
+struct ustat {
+	daddr_t f_tfree;
+	ino_t f_tinode;
+	char f_fname[6];
+	char f_fpack[6];
+};
+#endif
+
+#endif /* LAPI_USTAT_H */
testcases/kernel/syscalls/ustat/ustat01.c +17 -67

109 lines not on this page · raw message

testcases/kernel/syscalls/ustat/ustat02.c +20 -72

118 lines not on this page · raw message

Signature · 1 line
2.20.1.611.gfbb209baf1-goog
#1 lore raw

PATCH v2 1/1 syscalls/ustat: convert to new lib, use direct syscall

Hi Steve,

Quoted 1 line

Use direct syscall to expand test compatibility to Android.

thanks for your patch, merged.

Quoted 1 line

Change-Id: I7c88e18990509458ca6066a09685d1d09b24907a

I'm sorry, I removed your gerrit's Change-Id from commit message.

Kind regards,
Petr

#2 lore raw

PATCH 1/1 ustat: Fix EFAULT in 32bit compatability mode

In reply to Steve Muckle

This test fails with -m32 on Intel because the user land dev_num is too large.

---

From looking at glibc, this test may also be broken on mips, but I am not sure if that matters. AFAICT on all other platforms glibc always casts to uint after performing a sanity check..

 testcases/kernel/syscalls/ustat/ustat01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/ustat/ustat01.c +1 -1
index 3f1186c49..2e7dcc9d7 100644
@@ -20,7 +20,7 @@ void run(void)
 {
 	struct ustat ubuf;
 
-	TEST(tst_syscall(__NR_ustat, dev_num, &ubuf));
+	TEST(tst_syscall(__NR_ustat, (unsigned int)dev_num, &ubuf));
 
 	if (TST_RET == -1)
 		tst_res(TFAIL | TTERRNO, "ustat(2) failed");
Signature · 1 line
2.20.1
#3 lore raw

PATCH 1/1 ustat: Fix EFAULT in 32bit compatability mode

----- Original Message -----

Quoted 10 lines

This test fails with -m32 on Intel because the user land dev_num is too large.

---

From looking at glibc, this test may also be broken on mips, but I am not sure
if that matters. AFAICT on all other platforms glibc always casts to uint after performing a sanity check..

LGTM, LTP is using only 0 (and -1 for errno tests), so it shouldn't matter.

What about ustat02? Are you planning on sending something similar for that test?

Regards,
Jan

Quoted 25 lines
 testcases/kernel/syscalls/ustat/ustat01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/ustat/ustat01.c +1 -2
index 3f1186c49..2e7dcc9d7 100644
@@ -20,7 +20,7 @@ void run(void)
 {
 	struct ustat ubuf;
 
-	TEST(tst_syscall(__NR_ustat, dev_num, &ubuf));
+	TEST(tst_syscall(__NR_ustat, (unsigned int)dev_num, &ubuf));
 
 	if (TST_RET == -1)
 		tst_res(TFAIL | TTERRNO, "ustat(2) failed");
--

2.20.1

--
Mailing list info: https://lists.linux.it/listinfo/ltp

#4 lore raw

PATCH 1/1 ustat: Fix EFAULT in 32bit compatability mode

Hi Jan,

Quoted 6 lines
Quoted 4 lines

From looking at glibc, this test may also be broken on mips, but I am not sure
if that matters. AFAICT on all other platforms glibc always casts to uint after performing a sanity check..

LGTM, LTP is using only 0 (and -1 for errno tests), so it shouldn't matter.

I'm sorry I missed your mail, so pushed without your ack.

Quoted 1 line

What about ustat02? Are you planning on sending something similar for that test?

It's not needed for ustat02. Is it because *tc[test].dev in ustat02 is pointer?

Kind regards,
Petr

#5 lore raw

PATCH 1/1 ustat: Fix EFAULT in 32bit compatability mode

Hello,

Quoted 7 lines · Petr Vorel

Hi Jan,

Quoted 4 lines
Quoted 4 lines

From looking at glibc, this test may also be broken on mips, but I am not sure
if that matters. AFAICT on all other platforms glibc always casts to uint after performing a sanity check..

Quoted 6 lines
Quoted 1 line

LGTM, LTP is using only 0 (and -1 for errno tests), so it shouldn't matter.

I'm sorry I missed your mail, so pushed without your ack.

Quoted 1 line

What about ustat02? Are you planning on sending something similar for that test?

It's not needed for ustat02. Is it because *tc[test].dev in ustat02 is pointer?

I don't think so, but AFAICT ustat02 is still valid because passing the wrong data type still has the desired effect of creating an invalid buffer pointer in the bad address test. On the invalid parameter test, only the first 32bits of dev are checked before EINVAL is thrown, so again, it doesn't matter.

So I won't send another patch, but I am not against adding the cast either.

Quoted 3 lines

Kind regards,
Petr

--
Thank you,
Richard.

#6 lore raw

PATCH 1/1 ustat: Fix EFAULT in 32bit compatability mode

In reply to Richard Palethorpe

Hi Richard,

Quoted 2 lines

This test fails with -m32 on Intel because the user land dev_num is too large.

Thanks for the fix, merged.

Kind regards,
Petr