x86: make TASK_SIZE_MAX usable from assembly code
authorChristoph Hellwig <hch@lst.de>
Thu, 3 Sep 2020 14:22:39 +0000 (16:22 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 9 Sep 2020 02:21:35 +0000 (22:21 -0400)
For 64-bit the only thing missing was a strategic _AC, and for 32-bit we
need to use __PAGE_OFFSET instead of PAGE_OFFSET in the TASK_SIZE
definition to escape the explicit unsigned long cast.  This just works
because __PAGE_OFFSET is defined using _AC itself and thus never needs
the cast anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/x86/include/asm/page_32_types.h
arch/x86/include/asm/page_64_types.h

index 26236925fb2c367318de97db716f50b0ad3de2ff..f462895a33e452d5eeaba82a07cb871564a49a8f 100644 (file)
@@ -44,8 +44,8 @@
 /*
  * User space process size: 3GB (default).
  */
-#define IA32_PAGE_OFFSET       PAGE_OFFSET
-#define TASK_SIZE              PAGE_OFFSET
+#define IA32_PAGE_OFFSET       __PAGE_OFFSET
+#define TASK_SIZE              __PAGE_OFFSET
 #define TASK_SIZE_LOW          TASK_SIZE
 #define TASK_SIZE_MAX          TASK_SIZE
 #define DEFAULT_MAP_WINDOW     TASK_SIZE
index 996595c9897e0a36075b0af8aaedf2f919714466..838515daf87b366656de97d56f944d08fa969535 100644 (file)
@@ -76,7 +76,7 @@
  *
  * With page table isolation enabled, we map the LDT in ... [stay tuned]
  */
-#define TASK_SIZE_MAX  ((1UL << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE)
+#define TASK_SIZE_MAX  ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE)
 
 #define DEFAULT_MAP_WINDOW     ((1UL << 47) - PAGE_SIZE)