[PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition

Pierrick Bouvier posted 1 patch 3 weeks, 5 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260113194029.1691393-1-pierrick.bouvier@linaro.org
Maintainers: Laurent Vivier <laurent@vivier.eu>
linux-user/aarch64/target_fcntl.h | 1 +
1 file changed, 1 insertion(+)
[PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Pierrick Bouvier 3 weeks, 5 days ago
This caused a failure with program using openat2, where O_LARGEFILE was
replaced by O_NOFOLLOW.
This issue is only visible when QEMU is compiled with musl libc, where
O_LARGEFILE is different from 0 (vs glibc).

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 linux-user/aarch64/target_fcntl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
index efdf6e5f058..55ab788a7ce 100644
--- a/linux-user/aarch64/target_fcntl.h
+++ b/linux-user/aarch64/target_fcntl.h
@@ -11,6 +11,7 @@
 #define TARGET_O_DIRECTORY      040000 /* must be a directory */
 #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
 #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
+#define TARGET_O_LARGEFILE     0400000
 
 #include "../generic/fcntl.h"
 #endif
-- 
2.47.3
Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Pierrick Bouvier 3 weeks, 3 days ago
On 1/13/26 11:40 AM, Pierrick Bouvier wrote:
> This caused a failure with program using openat2, where O_LARGEFILE was
> replaced by O_NOFOLLOW.
> This issue is only visible when QEMU is compiled with musl libc, where
> O_LARGEFILE is different from 0 (vs glibc).
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   linux-user/aarch64/target_fcntl.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
> index efdf6e5f058..55ab788a7ce 100644
> --- a/linux-user/aarch64/target_fcntl.h
> +++ b/linux-user/aarch64/target_fcntl.h
> @@ -11,6 +11,7 @@
>   #define TARGET_O_DIRECTORY      040000 /* must be a directory */
>   #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
>   #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
> +#define TARGET_O_LARGEFILE     0400000
>   
>   #include "../generic/fcntl.h"
>   #endif

Michael, any chance you could pull this as part of one of your series 
for linux-user?

Regards,
Pierrick
Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Michael Tokarev 3 weeks, 5 days ago
On 1/13/26 22:40, Pierrick Bouvier wrote:
> This caused a failure with program using openat2, where O_LARGEFILE was
> replaced by O_NOFOLLOW.
> This issue is only visible when QEMU is compiled with musl libc, where
> O_LARGEFILE is different from 0 (vs glibc).
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   linux-user/aarch64/target_fcntl.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
> index efdf6e5f058..55ab788a7ce 100644
> --- a/linux-user/aarch64/target_fcntl.h
> +++ b/linux-user/aarch64/target_fcntl.h
> @@ -11,6 +11,7 @@
>   #define TARGET_O_DIRECTORY      040000 /* must be a directory */
>   #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
>   #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
> +#define TARGET_O_LARGEFILE     0400000
>   
>   #include "../generic/fcntl.h"
>   #endif

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

Heck.  I was this >< close to discovering this :))

Thanks,

/mjt
Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 1/13/26 1:53 PM, Michael Tokarev wrote:
> On 1/13/26 22:40, Pierrick Bouvier wrote:
>> This caused a failure with program using openat2, where O_LARGEFILE was
>> replaced by O_NOFOLLOW.
>> This issue is only visible when QEMU is compiled with musl libc, where
>> O_LARGEFILE is different from 0 (vs glibc).
>>
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    linux-user/aarch64/target_fcntl.h | 1 +
>>    1 file changed, 1 insertion(+)
>>
>> diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
>> index efdf6e5f058..55ab788a7ce 100644
>> --- a/linux-user/aarch64/target_fcntl.h
>> +++ b/linux-user/aarch64/target_fcntl.h
>> @@ -11,6 +11,7 @@
>>    #define TARGET_O_DIRECTORY      040000 /* must be a directory */
>>    #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
>>    #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
>> +#define TARGET_O_LARGEFILE     0400000
>>    
>>    #include "../generic/fcntl.h"
>>    #endif
> 
> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> Heck.  I was this >< close to discovering this :))
> 
> Thanks,
> 
> /mjt

Given that we both took a look at this, and the original bug reporter 
also, I think it can be considered as a shared "discovery" :).
Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Philippe Mathieu-Daudé 3 weeks, 5 days ago
On 13/1/26 20:40, Pierrick Bouvier wrote:
> This caused a failure with program using openat2, where O_LARGEFILE was
> replaced by O_NOFOLLOW.
> This issue is only visible when QEMU is compiled with musl libc, where
> O_LARGEFILE is different from 0 (vs glibc).
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   linux-user/aarch64/target_fcntl.h | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 1/13/26 11:40 AM, Pierrick Bouvier wrote:
> This caused a failure with program using openat2, where O_LARGEFILE was
> replaced by O_NOFOLLOW.
> This issue is only visible when QEMU is compiled with musl libc, where
> O_LARGEFILE is different from 0 (vs glibc).
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   linux-user/aarch64/target_fcntl.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
> index efdf6e5f058..55ab788a7ce 100644
> --- a/linux-user/aarch64/target_fcntl.h
> +++ b/linux-user/aarch64/target_fcntl.h
> @@ -11,6 +11,7 @@
>   #define TARGET_O_DIRECTORY      040000 /* must be a directory */
>   #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
>   #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
> +#define TARGET_O_LARGEFILE     0400000
>   
>   #include "../generic/fcntl.h"
>   #endif

As well, I double checked all the flags for all arch compared to 
upstream Linux headers, and it was the only mismatch.
Re: [PATCH] linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
Posted by Pierrick Bouvier 3 weeks, 5 days ago
On 1/13/26 11:40 AM, Pierrick Bouvier wrote:
> This caused a failure with program using openat2, where O_LARGEFILE was
> replaced by O_NOFOLLOW.
> This issue is only visible when QEMU is compiled with musl libc, where
> O_LARGEFILE is different from 0 (vs glibc).
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   linux-user/aarch64/target_fcntl.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/aarch64/target_fcntl.h b/linux-user/aarch64/target_fcntl.h
> index efdf6e5f058..55ab788a7ce 100644
> --- a/linux-user/aarch64/target_fcntl.h
> +++ b/linux-user/aarch64/target_fcntl.h
> @@ -11,6 +11,7 @@
>   #define TARGET_O_DIRECTORY      040000 /* must be a directory */
>   #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
>   #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
> +#define TARGET_O_LARGEFILE     0400000
>   
>   #include "../generic/fcntl.h"
>   #endif

This is a good candidate for all stable branches as well.

Regards,
Pierrick