linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls
@ 2019-08-29 11:18 Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32 Vincenzo Frascino
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

This patch series is a follow up to "lib/vdso, x86/vdso: Fix fallout
from generic VDSO conversion" [1].

The main purpose is to complete the 32bit vDSOs conversion to use the
legacy 32bit syscalls as a fallback. With the conversion of all the
architectures present in -next complete, this patch series removes as
well the conditional choice in between 32 and 64 bit for 32bit vDSOs.

This series has been rebased on linux-next/master.

[1] https://lkml.org/lkml/2019/7/28/86

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Vincenzo Frascino (7):
  arm64: compat: vdso: Expose BUILD_VDSO32
  lib: vdso: Build 32 bit specific functions in the right context
  mips: compat: vdso: Use legacy syscalls as fallback
  lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK
  arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  mips: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  x86: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK

 .../include/asm/vdso/compat_gettimeofday.h    |  2 +-
 arch/mips/include/asm/vdso/gettimeofday.h     | 43 +++++++++++++++++++
 arch/mips/vdso/config-n32-o32-env.c           |  1 +
 arch/x86/include/asm/vdso/gettimeofday.h      |  2 -
 lib/vdso/gettimeofday.c                       | 14 ++----
 5 files changed, 49 insertions(+), 13 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-30 12:13   ` Catalin Marinas
  2019-08-29 11:18 ` [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context Vincenzo Frascino
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

clock_gettime32 and clock_getres_time32 should be compiled only with the
32 bit vdso library.

Expose BUILD_VDSO32 when arm64 compat is compiled, to provide an
indication to the generic library to include these symbols.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/vdso/compat_gettimeofday.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
index c50ee1b7d5cd..fe7afe0f1a3d 100644
--- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
@@ -17,6 +17,7 @@
 #define VDSO_HAS_CLOCK_GETRES		1
 
 #define VDSO_HAS_32BIT_FALLBACK		1
+#define BUILD_VDSO32			1
 
 static __always_inline
 int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32 Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-29 15:23   ` Andy Lutomirski
  2019-08-29 11:18 ` [PATCH 3/7] mips: compat: vdso: Use legacy syscalls as fallback Vincenzo Frascino
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

clock_gettime32 and clock_getres_time32 should be compiled only with a
32 bit vdso library.

Exclude these symbols when BUILD_VDSO32 is not defined.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 lib/vdso/gettimeofday.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index e630e7ff57f1..a86e89e6dedc 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -117,6 +117,7 @@ __cvdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
 	return 0;
 }
 
+#ifdef BUILD_VDSO32
 static __maybe_unused int
 __cvdso_clock_gettime32(clockid_t clock, struct old_timespec32 *res)
 {
@@ -139,6 +140,7 @@ __cvdso_clock_gettime32(clockid_t clock, struct old_timespec32 *res)
 	}
 	return ret;
 }
+#endif /* BUILD_VDSO32 */
 
 static __maybe_unused int
 __cvdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
@@ -229,6 +231,7 @@ int __cvdso_clock_getres(clockid_t clock, struct __kernel_timespec *res)
 	return 0;
 }
 
+#ifdef BUILD_VDSO32
 static __maybe_unused int
 __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res)
 {
@@ -251,4 +254,5 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res)
 	}
 	return ret;
 }
+#endif /* BUILD_VDSO32 */
 #endif /* VDSO_HAS_CLOCK_GETRES */
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/7] mips: compat: vdso: Use legacy syscalls as fallback
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32 Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

The generic VDSO implementation uses the Y2038 safe clock_gettime64() and
clock_getres_time64() syscalls as fallback for 32bit VDSO. This breaks
seccomp setups because these syscalls might be not (yet) allowed.

Implement the 32bit variants which use the legacy syscalls and select the
variant in the core library.

The 64bit time variants are not removed because they are required for the
time64 based vdso accessors.

Cc: Paul Burton <paul.burton@mips.com>
Fixes: 00b26474c2f1 ("lib/vdso: Provide generic VDSO implementation")
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/mips/include/asm/vdso/gettimeofday.h | 45 +++++++++++++++++++++++
 arch/mips/vdso/config-n32-o32-env.c       |  1 +
 2 files changed, 46 insertions(+)

diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
index c59fe08b0347..e78462e8ca2e 100644
--- a/arch/mips/include/asm/vdso/gettimeofday.h
+++ b/arch/mips/include/asm/vdso/gettimeofday.h
@@ -105,6 +105,51 @@ static __always_inline int clock_getres_fallback(
 	return error ? -ret : ret;
 }
 
+#if _MIPS_SIM != _MIPS_SIM_ABI64
+
+#define VDSO_HAS_32BIT_FALLBACK	1
+
+static __always_inline long clock_gettime32_fallback(
+					clockid_t _clkid,
+					struct old_timespec32 *_ts)
+{
+	register struct old_timespec32 *ts asm("a1") = _ts;
+	register clockid_t clkid asm("a0") = _clkid;
+	register long ret asm("v0");
+	register long nr asm("v0") = __NR_clock_gettime;
+	register long error asm("a3");
+
+	asm volatile(
+	"       syscall\n"
+	: "=r" (ret), "=r" (error)
+	: "r" (clkid), "r" (ts), "r" (nr)
+	: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+	  "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+
+	return error ? -ret : ret;
+}
+
+static __always_inline int clock_getres32_fallback(
+					clockid_t _clkid,
+					struct old_timespec32 *_ts)
+{
+	register struct old_timespec32 *ts asm("a1") = _ts;
+	register clockid_t clkid asm("a0") = _clkid;
+	register long ret asm("v0");
+	register long nr asm("v0") = __NR_clock_getres;
+	register long error asm("a3");
+
+	asm volatile(
+	"       syscall\n"
+	: "=r" (ret), "=r" (error)
+	: "r" (clkid), "r" (ts), "r" (nr)
+	: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
+	  "$14", "$15", "$24", "$25", "hi", "lo", "memory");
+
+	return error ? -ret : ret;
+}
+#endif
+
 #ifdef CONFIG_CSRC_R4K
 
 static __always_inline u64 read_r4k_count(void)
diff --git a/arch/mips/vdso/config-n32-o32-env.c b/arch/mips/vdso/config-n32-o32-env.c
index 7f8d957abd4a..0011a632aef2 100644
--- a/arch/mips/vdso/config-n32-o32-env.c
+++ b/arch/mips/vdso/config-n32-o32-env.c
@@ -10,6 +10,7 @@
  */
 #undef CONFIG_64BIT
 
+#define BUILD_VDSO32
 #define CONFIG_32BIT 1
 #define CONFIG_GENERIC_ATOMIC64 1
 #define BUILD_VDSO32_64
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
                   ` (2 preceding siblings ...)
  2019-08-29 11:18 ` [PATCH 3/7] mips: compat: vdso: Use legacy syscalls as fallback Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-29 15:25   ` Andy Lutomirski
  2019-08-29 11:18 ` [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

VDSO_HAS_32BIT_FALLBACK was introduced to address a regression which
caused seccomp to deny access to the applications to clock_gettime64()
and clock_getres64() because they are not enabled in the existing
filters.

The purpose of VDSO_HAS_32BIT_FALLBACK was to simplify the conditional
implementation of __cvdso_clock_get*time32() variants.

Now that all the architectures that support the generic vDSO library
have been converted to support the 32 bit fallbacks the conditional
can be removed.

Cc: Thomas Gleixner <tglx@linutronix.de>
CC: Andy Lutomirski <luto@kernel.org>
References: c60a32ea4f45 ("lib/vdso/32: Provide legacy syscall fallbacks")
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 lib/vdso/gettimeofday.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
index a86e89e6dedc..2c4b311c226d 100644
--- a/lib/vdso/gettimeofday.c
+++ b/lib/vdso/gettimeofday.c
@@ -126,13 +126,8 @@ __cvdso_clock_gettime32(clockid_t clock, struct old_timespec32 *res)
 
 	ret = __cvdso_clock_gettime_common(clock, &ts);
 
-#ifdef VDSO_HAS_32BIT_FALLBACK
 	if (unlikely(ret))
 		return clock_gettime32_fallback(clock, res);
-#else
-	if (unlikely(ret))
-		ret = clock_gettime_fallback(clock, &ts);
-#endif
 
 	if (likely(!ret)) {
 		res->tv_sec = ts.tv_sec;
@@ -240,13 +235,8 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res)
 
 	ret = __cvdso_clock_getres_common(clock, &ts);
 
-#ifdef VDSO_HAS_32BIT_FALLBACK
 	if (unlikely(ret))
 		return clock_getres32_fallback(clock, res);
-#else
-	if (unlikely(ret))
-		ret = clock_getres_fallback(clock, &ts);
-#endif
 
 	if (likely(!ret)) {
 		res->tv_sec = ts.tv_sec;
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
                   ` (3 preceding siblings ...)
  2019-08-29 11:18 ` [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-29 12:21   ` Thomas Gleixner
  2019-08-30 12:13   ` Catalin Marinas
  2019-08-29 11:18 ` [PATCH 6/7] mips: " Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 7/7] x86: " Vincenzo Frascino
  6 siblings, 2 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove
VDSO_HAS_32BIT_FALLBACK") VDSO_HAS_32BIT_FALLBACK define is not
required anymore hence can be removed.

Remove unused VDSO_HAS_32BIT_FALLBACK from arm64 compat vdso.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/arm64/include/asm/vdso/compat_gettimeofday.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
index fe7afe0f1a3d..537b1e695365 100644
--- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
@@ -16,7 +16,6 @@
 
 #define VDSO_HAS_CLOCK_GETRES		1
 
-#define VDSO_HAS_32BIT_FALLBACK		1
 #define BUILD_VDSO32			1
 
 static __always_inline
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/7] mips: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
                   ` (4 preceding siblings ...)
  2019-08-29 11:18 ` [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  2019-08-29 11:18 ` [PATCH 7/7] x86: " Vincenzo Frascino
  6 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove
VDSO_HAS_32BIT_FALLBACK") VDSO_HAS_32BIT_FALLBACK define is not
required anymore hence can be removed.

Remove unused VDSO_HAS_32BIT_FALLBACK from mips vdso.

Cc: Paul Burton <paul.burton@mips.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/mips/include/asm/vdso/gettimeofday.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
index e78462e8ca2e..5ad2b086626d 100644
--- a/arch/mips/include/asm/vdso/gettimeofday.h
+++ b/arch/mips/include/asm/vdso/gettimeofday.h
@@ -107,8 +107,6 @@ static __always_inline int clock_getres_fallback(
 
 #if _MIPS_SIM != _MIPS_SIM_ABI64
 
-#define VDSO_HAS_32BIT_FALLBACK	1
-
 static __always_inline long clock_gettime32_fallback(
 					clockid_t _clkid,
 					struct old_timespec32 *_ts)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/7] x86: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
                   ` (5 preceding siblings ...)
  2019-08-29 11:18 ` [PATCH 6/7] mips: " Vincenzo Frascino
@ 2019-08-29 11:18 ` Vincenzo Frascino
  6 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 11:18 UTC (permalink / raw)
  To: linux-arch, linux-arm-kernel, linux-kernel, linux-mips
  Cc: catalin.marinas, will, paul.burton, tglx, salyzyn, 0x7f454c46, luto

As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove
VDSO_HAS_32BIT_FALLBACK") VDSO_HAS_32BIT_FALLBACK define is not
required anymore hence can be removed.

Remove unused VDSO_HAS_32BIT_FALLBACK from x86 vdso.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/x86/include/asm/vdso/gettimeofday.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/include/asm/vdso/gettimeofday.h b/arch/x86/include/asm/vdso/gettimeofday.h
index e9ee139cf29e..52c3bcd672cf 100644
--- a/arch/x86/include/asm/vdso/gettimeofday.h
+++ b/arch/x86/include/asm/vdso/gettimeofday.h
@@ -96,8 +96,6 @@ long clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 
 #else
 
-#define VDSO_HAS_32BIT_FALLBACK	1
-
 static __always_inline
 long clock_gettime_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
 {
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 ` [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
@ 2019-08-29 12:21   ` Thomas Gleixner
  2019-08-29 15:52     ` Vincenzo Frascino
  2019-08-30 12:13   ` Catalin Marinas
  1 sibling, 1 reply; 16+ messages in thread
From: Thomas Gleixner @ 2019-08-29 12:21 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, linux-kernel, linux-mips,
	catalin.marinas, will, paul.burton, salyzyn, 0x7f454c46, luto

On Thu, 29 Aug 2019, Vincenzo Frascino wrote:

> As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove

-ENOSUCH commit ....

Just say:

VDSO_HAS_32BIT_FALLBACK has been removed from the core ....

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context
  2019-08-29 11:18 ` [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context Vincenzo Frascino
@ 2019-08-29 15:23   ` Andy Lutomirski
  2019-08-29 15:48     ` Vincenzo Frascino
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Lutomirski @ 2019-08-29 15:23 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, LKML, linux-mips, Catalin Marinas,
	Will Deacon, Paul Burton, Thomas Gleixner, Mark Salyzyn,
	Dmitry Safonov, Andrew Lutomirski

On Thu, Aug 29, 2019 at 4:19 AM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> clock_gettime32 and clock_getres_time32 should be compiled only with a
> 32 bit vdso library.
>
> Exclude these symbols when BUILD_VDSO32 is not defined.

Reviewed-by: Andy Lutomirski <luto@kernel.org>

BTW, this is a great patch: it's either correct or it won't build.  I
like patches like that.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 ` [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
@ 2019-08-29 15:25   ` Andy Lutomirski
  2019-08-29 15:51     ` Vincenzo Frascino
  0 siblings, 1 reply; 16+ messages in thread
From: Andy Lutomirski @ 2019-08-29 15:25 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, LKML, linux-mips, Catalin Marinas,
	Will Deacon, Paul Burton, Thomas Gleixner, Mark Salyzyn,
	Dmitry Safonov, Andrew Lutomirski

On Thu, Aug 29, 2019 at 4:19 AM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
>
> VDSO_HAS_32BIT_FALLBACK was introduced to address a regression which
> caused seccomp to deny access to the applications to clock_gettime64()
> and clock_getres64() because they are not enabled in the existing
> filters.
>
> The purpose of VDSO_HAS_32BIT_FALLBACK was to simplify the conditional
> implementation of __cvdso_clock_get*time32() variants.
>
> Now that all the architectures that support the generic vDSO library
> have been converted to support the 32 bit fallbacks the conditional
> can be removed.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> CC: Andy Lutomirski <luto@kernel.org>
> References: c60a32ea4f45 ("lib/vdso/32: Provide legacy syscall fallbacks")
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>  lib/vdso/gettimeofday.c | 10 ----------
>  1 file changed, 10 deletions(-)
>
> diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
> index a86e89e6dedc..2c4b311c226d 100644
> --- a/lib/vdso/gettimeofday.c
> +++ b/lib/vdso/gettimeofday.c
> @@ -126,13 +126,8 @@ __cvdso_clock_gettime32(clockid_t clock, struct old_timespec32 *res)
>
>         ret = __cvdso_clock_gettime_common(clock, &ts);
>
> -#ifdef VDSO_HAS_32BIT_FALLBACK
>         if (unlikely(ret))
>                 return clock_gettime32_fallback(clock, res);
> -#else
> -       if (unlikely(ret))
> -               ret = clock_gettime_fallback(clock, &ts);
> -#endif
>
>         if (likely(!ret)) {
>                 res->tv_sec = ts.tv_sec;

I think you could have a little follow-up patch to remove the if
statement -- by the time you get here, it's guaranteed that ret == 0.

--Andy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context
  2019-08-29 15:23   ` Andy Lutomirski
@ 2019-08-29 15:48     ` Vincenzo Frascino
  0 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 15:48 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: linux-arch, linux-arm-kernel, LKML, linux-mips, Catalin Marinas,
	Will Deacon, Paul Burton, Thomas Gleixner, Mark Salyzyn,
	Dmitry Safonov

On 29/08/2019 16:23, Andy Lutomirski wrote:
> On Thu, Aug 29, 2019 at 4:19 AM Vincenzo Frascino
> <vincenzo.frascino@arm.com> wrote:
>>
>> clock_gettime32 and clock_getres_time32 should be compiled only with a
>> 32 bit vdso library.
>>
>> Exclude these symbols when BUILD_VDSO32 is not defined.
> 
> Reviewed-by: Andy Lutomirski <luto@kernel.org>
> 
> BTW, this is a great patch: it's either correct or it won't build.  I
> like patches like that.
> 

Thanks :)

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK
  2019-08-29 15:25   ` Andy Lutomirski
@ 2019-08-29 15:51     ` Vincenzo Frascino
  0 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 15:51 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: linux-arch, linux-arm-kernel, LKML, linux-mips, Catalin Marinas,
	Will Deacon, Paul Burton, Thomas Gleixner, Mark Salyzyn,
	Dmitry Safonov

On 29/08/2019 16:25, Andy Lutomirski wrote:
> On Thu, Aug 29, 2019 at 4:19 AM Vincenzo Frascino
> <vincenzo.frascino@arm.com> wrote:
>>
>> VDSO_HAS_32BIT_FALLBACK was introduced to address a regression which
>> caused seccomp to deny access to the applications to clock_gettime64()
>> and clock_getres64() because they are not enabled in the existing
>> filters.
>>
>> The purpose of VDSO_HAS_32BIT_FALLBACK was to simplify the conditional
>> implementation of __cvdso_clock_get*time32() variants.
>>
>> Now that all the architectures that support the generic vDSO library
>> have been converted to support the 32 bit fallbacks the conditional
>> can be removed.
>>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> CC: Andy Lutomirski <luto@kernel.org>
>> References: c60a32ea4f45 ("lib/vdso/32: Provide legacy syscall fallbacks")
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
>> ---
>>  lib/vdso/gettimeofday.c | 10 ----------
>>  1 file changed, 10 deletions(-)
>>
>> diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c
>> index a86e89e6dedc..2c4b311c226d 100644
>> --- a/lib/vdso/gettimeofday.c
>> +++ b/lib/vdso/gettimeofday.c
>> @@ -126,13 +126,8 @@ __cvdso_clock_gettime32(clockid_t clock, struct old_timespec32 *res)
>>
>>         ret = __cvdso_clock_gettime_common(clock, &ts);
>>
>> -#ifdef VDSO_HAS_32BIT_FALLBACK
>>         if (unlikely(ret))
>>                 return clock_gettime32_fallback(clock, res);
>> -#else
>> -       if (unlikely(ret))
>> -               ret = clock_gettime_fallback(clock, &ts);
>> -#endif
>>
>>         if (likely(!ret)) {
>>                 res->tv_sec = ts.tv_sec;
> 
> I think you could have a little follow-up patch to remove the if
> statement -- by the time you get here, it's guaranteed that ret == 0.
>

Thanks, I will add a new patch that does that to v2 (with a comment).

> --Andy
> 

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 12:21   ` Thomas Gleixner
@ 2019-08-29 15:52     ` Vincenzo Frascino
  0 siblings, 0 replies; 16+ messages in thread
From: Vincenzo Frascino @ 2019-08-29 15:52 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: linux-arch, linux-arm-kernel, linux-kernel, linux-mips,
	catalin.marinas, will, paul.burton, salyzyn, 0x7f454c46, luto

On 29/08/2019 13:21, Thomas Gleixner wrote:
> On Thu, 29 Aug 2019, Vincenzo Frascino wrote:
> 
>> As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove
> 
> -ENOSUCH commit ....
> 
> Just say:
> 
> VDSO_HAS_32BIT_FALLBACK has been removed from the core ....
>

Thanks Thomas, I will fix it in v2.

> Thanks,
> 
> 	tglx
> 

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32
  2019-08-29 11:18 ` [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32 Vincenzo Frascino
@ 2019-08-30 12:13   ` Catalin Marinas
  0 siblings, 0 replies; 16+ messages in thread
From: Catalin Marinas @ 2019-08-30 12:13 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, linux-kernel, linux-mips, will,
	paul.burton, tglx, salyzyn, 0x7f454c46, luto

On Thu, Aug 29, 2019 at 12:18:37PM +0100, Vincenzo Frascino wrote:
> clock_gettime32 and clock_getres_time32 should be compiled only with the
> 32 bit vdso library.
> 
> Expose BUILD_VDSO32 when arm64 compat is compiled, to provide an
> indication to the generic library to include these symbols.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK
  2019-08-29 11:18 ` [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
  2019-08-29 12:21   ` Thomas Gleixner
@ 2019-08-30 12:13   ` Catalin Marinas
  1 sibling, 0 replies; 16+ messages in thread
From: Catalin Marinas @ 2019-08-30 12:13 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arch, linux-arm-kernel, linux-kernel, linux-mips, will,
	paul.burton, tglx, salyzyn, 0x7f454c46, luto

On Thu, Aug 29, 2019 at 12:18:41PM +0100, Vincenzo Frascino wrote:
> As a consequence of Commit 623fa33f7bd6 ("lib:vdso: Remove
> VDSO_HAS_32BIT_FALLBACK") VDSO_HAS_32BIT_FALLBACK define is not
> required anymore hence can be removed.
> 
> Remove unused VDSO_HAS_32BIT_FALLBACK from arm64 compat vdso.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-08-30 12:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 11:18 [PATCH 0/7] vdso: Complete the conversion to 32bit syscalls Vincenzo Frascino
2019-08-29 11:18 ` [PATCH 1/7] arm64: compat: vdso: Expose BUILD_VDSO32 Vincenzo Frascino
2019-08-30 12:13   ` Catalin Marinas
2019-08-29 11:18 ` [PATCH 2/7] lib: vdso: Build 32 bit specific functions in the right context Vincenzo Frascino
2019-08-29 15:23   ` Andy Lutomirski
2019-08-29 15:48     ` Vincenzo Frascino
2019-08-29 11:18 ` [PATCH 3/7] mips: compat: vdso: Use legacy syscalls as fallback Vincenzo Frascino
2019-08-29 11:18 ` [PATCH 4/7] lib: vdso: Remove VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
2019-08-29 15:25   ` Andy Lutomirski
2019-08-29 15:51     ` Vincenzo Frascino
2019-08-29 11:18 ` [PATCH 5/7] arm64: compat: vdso: Remove unused VDSO_HAS_32BIT_FALLBACK Vincenzo Frascino
2019-08-29 12:21   ` Thomas Gleixner
2019-08-29 15:52     ` Vincenzo Frascino
2019-08-30 12:13   ` Catalin Marinas
2019-08-29 11:18 ` [PATCH 6/7] mips: " Vincenzo Frascino
2019-08-29 11:18 ` [PATCH 7/7] x86: " Vincenzo Frascino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).