Skip to contentSkip to conversation

selftests: openat2: Fix testing failure for O_LARGEFILE flag

PATCH Superseded Baolin Wang 4 participants 10 messages Jul 28, 2021 – Aug 25, 2021 Kselftest

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: openat2: Fix testing failure for O_LARGEFILE flag

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

---
 tools/testing/selftests/openat2/openat2_test.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/openat2/openat2_test.c +4 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
  * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
  */
 #undef	O_LARGEFILE
+#ifdef __aarch64__
+#define	O_LARGEFILE 0x20000
+#else
 #define	O_LARGEFILE 0x8000
+#endif
 
 struct open_how_ext {
 	struct open_how inner;
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)
not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)
Quoted 23 lines
---
  tools/testing/selftests/openat2/openat2_test.c | 4 ++++
  1 file changed, 4 insertions(+)
tools/testing/selftests/openat2/openat2_test.c +4 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
   * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
   */
  #undef	O_LARGEFILE
+#ifdef __aarch64__
+#define	O_LARGEFILE 0x20000
+#else
  #define	O_LARGEFILE 0x8000
+#endif
 
  struct open_how_ext {
  	struct open_how inner;
#2 lore raw

Hi Shuah,

Quoted 13 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)
not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)
Quoted 2 lines

Could you apply this patch if no objection from your side? Thanks.

Quoted 20 lines
Quoted 20 lines

---
  tools/testing/selftests/openat2/openat2_test.c | 4 ++++

  1 file changed, 4 insertions(+)
tools/testing/selftests/openat2/openat2_test.c +4 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
    * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
    */
   #undef    O_LARGEFILE
+#ifdef __aarch64__
+#define    O_LARGEFILE 0x20000
+#else
   #define    O_LARGEFILE 0x8000
+#endif
   struct open_how_ext {
       struct open_how inner;
 
maintainer
#3 lore raw

Hi Baolin,

Quoted 11 lines · Baolin Wang

Hi Shuah,

Quoted 8 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please cc everybody get_maintainers.pl suggests. You are missing key reviewers for this change.

Adding Christian Brauner and Aleksa Sarai to the thread.

Quoted 1 line
Quoted 1 line
# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)

Not sure I understand this. 208000 (!= 208000) look sthe same to me.

Quoted 7 lines
Quoted 4 lines

not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)

Quoted 2 lines

Could you apply this patch if no objection from your side? Thanks.

Ideally this define should come from an include file.

Christian, Aleksa,

Can you review this patch and let me know if this approach looks right.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---
  tools/testing/selftests/openat2/openat2_test.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +0 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
    * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
    */
   #undef    O_LARGEFILE
Quoted 8 lines

tools/testing/selftests/openat2/openat2_test.c

Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +4 -0
+#ifdef __aarch64__
+#define    O_LARGEFILE 0x20000
+#else
   #define    O_LARGEFILE 0x8000
+#endif
   struct open_how_ext {
       struct open_how inner;
 

thanks,
-- Shuah

#4 lore raw

Hi Shuah,

Quoted 12 lines · Shuah Khan

Hi Baolin,

Quoted 9 lines · Baolin Wang

Hi Shuah,

Quoted 6 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Sorry, I forgot to copy the failure log:

Please cc everybody get_maintainers.pl suggests. You are missing key reviewers for this change.

Adding Christian Brauner and Aleksa Sarai to the thread.

Thanks.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)

Not sure I understand this. 208000 (!= 208000) look sthe same to me.

These are not the error message, just show the fd flags. The error is it should return -22 (-EINVAL) for this test case, but it returns 3 which indicates a successful openat2() calling.

Quoted 38 lines
Quoted 7 lines
Quoted 4 lines

not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)

Quoted 2 lines

Could you apply this patch if no objection from your side? Thanks.

Ideally this define should come from an include file.

Christian, Aleksa,

Can you review this patch and let me know if this approach looks right.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---
  tools/testing/selftests/openat2/openat2_test.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +0 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
    * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
    */
   #undef    O_LARGEFILE
Quoted 8 lines

tools/testing/selftests/openat2/openat2_test.c

Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +4 -0
+#ifdef __aarch64__
+#define    O_LARGEFILE 0x20000
+#else
   #define    O_LARGEFILE 0x8000
+#endif
   struct open_how_ext {
       struct open_how inner;
 

thanks,
-- Shuah

Reviewed-by
#5 lore raw
In reply to Shuah Khan
Quoted 27 lines · Shuah Khan

Hi Baolin,

Quoted 11 lines · Baolin Wang

Hi Shuah,

Quoted 8 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please cc everybody get_maintainers.pl suggests. You are missing key reviewers for this change.

Adding Christian Brauner and Aleksa Sarai to the thread.

Quoted 1 line
Quoted 1 line
# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)

Not sure I understand this. 208000 (!= 208000) look sthe same to me.

Quoted 3 lines
Quoted 3 lines

not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)

Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Could you apply this patch if no objection from your side? Thanks.

Ideally this define should come from an include file.

The issue is that O_LARGEFILE is set to 0 by glibc because glibc appears to hide the nuts and bolts of largefile support from userspace. I couldn't find a nice way of doing a architecture-dependent includes of include/uapi from kselftests, so I just went with this instead -- but I agree that a proper include would be better if someone can figure out how to do it.

