Skip to content

Commit a1d826d

Browse files
Christoph HellwigAl Viro
authored andcommitted
x86: make TASK_SIZE_MAX usable from assembly code
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>
1 parent 999c83e commit a1d826d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

arch/x86/include/asm/page_32_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
/*
4545
* User space process size: 3GB (default).
4646
*/
47-
#define IA32_PAGE_OFFSET PAGE_OFFSET
48-
#define TASK_SIZE PAGE_OFFSET
47+
#define IA32_PAGE_OFFSET __PAGE_OFFSET
48+
#define TASK_SIZE __PAGE_OFFSET
4949
#define TASK_SIZE_LOW TASK_SIZE
5050
#define TASK_SIZE_MAX TASK_SIZE
5151
#define DEFAULT_MAP_WINDOW TASK_SIZE

arch/x86/include/asm/page_64_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
*
7777
* With page table isolation enabled, we map the LDT in ... [stay tuned]
7878
*/
79-
#define TASK_SIZE_MAX ((1UL << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE)
79+
#define TASK_SIZE_MAX ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - PAGE_SIZE)
8080

8181
#define DEFAULT_MAP_WINDOW ((1UL << 47) - PAGE_SIZE)
8282

0 commit comments

Comments
 (0)