[v4] Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)

Message ID 3c09e43a-b0e7-2be9-0301-2c8d25c6920e@linaro.org
State Dropped
Headers

Commit Message

Adhemerval Zanella Netto July 10, 2018, 12:28 p.m. UTC
  On 10/07/2018 03:31, Stefan Liebler wrote:
> On 07/09/2018 08:37 PM, Adhemerval Zanella wrote:
>>
>> So it seems that kernel between 4.13 through 4.15 have this issue with for
>> compat kernels and I do think it is a kernel issue because fcntl64 is the
>> expected way to use OFD locks.  GLIBC returns EOVERFLOW because from
>> application standpoint, it should use LFS variant instead.
>>
> Yes, I agree with you.
> Shall we document this kernel issue in the release-wiki and/or the testcase itself?
> 

I have added a note on 2.28 release wiki [1] about this potential failure
and if Carlos approves I would like to push the patch below.

[1] https://sourceware.org/glibc/wiki/Release/2.28

---

From aca2b996f3ba8fdf76e5e71e3868b701c5aa5c2b Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue, 10 Jul 2018 09:24:40 -0300
Subject: [PATCH] Comment tst-ofdlocks-compat expected failure in some Linux
 releases

As pointed out in a libc-alpha thread [1], the misc/tst-ofdlocks-compat
may fail in some specific Linux releases.  This patch adds a comment
along with a link to discussion in the test source code.

No changes are expected.

	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
	a kernel issue which lead to test failure in some cases.

[1] https://sourceware.org/ml/libc-alpha/2018-07/msg00243.html
---
 ChangeLog                                     | 5 +++++
 sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c | 8 ++++++++
 2 files changed, 13 insertions(+)
  

Comments

Carlos O'Donell July 10, 2018, 12:31 p.m. UTC | #1
On 07/10/2018 08:28 AM, Adhemerval Zanella wrote:
> 
> 
> On 10/07/2018 03:31, Stefan Liebler wrote:
>> On 07/09/2018 08:37 PM, Adhemerval Zanella wrote:
>>>
>>> So it seems that kernel between 4.13 through 4.15 have this issue with for
>>> compat kernels and I do think it is a kernel issue because fcntl64 is the
>>> expected way to use OFD locks.  GLIBC returns EOVERFLOW because from
>>> application standpoint, it should use LFS variant instead.
>>>
>> Yes, I agree with you.
>> Shall we document this kernel issue in the release-wiki and/or the testcase itself?
>>
> 
> I have added a note on 2.28 release wiki [1] about this potential failure
> and if Carlos approves I would like to push the patch below.

Note looks good. Please commit.

The compat for 32->64 has always had problems over the years and they often
take several releases to get ironed out.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> [1] https://sourceware.org/glibc/wiki/Release/2.28
> 
> ---
> 
> From aca2b996f3ba8fdf76e5e71e3868b701c5aa5c2b Mon Sep 17 00:00:00 2001
> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date: Tue, 10 Jul 2018 09:24:40 -0300
> Subject: [PATCH] Comment tst-ofdlocks-compat expected failure in some Linux
>  releases
> 
> As pointed out in a libc-alpha thread [1], the misc/tst-ofdlocks-compat
> may fail in some specific Linux releases.  This patch adds a comment
> along with a link to discussion in the test source code.
> 
> No changes are expected.
> 
> 	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
> 	a kernel issue which lead to test failure in some cases.
> 
> [1] https://sourceware.org/ml/libc-alpha/2018-07/msg00243.html
> ---
>  ChangeLog                                     | 5 +++++
>  sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c | 8 ++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 7a052c3..9c57396 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2018-07-10  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> +
> +	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
> +	a kernel issue which lead to test failure in some cases.
> +
>  2018-07-06  Florian Weimer  <fweimer@redhat.com>
>  
>  	[BZ #18991]
> diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> index d1d00eb..03c4abf 100644
> --- a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> +++ b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
> @@ -40,6 +40,14 @@ do_prepare (int argc, char **argv)
>  
>  #define PREPARE do_prepare
>  
> +/* Linux between 4.13 and 4.15 return EOVERFLOW for LFS OFD locks usage
> +   in compat mode (non-LFS ABI running on a LFS default kernel, such as
> +   i386 on a x86_64 kernel or s390-32 on a s390-64 kernel) [1].  This is
> +   a kernel issue because __NR_fcntl64 is the expected way to use OFD locks
> +   (used on GLIBC for both fcntl and fcntl64).
> +
> +   [1] https://sourceware.org/ml/libc-alpha/2018-07/msg00243.html  */
> +
>  static int
>  do_test (void)
>  {
>
  

Patch

diff --git a/ChangeLog b/ChangeLog
index 7a052c3..9c57396 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-07-10  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Add a comment about
+	a kernel issue which lead to test failure in some cases.
+
 2018-07-06  Florian Weimer  <fweimer@redhat.com>
 
 	[BZ #18991]
diff --git a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
index d1d00eb..03c4abf 100644
--- a/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
+++ b/sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c
@@ -40,6 +40,14 @@  do_prepare (int argc, char **argv)
 
 #define PREPARE do_prepare
 
+/* Linux between 4.13 and 4.15 return EOVERFLOW for LFS OFD locks usage
+   in compat mode (non-LFS ABI running on a LFS default kernel, such as
+   i386 on a x86_64 kernel or s390-32 on a s390-64 kernel) [1].  This is
+   a kernel issue because __NR_fcntl64 is the expected way to use OFD locks
+   (used on GLIBC for both fcntl and fcntl64).
+
+   [1] https://sourceware.org/ml/libc-alpha/2018-07/msg00243.html  */
+
 static int
 do_test (void)
 {