* [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-16 18:38 ` Arnd Bergmann
0 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-16 18:38 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers, James Morse
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
From: Arnd Bergmann <arnd@arndb.de>
The newly introduced TRAMP_VALIAS definition causes a build warning
with clang-14:
arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
return (char *)TRAMP_VALIAS + SZ_2K * slot;
Change the addition to something clang does not complain about.
Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm64/include/asm/vectors.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I see this warning on 5.17-rc8, but did not test it on linux-next,
which may already have a fix.
diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
index f64613a96d53..bc9a2145f419 100644
--- a/arch/arm64/include/asm/vectors.h
+++ b/arch/arm64/include/asm/vectors.h
@@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
#ifndef CONFIG_UNMAP_KERNEL_AT_EL0
-#define TRAMP_VALIAS 0
+#define TRAMP_VALIAS 0ul
#endif
static inline const char *
arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
{
if (arm64_kernel_unmapped_at_el0())
- return (char *)TRAMP_VALIAS + SZ_2K * slot;
+ return (char *)(TRAMP_VALIAS + SZ_2K * slot);
WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
--
2.29.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-16 18:38 ` Arnd Bergmann
0 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-16 18:38 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers, James Morse
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
From: Arnd Bergmann <arnd@arndb.de>
The newly introduced TRAMP_VALIAS definition causes a build warning
with clang-14:
arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
return (char *)TRAMP_VALIAS + SZ_2K * slot;
Change the addition to something clang does not complain about.
Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm64/include/asm/vectors.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I see this warning on 5.17-rc8, but did not test it on linux-next,
which may already have a fix.
diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
index f64613a96d53..bc9a2145f419 100644
--- a/arch/arm64/include/asm/vectors.h
+++ b/arch/arm64/include/asm/vectors.h
@@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
#ifndef CONFIG_UNMAP_KERNEL_AT_EL0
-#define TRAMP_VALIAS 0
+#define TRAMP_VALIAS 0ul
#endif
static inline const char *
arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
{
if (arm64_kernel_unmapped_at_el0())
- return (char *)TRAMP_VALIAS + SZ_2K * slot;
+ return (char *)(TRAMP_VALIAS + SZ_2K * slot);
WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
2022-03-16 18:38 ` Arnd Bergmann
@ 2022-03-18 12:37 ` James Morse
-1 siblings, 0 replies; 12+ messages in thread
From: James Morse @ 2022-03-18 12:37 UTC (permalink / raw)
To: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
Hi Arnd,
On 3/16/22 6:38 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
It is? Good to know!
(clang 11 doesn't seem to be so fussy)
Just for some more background:
TRAMP_VALIAS existed before, but it wasn't defined if KPTI is disabled at compile time, you can't
do that without CONFIG_EXPERT.
I thought these dummy definitions would be cleaner than #ifdef'ing the code.
> Change the addition to something clang does not complain about.
Acked-by: James Morse <james.morse@arm.com>
Thanks!
James
> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
>
> diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> index f64613a96d53..bc9a2145f419 100644
> --- a/arch/arm64/include/asm/vectors.h
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
>
> #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> -#define TRAMP_VALIAS 0
> +#define TRAMP_VALIAS 0ul
> #endif
>
> static inline const char *
> arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> {
> if (arm64_kernel_unmapped_at_el0())
> - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
>
> WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-18 12:37 ` James Morse
0 siblings, 0 replies; 12+ messages in thread
From: James Morse @ 2022-03-18 12:37 UTC (permalink / raw)
To: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
Hi Arnd,
On 3/16/22 6:38 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
It is? Good to know!
(clang 11 doesn't seem to be so fussy)
Just for some more background:
TRAMP_VALIAS existed before, but it wasn't defined if KPTI is disabled at compile time, you can't
do that without CONFIG_EXPERT.
I thought these dummy definitions would be cleaner than #ifdef'ing the code.
> Change the addition to something clang does not complain about.
Acked-by: James Morse <james.morse@arm.com>
Thanks!
James
> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
>
> diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> index f64613a96d53..bc9a2145f419 100644
> --- a/arch/arm64/include/asm/vectors.h
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
>
> #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> -#define TRAMP_VALIAS 0
> +#define TRAMP_VALIAS 0ul
> #endif
>
> static inline const char *
> arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> {
> if (arm64_kernel_unmapped_at_el0())
> - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
>
> WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
2022-03-16 18:38 ` Arnd Bergmann
@ 2022-03-18 18:10 ` Catalin Marinas
-1 siblings, 0 replies; 12+ messages in thread
From: Catalin Marinas @ 2022-03-18 18:10 UTC (permalink / raw)
To: Will Deacon, James Morse, Arnd Bergmann, Nathan Chancellor,
Nick Desaulniers
Cc: llvm, Russell King (Oracle),
linux-arm-kernel, Arnd Bergmann, linux-kernel
On Wed, 16 Mar 2022 19:38:18 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64: fix clang warning about TRAMP_VALIAS
https://git.kernel.org/arm64/c/7f34b43e07cb
--
Catalin
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-18 18:10 ` Catalin Marinas
0 siblings, 0 replies; 12+ messages in thread
From: Catalin Marinas @ 2022-03-18 18:10 UTC (permalink / raw)
To: Will Deacon, James Morse, Arnd Bergmann, Nathan Chancellor,
Nick Desaulniers
Cc: llvm, Russell King (Oracle),
linux-arm-kernel, Arnd Bergmann, linux-kernel
On Wed, 16 Mar 2022 19:38:18 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64: fix clang warning about TRAMP_VALIAS
https://git.kernel.org/arm64/c/7f34b43e07cb
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
2022-03-16 18:38 ` Arnd Bergmann
@ 2022-03-18 19:11 ` Robin Murphy
-1 siblings, 0 replies; 12+ messages in thread
From: Robin Murphy @ 2022-03-18 19:11 UTC (permalink / raw)
To: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers, James Morse
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On 2022-03-16 18:38, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
Tangentially, all the other GNU extensions we depend on throughout Linux
are also GNU extensions. Do we know what's special about this one?
Robin.
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
>
> Change the addition to something clang does not complain about.
>
> Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/arm64/include/asm/vectors.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
>
> diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> index f64613a96d53..bc9a2145f419 100644
> --- a/arch/arm64/include/asm/vectors.h
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
>
> #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> -#define TRAMP_VALIAS 0
> +#define TRAMP_VALIAS 0ul
> #endif
>
> static inline const char *
> arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> {
> if (arm64_kernel_unmapped_at_el0())
> - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
>
> WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-18 19:11 ` Robin Murphy
0 siblings, 0 replies; 12+ messages in thread
From: Robin Murphy @ 2022-03-18 19:11 UTC (permalink / raw)
To: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
Nick Desaulniers, James Morse
Cc: Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On 2022-03-16 18:38, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly introduced TRAMP_VALIAS definition causes a build warning
> with clang-14:
>
> arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
Tangentially, all the other GNU extensions we depend on throughout Linux
are also GNU extensions. Do we know what's special about this one?
Robin.
> return (char *)TRAMP_VALIAS + SZ_2K * slot;
>
> Change the addition to something clang does not complain about.
>
> Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/arm64/include/asm/vectors.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> I see this warning on 5.17-rc8, but did not test it on linux-next,
> which may already have a fix.
>
> diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> index f64613a96d53..bc9a2145f419 100644
> --- a/arch/arm64/include/asm/vectors.h
> +++ b/arch/arm64/include/asm/vectors.h
> @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
>
> #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> -#define TRAMP_VALIAS 0
> +#define TRAMP_VALIAS 0ul
> #endif
>
> static inline const char *
> arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> {
> if (arm64_kernel_unmapped_at_el0())
> - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
>
> WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
2022-03-18 19:11 ` Robin Murphy
@ 2022-03-18 19:52 ` Nick Desaulniers
-1 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2022-03-18 19:52 UTC (permalink / raw)
To: Robin Murphy
Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
James Morse, Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On Fri, Mar 18, 2022 at 12:11 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2022-03-16 18:38, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The newly introduced TRAMP_VALIAS definition causes a build warning
> > with clang-14:
> >
> > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
>
> Tangentially, all the other GNU extensions we depend on throughout Linux
> are also GNU extensions. Do we know what's special about this one?
My first thought is that -Wnull-pointer-arithmetic should be in the
-Wgnu flag group, such that -Wno-gnu (as set by Kbuild) implies
-Wno-null-pointer-arithmetic.
One issue seems to be that -Wnull-pointer-arithmetic seems to control
at least 2 different checks in clang.
https://godbolt.org/z/hdYYejj3d
So it's likely these two checks should have 2 distinct flags, such
that the warning we're observing can be grouped under -Wgnu.
Filed: https://github.com/llvm/llvm-project/issues/54444
>
> Robin.
>
> > return (char *)TRAMP_VALIAS + SZ_2K * slot;
> >
> > Change the addition to something clang does not complain about.
> >
> > Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > arch/arm64/include/asm/vectors.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > I see this warning on 5.17-rc8, but did not test it on linux-next,
> > which may already have a fix.
> >
> > diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> > index f64613a96d53..bc9a2145f419 100644
> > --- a/arch/arm64/include/asm/vectors.h
> > +++ b/arch/arm64/include/asm/vectors.h
> > @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> > DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
> >
> > #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> > -#define TRAMP_VALIAS 0
> > +#define TRAMP_VALIAS 0ul
> > #endif
> >
> > static inline const char *
> > arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> > {
> > if (arm64_kernel_unmapped_at_el0())
> > - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> > + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
> >
> > WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
> >
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-18 19:52 ` Nick Desaulniers
0 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2022-03-18 19:52 UTC (permalink / raw)
To: Robin Murphy
Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
James Morse, Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On Fri, Mar 18, 2022 at 12:11 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2022-03-16 18:38, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The newly introduced TRAMP_VALIAS definition causes a build warning
> > with clang-14:
> >
> > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
>
> Tangentially, all the other GNU extensions we depend on throughout Linux
> are also GNU extensions. Do we know what's special about this one?
My first thought is that -Wnull-pointer-arithmetic should be in the
-Wgnu flag group, such that -Wno-gnu (as set by Kbuild) implies
-Wno-null-pointer-arithmetic.
One issue seems to be that -Wnull-pointer-arithmetic seems to control
at least 2 different checks in clang.
https://godbolt.org/z/hdYYejj3d
So it's likely these two checks should have 2 distinct flags, such
that the warning we're observing can be grouped under -Wgnu.
Filed: https://github.com/llvm/llvm-project/issues/54444
>
> Robin.
>
> > return (char *)TRAMP_VALIAS + SZ_2K * slot;
> >
> > Change the addition to something clang does not complain about.
> >
> > Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > arch/arm64/include/asm/vectors.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > I see this warning on 5.17-rc8, but did not test it on linux-next,
> > which may already have a fix.
> >
> > diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h
> > index f64613a96d53..bc9a2145f419 100644
> > --- a/arch/arm64/include/asm/vectors.h
> > +++ b/arch/arm64/include/asm/vectors.h
> > @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors {
> > DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector);
> >
> > #ifndef CONFIG_UNMAP_KERNEL_AT_EL0
> > -#define TRAMP_VALIAS 0
> > +#define TRAMP_VALIAS 0ul
> > #endif
> >
> > static inline const char *
> > arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot)
> > {
> > if (arm64_kernel_unmapped_at_el0())
> > - return (char *)TRAMP_VALIAS + SZ_2K * slot;
> > + return (char *)(TRAMP_VALIAS + SZ_2K * slot);
> >
> > WARN_ON_ONCE(slot == EL1_VECTOR_KPTI);
> >
--
Thanks,
~Nick Desaulniers
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
2022-03-18 19:52 ` Nick Desaulniers
@ 2022-03-22 17:02 ` Nick Desaulniers
-1 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2022-03-22 17:02 UTC (permalink / raw)
To: Robin Murphy
Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
James Morse, Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On Fri, Mar 18, 2022 at 12:52 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Mar 18, 2022 at 12:11 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >
> > On 2022-03-16 18:38, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > >
> > > The newly introduced TRAMP_VALIAS definition causes a build warning
> > > with clang-14:
> > >
> > > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> >
> > Tangentially, all the other GNU extensions we depend on throughout Linux
> > are also GNU extensions. Do we know what's special about this one?
>
> My first thought is that -Wnull-pointer-arithmetic should be in the
> -Wgnu flag group, such that -Wno-gnu (as set by Kbuild) implies
> -Wno-null-pointer-arithmetic.
>
> One issue seems to be that -Wnull-pointer-arithmetic seems to control
> at least 2 different checks in clang.
>
> https://godbolt.org/z/hdYYejj3d
>
> So it's likely these two checks should have 2 distinct flags, such
> that the warning we're observing can be grouped under -Wgnu.
>
> Filed: https://github.com/llvm/llvm-project/issues/54444
Fix should be landing shortly:
https://reviews.llvm.org/D122224
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS
@ 2022-03-22 17:02 ` Nick Desaulniers
0 siblings, 0 replies; 12+ messages in thread
From: Nick Desaulniers @ 2022-03-22 17:02 UTC (permalink / raw)
To: Robin Murphy
Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, Nathan Chancellor,
James Morse, Arnd Bergmann, Russell King (Oracle),
linux-arm-kernel, linux-kernel, llvm
On Fri, Mar 18, 2022 at 12:52 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Mar 18, 2022 at 12:11 PM Robin Murphy <robin.murphy@arm.com> wrote:
> >
> > On 2022-03-16 18:38, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > >
> > > The newly introduced TRAMP_VALIAS definition causes a build warning
> > > with clang-14:
> > >
> > > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic]
> >
> > Tangentially, all the other GNU extensions we depend on throughout Linux
> > are also GNU extensions. Do we know what's special about this one?
>
> My first thought is that -Wnull-pointer-arithmetic should be in the
> -Wgnu flag group, such that -Wno-gnu (as set by Kbuild) implies
> -Wno-null-pointer-arithmetic.
>
> One issue seems to be that -Wnull-pointer-arithmetic seems to control
> at least 2 different checks in clang.
>
> https://godbolt.org/z/hdYYejj3d
>
> So it's likely these two checks should have 2 distinct flags, such
> that the warning we're observing can be grouped under -Wgnu.
>
> Filed: https://github.com/llvm/llvm-project/issues/54444
Fix should be landing shortly:
https://reviews.llvm.org/D122224
--
Thanks,
~Nick Desaulniers
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-03-22 17:04 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 18:38 [PATCH] arm64: fix clang warning about TRAMP_VALIAS Arnd Bergmann
2022-03-16 18:38 ` Arnd Bergmann
2022-03-18 12:37 ` James Morse
2022-03-18 12:37 ` James Morse
2022-03-18 18:10 ` Catalin Marinas
2022-03-18 18:10 ` Catalin Marinas
2022-03-18 19:11 ` Robin Murphy
2022-03-18 19:11 ` Robin Murphy
2022-03-18 19:52 ` Nick Desaulniers
2022-03-18 19:52 ` Nick Desaulniers
2022-03-22 17:02 ` Nick Desaulniers
2022-03-22 17:02 ` Nick Desaulniers
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.