Skip to contentSkip to conversation

x86: fix build without CONFIG_X86_VSYSCALL_EMULATION

PATCH Applied Arnd Bergmann 4 participants 9 messages Feb 15, 2018 – Feb 21, 2018 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: fix build without CONFIG_X86_VSYSCALL_EMULATION

I ran into a 4.9 build regression in randconfig testing, starting with the KAISER patches:

arch/x86/mm/kaiser.c: In function 'kaiser_init':
arch/x86/mm/kaiser.c:347:8: error: 'vsyscall_pgprot' undeclared (first use in this function); did you mean 'massage_pgprot'?

This is easy enough to fix, we just need to make the declaration visible outside of the #ifdef. This works because the code using it is optimized away when vsyscall_enabled() returns false at compile time.

Fixes 9a0be5afbfbb ("vsyscall: Fix permissions for emulate mode with KAISER/PTI")
---
 arch/x86/include/asm/vsyscall.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/vsyscall.h +2 -1
index 9ee85066f407..c98c21b7f4cd 100644
@@ -13,7 +13,6 @@ extern void map_vsyscall(void);
  */
 extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
 extern bool vsyscall_enabled(void);
-extern unsigned long vsyscall_pgprot;
 #else
 static inline void map_vsyscall(void) {}
 static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
@@ -23,4 +22,6 @@ static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
 static inline bool vsyscall_enabled(void) { return false; }
 #endif
 
+extern unsigned long vsyscall_pgprot;
+
 #endif /* _ASM_X86_VSYSCALL_H */
Signature · 1 line
2.9.0
#1 lore raw

PATCH 2/2 x86: fix build warnign with 32-bit PAE

I ran into a 4.9 build warning in randconfig testing, starting with the KAISER patches:

arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
arch/x86/include/asm/pgtable_types.h:208:24: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

 #define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
                        ^
arch/x86/kernel/ldt.c:81:6: note: in expansion of macro '__PAGE_KERNEL'
      __PAGE_KERNEL);
      ^~~~~~~~~~~~~

I originally ran into this last year when the patches were part of linux-next, and tried to work around it by using the proper 'pteval_t' types consistently, but that caused additional problems.

This takes a much simpler approach, and makes the argument type of the dummy helper always 64-bit, which is wide enough for any page table layout and won't hurt since this call is just an empty stub anyway.

Fixes 8f0baadf2bea ("kaiser: merged update")
---
 include/linux/kaiser.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kaiser.h +1 -1
index 58c55b1589d0..b56c19010480 100644
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
 {
 }
 static inline int kaiser_add_mapping(unsigned long addr,
-				     unsigned long size, unsigned long flags)
+				     unsigned long size, u64 flags)
 {
 	return 0;
 }
Signature · 1 line
2.9.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] [stable-4.9] x86: fix build warnign with 32-bit PAE

Quoted 39 lines · Arnd Bergmann

I ran into a 4.9 build warning in randconfig testing, starting with the KAISER patches:

arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
arch/x86/include/asm/pgtable_types.h:208:24: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

 #define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
                        ^
arch/x86/kernel/ldt.c:81:6: note: in expansion of macro '__PAGE_KERNEL'
      __PAGE_KERNEL);
      ^~~~~~~~~~~~~

I originally ran into this last year when the patches were part of linux-next, and tried to work around it by using the proper 'pteval_t' types consistently, but that caused additional problems.

This takes a much simpler approach, and makes the argument type of the dummy helper always 64-bit, which is wide enough for any page table layout and won't hurt since this call is just an empty stub anyway.

Fixes 8f0baadf2bea ("kaiser: merged update")
---
 include/linux/kaiser.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kaiser.h +1 -2
index 58c55b1589d0..b56c19010480 100644
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
 {
 }
 static inline int kaiser_add_mapping(unsigned long addr,
-                                    unsigned long size, unsigned long flags)
+                                    unsigned long size, u64 flags)
 {
        return 0;
 }
--
Quoted 2 lines

2.9.0

I assume this is needed for 4.4 as well...

-Kees

Signature · 2 lines
Kees Cook
Pixel Security
#3 lore raw

Re: [PATCH 2/2] [stable-4.9] x86: fix build warnign with 32-bit PAE

Quoted 45 lines · Kees Cook
Quoted 39 lines · Arnd Bergmann

I ran into a 4.9 build warning in randconfig testing, starting with the KAISER patches:

arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
arch/x86/include/asm/pgtable_types.h:208:24: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

 #define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
                        ^
arch/x86/kernel/ldt.c:81:6: note: in expansion of macro '__PAGE_KERNEL'
      __PAGE_KERNEL);
      ^~~~~~~~~~~~~

