Skip to contentSkip to conversation

setfsuid02_16: Fix uid -1 too large for testing 16-bit version

PATCH In review Ping Fang 3 participants 5 messages Mar 9, 2023 – Mar 14, 2023

lore
Share & tools
lore

Ping Fang

author
#0 lore raw

PATCH 1/1 setfsuid02_16: Fix uid -1 too large for testing 16-bit version

__kernel_old_uid_t is not defined as 16bit on s390, ppc64le Then -1 will be translated into UINT_MAX fails the size check. s390, ppc64le use definition in /usr/include/asm-generic/posix_types.h

typedef unsigned int __kernel_uid_t;
...
typedef __kernel_uid_t __kernel_old_uid_t;

x86_64, aarch64 use definition in /usr/include/asm/posix_types_64.h typedef unsigned short __kernel_old_uid_t;

---
 testcases/kernel/syscalls/utils/compat_uid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/utils/compat_uid.h +1 -1
index 94e54f310..7a345a654 100644
@@ -26,7 +26,7 @@
 #include "tst_common.h"
 
 #ifdef TST_USE_COMPAT16_SYSCALL
-typedef __kernel_old_uid_t UID_T;
+typedef unsigned short UID_T;
 int UID_SIZE_CHECK(uid_t uid)
 {
 	/* See high2lowuid in linux/highuid.h
Signature · 5 lines
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Ping Fang

Hi Ping,

Quoted 1 line

__kernel_old_uid_t is not defined as 16bit on s390, ppc64le

I suppose limitation on s390 is because __kernel_old_uid_t is guarded only for kernel, right?

arch/s390/include/uapi/asm/posix_types.h
#ifdef __KERNEL__
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
#define __kernel_old_uid_t __kernel_old_uid_t
#endif

Quoted 2 lines

Then -1 will be translated into UINT_MAX fails the size check. s390, ppc64le use definition in /usr/include/asm-generic/posix_types.h

BTW do you test LTP syscalls on s930 and ppc (32bit)?

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

Hi Petr,

Quoted 8 lines · Petr Vorel

Hi Ping,

Quoted 1 line

__kernel_old_uid_t is not defined as 16bit on s390, ppc64le

I suppose limitation on s390 is because __kernel_old_uid_t is guarded only for
kernel, right?

Yes, userspace header will use definition in
/usr/include/asm-generic/posix_types.h
unsigned int break the size check.

Quoted 8 lines

arch/s390/include/uapi/asm/posix_types.h
#ifdef __KERNEL__
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
#define __kernel_old_uid_t __kernel_old_uid_t
#endif

Quoted 4 lines
Quoted 2 lines

Then -1 will be translated into UINT_MAX fails the size check. s390, ppc64le use definition in /usr/include/asm-generic/posix_types.h

BTW do you test LTP syscalls on s930 and ppc (32bit)?

I don't have these machines at hand.

Quoted 5 lines

Kind regards,
Petr

Signature · 6 lines
*--*
Thanks & Regards,
*Ping Fang*

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi Ping,

Quoted 10 lines
Quoted 5 lines
Quoted 1 line

__kernel_old_uid_t is not defined as 16bit on s390, ppc64le

I suppose limitation on s390 is because __kernel_old_uid_t is guarded only for
kernel, right?

Yes, userspace header will use definition in
/usr/include/asm-generic/posix_types.h
unsigned int break the size check.

Thanks for additional info.

Quoted 7 lines
Quoted 6 lines

arch/s390/include/uapi/asm/posix_types.h
#ifdef __KERNEL__
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;
#define __kernel_old_uid_t __kernel_old_uid_t
#endif

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

Then -1 will be translated into UINT_MAX fails the size check. s390, ppc64le use definition in /usr/include/asm-generic/posix_types.h

BTW do you test LTP syscalls on s930 and ppc (32bit)?

I don't have these machines at hand.

Ah, I see it's broken on 64bit (not many people have 32bit for s390 or ppc).

Merged, thank you!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp