Re: [PATCH v3 22/23] powerpc/vdso: Migrate native signals to generic vdso_base

From: Christophe Leroy
Date: Thu Jun 17 2021 - 03:35:07 EST




Le 17/06/2021 à 08:36, Christophe Leroy a écrit :


Le 11/06/2021 à 20:02, Dmitry Safonov a écrit :
Generic way to track the land vma area.
Stat speaks for itself.

Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Signed-off-by: Dmitry Safonov <dima@xxxxxxxxxx>


Build failure:

  CC      arch/powerpc/kernel/asm-offsets.s
In file included from ./include/linux/mmzone.h:21,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/xarray.h:14,
                 from ./include/linux/radix-tree.h:19,
                 from ./include/linux/fs.h:15,
                 from ./include/linux/compat.h:17,
                 from arch/powerpc/kernel/asm-offsets.c:14:
./include/linux/mm_types.h: In function 'init_vdso_base':
./include/linux/mm_types.h:522:28: error: 'TASK_SIZE_MAX' undeclared (first use in this function); did you mean 'XATTR_SIZE_MAX'?
  522 | #define UNMAPPED_VDSO_BASE TASK_SIZE_MAX
      |                            ^~~~~~~~~~~~~
./include/linux/mm_types.h:627:40: note: in expansion of macro 'UNMAPPED_VDSO_BASE'
  627 |         mm->vdso_base = (void __user *)UNMAPPED_VDSO_BASE;
      |                                        ^~~~~~~~~~~~~~~~~~
./include/linux/mm_types.h:522:28: note: each undeclared identifier is reported only once for each function it appears in
  522 | #define UNMAPPED_VDSO_BASE TASK_SIZE_MAX
      |                            ^~~~~~~~~~~~~
./include/linux/mm_types.h:627:40: note: in expansion of macro 'UNMAPPED_VDSO_BASE'
  627 |         mm->vdso_base = (void __user *)UNMAPPED_VDSO_BASE;
      |                                        ^~~~~~~~~~~~~~~~~~
make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
make[1]: *** [prepare0] Error 2
make: *** [__sub-make] Error 2


Fixed by moving TASK_SIZE_MAX into asm/task_size_32.h and asm/task_size_64.h

diff --git a/arch/powerpc/include/asm/task_size_32.h b/arch/powerpc/include/asm/task_size_32.h
index de7290ee770f..03af9e6bb5cd 100644
--- a/arch/powerpc/include/asm/task_size_32.h
+++ b/arch/powerpc/include/asm/task_size_32.h
@@ -7,6 +7,7 @@
#endif

#define TASK_SIZE (CONFIG_TASK_SIZE)
+#define TASK_SIZE_MAX TASK_SIZE

/*
* This decides where the kernel will search for a free chunk of vm space during
diff --git a/arch/powerpc/include/asm/task_size_64.h b/arch/powerpc/include/asm/task_size_64.h
index c993482237ed..bfdb98c0ef43 100644
--- a/arch/powerpc/include/asm/task_size_64.h
+++ b/arch/powerpc/include/asm/task_size_64.h
@@ -49,6 +49,7 @@
TASK_SIZE_USER64)

#define TASK_SIZE TASK_SIZE_OF(current)
+#define TASK_SIZE_MAX TASK_SIZE_USER64

#define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 22c79ab40006..5823140d39f1 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -8,13 +8,6 @@
#include <asm/extable.h>
#include <asm/kup.h>

-#ifdef __powerpc64__
-/* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
-#define TASK_SIZE_MAX TASK_SIZE_USER64
-#else
-#define TASK_SIZE_MAX TASK_SIZE
-#endif
-
static inline bool __access_ok(unsigned long addr, unsigned long size)
{
return addr < TASK_SIZE_MAX && size <= TASK_SIZE_MAX - addr;