diff mbox series

[PULL,1/6] linux-user/sparc: Don't use 16-bit UIDs on SPARC V9

Message ID 20230330131856.94210-2-philmd@linaro.org
State Accepted
Commit baead642970602ec5ec935fc8e3653b5fa5f22fa
Headers show
Series [PULL,1/6] linux-user/sparc: Don't use 16-bit UIDs on SPARC V9 | expand

Commit Message

Philippe Mathieu-Daudé March 30, 2023, 1:18 p.m. UTC
The 64-bit SPARC V9 syscall ABI uses 32-bit UIDs. Only enable
the 16-bit UID wrappers for 32-bit SPARC (V7 and V8).

Possibly missed in commit 992f48a036 ("Support for 32 bit
ABI on 64 bit targets (only enabled Sparc64)").

Reported-by: Gregor Riepl <onitake@gmail.com>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Tested-by: Zach van Rijn <me@zv.io>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1394
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20230327131910.78564-1-philmd@linaro.org>
---
 linux-user/syscall_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Vivier May 12, 2023, 11:13 a.m. UTC | #1
On 3/30/23 15:18, Philippe Mathieu-Daudé wrote:
> The 64-bit SPARC V9 syscall ABI uses 32-bit UIDs. Only enable
> the 16-bit UID wrappers for 32-bit SPARC (V7 and V8).
> 
> Possibly missed in commit 992f48a036 ("Support for 32 bit
> ABI on 64 bit targets (only enabled Sparc64)").
> 
> Reported-by: Gregor Riepl <onitake@gmail.com>
> Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Tested-by: Zach van Rijn <me@zv.io>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1394
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Acked-by: Laurent Vivier <laurent@vivier.eu>
> Message-Id: <20230327131910.78564-1-philmd@linaro.org>
> ---
>   linux-user/syscall_defs.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 614a1cbc8e..cc37054cb5 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -61,7 +61,7 @@
>   
>   #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
>       || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
> -    || defined(TARGET_SPARC) \
> +    || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \
>       || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
>       /* 16 bit uid wrappers emulation */
>   #define USE_UID16

This patch breaks something with LTP (20230127) test fchown05_16 on sid/sparc64:

tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 702 701
fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 704
fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed
fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 705

expected result;

tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed

Thanks,
Laurent
John Paul Adrian Glaubitz May 12, 2023, 12:08 p.m. UTC | #2
Hello Laurent!

On Fri, 2023-05-12 at 13:13 +0200, Laurent Vivier wrote:
> This patch breaks something with LTP (20230127) test fchown05_16 on sid/sparc64:
> 
> tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
> fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
> fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 702 701
> fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
> fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 704
> fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
> fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed
> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 705
> 
> expected result;
> 
> tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
> fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
> fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
> fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
> fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
> fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
> fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed

Where do these tests reside? I'm not sure I know what LTP is. In any case,
the patch should be correct as QEMU needs to differentiate between 32-bit
and 64-bit SPARC.

Adrian
Laurent Vivier May 12, 2023, 3:43 p.m. UTC | #3
Le 12/05/2023 à 14:08, John Paul Adrian Glaubitz a écrit :
> Hello Laurent!
> 
> On Fri, 2023-05-12 at 13:13 +0200, Laurent Vivier wrote:
>> This patch breaks something with LTP (20230127) test fchown05_16 on sid/sparc64:
>>
>> tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
>> fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
>> fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
>> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 702 701
>> fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
>> fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
>> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 704
>> fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
>> fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed
>> fchown05.c:49: TFAIL: testfile: incorrect ownership set, expected 703 705
>>
>> expected result;
>>
>> tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
>> fchown05.c:44: TPASS: fchown(3, 700, 701), change owner/group ids passed
>> fchown05.c:44: TPASS: fchown(3, 702, -1), change owner id only passed
>> fchown05.c:44: TPASS: fchown(3, 703, 701), change owner id only passed
>> fchown05.c:44: TPASS: fchown(3, -1, 704), change group id only passed
>> fchown05.c:44: TPASS: fchown(3, 703, 705), change group id only passed
>> fchown05.c:44: TPASS: fchown(3, -1, -1), no change passed
> 
> Where do these tests reside? I'm not sure I know what LTP is. In any case,
> the patch should be correct as QEMU needs to differentiate between 32-bit
> and 64-bit SPARC.

I agree, it could be a side effect. I didn't check.

https://github.com/linux-test-project/ltp/releases/tag/20230127

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 614a1cbc8e..cc37054cb5 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -61,7 +61,7 @@ 
 
 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
     || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
-    || defined(TARGET_SPARC) \
+    || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \
     || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
     /* 16 bit uid wrappers emulation */
 #define USE_UID16