I originally ran into this last year when the patches were part of linux-next, and tried to work around it by using the proper 'pteval_t' types consistently, but that caused additional problems.

This takes a much simpler approach, and makes the argument type of the dummy helper always 64-bit, which is wide enough for any page table layout and won't hurt since this call is just an empty stub anyway.

Fixes 8f0baadf2bea ("kaiser: merged update")
---
 include/linux/kaiser.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kaiser.h +1 -2
index 58c55b1589d0..b56c19010480 100644
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
 {
 }
 static inline int kaiser_add_mapping(unsigned long addr,
-                                    unsigned long size, unsigned long flags)
+                                    unsigned long size, u64 flags)
 {
        return 0;
 }
--
Quoted 2 lines

2.9.0

Quoted 1 line

I assume this is needed for 4.4 as well...

Yes, I've added it there too.

greg k-h

maintainer Applied
#4 lore raw

Patch "x86: fix build warnign with 32-bit PAE" has been added to the 4.4-stable tree

In reply to Arnd Bergmann

This is a note to let you know that I've just added the patch titled

x86: fix build warnign with 32-bit PAE

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     x86-fix-build-warnign-with-32-bit-pae.patch

and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From [email protected] Wed Feb 21 10:34:37 2018

From: Arnd Bergmann <[email protected]>
Date: Thu, 15 Feb 2018 16:16:57 +0100
Subject: x86: fix build warnign with 32-bit PAE
To: [email protected]
Cc: [email protected], Dave Hansen <[email protected]>, Ben Hutchings <[email protected]>, Arnd Bergmann <[email protected]>, Greg Kroah-Hartman <[email protected]>, Hugh Dickins <[email protected]>, Kees Cook <[email protected]>, [email protected]
Message-ID: <[email protected]>

I ran into a 4.9 build warning in randconfig testing, starting with the KAISER patches:

arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
arch/x86/include/asm/pgtable_types.h:208:24: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

 #define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
                        ^
arch/x86/kernel/ldt.c:81:6: note: in expansion of macro '__PAGE_KERNEL'
      __PAGE_KERNEL);
      ^~~~~~~~~~~~~

I originally ran into this last year when the patches were part of linux-next, and tried to work around it by using the proper 'pteval_t' types consistently, but that caused additional problems.

This takes a much simpler approach, and makes the argument type of the dummy helper always 64-bit, which is wide enough for any page table layout and won't hurt since this call is just an empty stub anyway.

---
 include/linux/kaiser.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kaiser.h +1 -1
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
 {
 }
 static inline int kaiser_add_mapping(unsigned long addr,
-				     unsigned long size, unsigned long flags)
+				     unsigned long size, u64 flags)
 {
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/arm-spear600-add-missing-interrupt-parent-of-rtc.patch queue-4.4/arm-dts-sti-add-gpio-polarity-for-hdmi-hpd-gpio-property.patch queue-4.4/arm-spear13xx-fix-spics-gpio-controller-s-warning.patch queue-4.4/x86-fix-build-warnign-with-32-bit-pae.patch queue-4.4/mm-hide-a-warning-for-compile_test.patch queue-4.4/arm-spear13xx-fix-dmas-cells.patch

maintainer Applied
#5 lore raw

Patch "x86: fix build warnign with 32-bit PAE" has been added to the 4.9-stable tree

In reply to Arnd Bergmann

This is a note to let you know that I've just added the patch titled

x86: fix build warnign with 32-bit PAE

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     x86-fix-build-warnign-with-32-bit-pae.patch

and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From [email protected] Wed Feb 21 10:34:37 2018

From: Arnd Bergmann <[email protected]>
Date: Thu, 15 Feb 2018 16:16:57 +0100
Subject: x86: fix build warnign with 32-bit PAE
To: [email protected]
Cc: [email protected], Dave Hansen <[email protected]>, Ben Hutchings <[email protected]>, Arnd Bergmann <[email protected]>, Greg Kroah-Hartman <[email protected]>, Hugh Dickins <[email protected]>, Kees Cook <[email protected]>, [email protected]
Message-ID: <[email protected]>

I ran into a 4.9 build warning in randconfig testing, starting with the KAISER patches:

arch/x86/kernel/ldt.c: In function 'alloc_ldt_struct':
arch/x86/include/asm/pgtable_types.h:208:24: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

 #define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
                        ^
arch/x86/kernel/ldt.c:81:6: note: in expansion of macro '__PAGE_KERNEL'
      __PAGE_KERNEL);
      ^~~~~~~~~~~~~

I originally ran into this last year when the patches were part of linux-next, and tried to work around it by using the proper 'pteval_t' types consistently, but that caused additional problems.

This takes a much simpler approach, and makes the argument type of the dummy helper always 64-bit, which is wide enough for any page table layout and won't hurt since this call is just an empty stub anyway.