Quoted 3 lines

Christian, Aleksa,

Can you review this patch and let me know if this approach looks right.

It'd be nice to fix this for the other architectures I mention in the comment (mips, parisc, powerpc, sparc) -- which are the ones that I could find that had a custom O_LARGEFILE definition.

Quoted 24 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

---
  tools/testing/selftests/openat2/openat2_test.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +0 -0
index d7ec1e7..1bddbe9 100644
@@ -22,7 +22,11 @@
    * XXX: This is wrong on {mips, parisc, powerpc, sparc}.
    */
   #undef    O_LARGEFILE
Quoted 8 lines

tools/testing/selftests/openat2/openat2_test.c

Quoted 8 lines
tools/testing/selftests/openat2/openat2_test.c +4 -0
+#ifdef __aarch64__
+#define    O_LARGEFILE 0x20000
+#else
   #define    O_LARGEFILE 0x8000
+#endif
   struct open_how_ext {
       struct open_how inner;
 

thanks,
-- Shuah

Signature · 4 lines
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>
#6 lore raw
Quoted 33 lines · Aleksa Sarai
Quoted 32 lines · Shuah Khan

Hi Baolin,

Quoted 11 lines · Baolin Wang

Hi Shuah,

Quoted 8 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please cc everybody get_maintainers.pl suggests. You are missing key reviewers for this change.

Adding Christian Brauner and Aleksa Sarai to the thread.

Quoted 1 line
Quoted 1 line
# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)

Not sure I understand this. 208000 (!= 208000) look sthe same to me.

Quoted 7 lines
Quoted 4 lines

not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)

Quoted 2 lines

Could you apply this patch if no objection from your side? Thanks.

Quoted 8 lines
Quoted 1 line

Ideally this define should come from an include file.

The issue is that O_LARGEFILE is set to 0 by glibc because glibc appears to hide the nuts and bolts of largefile support from userspace. I couldn't find a nice way of doing a architecture-dependent includes of include/uapi from kselftests, so I just went with this instead -- but I agree that a proper include would be better if someone can figure out how to do it.

I'd just add arch-dependent defines for now and call it good. So seems good enough for me:

Thanks!

Quoted 6 lines
Quoted 4 lines

Christian, Aleksa,

Can you review this patch and let me know if this approach looks right.

maintainer
#7 lore raw
Quoted 34 lines · Christian Brauner
Quoted 33 lines · Aleksa Sarai
Quoted 32 lines · Shuah Khan

Hi Baolin,

Quoted 11 lines · Baolin Wang

Hi Shuah,

Quoted 8 lines · Baolin Wang

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please cc everybody get_maintainers.pl suggests. You are missing key reviewers for this change.

Adding Christian Brauner and Aleksa Sarai to the thread.

Quoted 1 line
Quoted 1 line
# openat2 unexpectedly returned # 3['/lkp/benchmarks/kernel_selftests/tools/testing/selftests/openat2'] with 208000 (!= 208000)

Not sure I understand this. 208000 (!= 208000) look sthe same to me.

Quoted 7 lines
Quoted 4 lines

not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails with -22 (Invalid argument)

Quoted 2 lines

Could you apply this patch if no objection from your side? Thanks.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

Ideally this define should come from an include file.

The issue is that O_LARGEFILE is set to 0 by glibc because glibc appears to hide the nuts and bolts of largefile support from userspace. I couldn't find a nice way of doing a architecture-dependent includes of include/uapi from kselftests, so I just went with this instead -- but I agree that a proper include would be better if someone can figure out how to do it.

From a quick look, it will take sone work to consolidate multiple O_LARGEFILE defines.

Quoted 12 lines

I'd just add arch-dependent defines for now and call it good. So seems good enough for me:

Thanks!

Quoted 6 lines
Quoted 4 lines

Christian, Aleksa,

Can you review this patch and let me know if this approach looks right.

Thank you for the patch and the reviews. I will apply this for 5.15-rc1

thanks,
-- Shuah

maintainer
#8 lore raw
Quoted 9 lines · Shuah Khan
Quoted 8 lines · Christian Brauner
Quoted 7 lines · Aleksa Sarai
Quoted 6 lines · Shuah Khan

Hi Baolin,

Quoted 3 lines · Baolin Wang

Hi Shuah,

On 2021/7/28 20:32, Baolin Wang wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi,

Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please send me v2 with failure log included in the commit log.

thanks,
-- Shuah

#9 lore raw
Quoted 12 lines · Shuah Khan
Quoted 11 lines · Shuah Khan
Quoted 10 lines · Christian Brauner
Quoted 9 lines · Aleksa Sarai
Quoted 8 lines · Shuah Khan

Hi Baolin,

Quoted 5 lines · Baolin Wang

Hi Shuah,

Quoted 2 lines · Baolin Wang

Hi,

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

When running the openat2 test suite on ARM64 platform, we got below failure, since the definition of the O_LARGEFILE is different on ARM64. So we can set the correct O_LARGEFILE definition on ARM64 to fix this issue.

Sorry, I forgot to copy the failure log:

Please send me v2 with failure log included in the commit log.

Sure. Thanks for reviewing.