---
 include/linux/kaiser.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kaiser.h +1 -1
@@ -32,7 +32,7 @@ static inline void kaiser_init(void)
 {
 }
 static inline int kaiser_add_mapping(unsigned long addr,
-				     unsigned long size, unsigned long flags)
+				     unsigned long size, u64 flags)
 {
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/arm-spear600-add-missing-interrupt-parent-of-rtc.patch queue-4.9/arm-dts-sti-add-gpio-polarity-for-hdmi-hpd-gpio-property.patch queue-4.9/kselftest-fix-oom-in-memory-compaction-test.patch queue-4.9/arm-spear13xx-fix-spics-gpio-controller-s-warning.patch queue-4.9/x86-fix-build-warnign-with-32-bit-pae.patch queue-4.9/mm-hide-a-warning-for-compile_test.patch queue-4.9/arm-lpc3250-fix-uda1380-gpio-numbers.patch queue-4.9/arm-spear13xx-fix-dmas-cells.patch queue-4.9/arm-dts-nomadik-add-interrupt-parent-for-clcd.patch

#6 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

I ran into a 4.9 build regression in randconfig testing, starting with the KAISER patches:

arch/x86/mm/kaiser.c: In function 'kaiser_init':
arch/x86/mm/kaiser.c:347:8: error: 'vsyscall_pgprot' undeclared (first use in this function); did you mean 'massage_pgprot'?

This is easy enough to fix, we just need to make the declaration visible outside of the #ifdef. This works because the code using it is optimized away when vsyscall_enabled() returns false at compile time.

Quoted 5 lines
Fixes 9a0be5afbfbb ("vsyscall: Fix permissions for emulate mode with KAISER/PTI")
---
 arch/x86/include/asm/vsyscall.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for these, I'll queue them up in the next round after these kernels get released in a few days.

greg k-h

#7 lore raw
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Arnd Bergmann

I ran into a 4.9 build regression in randconfig testing, starting with the KAISER patches:

arch/x86/mm/kaiser.c: In function 'kaiser_init':
arch/x86/mm/kaiser.c:347:8: error: 'vsyscall_pgprot' undeclared (first use in this function); did you mean 'massage_pgprot'?

This is easy enough to fix, we just need to make the declaration visible outside of the #ifdef. This works because the code using it is optimized away when vsyscall_enabled() returns false at compile time.

Quoted 8 lines
Quoted 5 lines
Fixes 9a0be5afbfbb ("vsyscall: Fix permissions for emulate mode with KAISER/PTI")
---
 arch/x86/include/asm/vsyscall.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for these, I'll queue them up in the next round after these kernels get released in a few days.

Thanks to Arnd, but please drop this vsyscall one Greg: it duplicates my/Tobias's "kaiser: fix compile error without vsyscall" that you just sent out for 4.4 and 4.9 review.

Arnd's PAE one looks good for 4.4 and 4.9 (well, in another context I'd object to using a different prototype in the stub, but I'm pretty sure Arnd feels the same way, but has made the appropriate choice for our Kaiser backports context): so please do take his 2/2 "x86: fix build warnign with 32-bit PAE" for both 4.4 and 4.9.

Thanks,
Hugh

#8 lore raw
Quoted 25 lines · Hugh Dickins
Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Arnd Bergmann

I ran into a 4.9 build regression in randconfig testing, starting with the KAISER patches:

arch/x86/mm/kaiser.c: In function 'kaiser_init':
arch/x86/mm/kaiser.c:347:8: error: 'vsyscall_pgprot' undeclared (first use in this function); did you mean 'massage_pgprot'?

This is easy enough to fix, we just need to make the declaration visible outside of the #ifdef. This works because the code using it is optimized away when vsyscall_enabled() returns false at compile time.

Quoted 8 lines
Quoted 5 lines
Fixes 9a0be5afbfbb ("vsyscall: Fix permissions for emulate mode with KAISER/PTI")
---
 arch/x86/include/asm/vsyscall.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for these, I'll queue them up in the next round after these kernels get released in a few days.

Thanks to Arnd, but please drop this vsyscall one Greg: it duplicates my/Tobias's "kaiser: fix compile error without vsyscall" that you just sent out for 4.4 and 4.9 review.

Quoted 5 lines

Arnd's PAE one looks good for 4.4 and 4.9 (well, in another context I'd object to using a different prototype in the stub, but I'm pretty sure Arnd feels the same way, but has made the appropriate choice for our Kaiser backports context): so please do take his 2/2 "x86: fix build warnign with 32-bit PAE" for both 4.4 and 4.9.

I've now taken the 2/2 patch here, thanks for the review. Arnd, thanks for the patch.

greg k-h