linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6
@ 2019-05-10  9:00 Chris Packham
  2019-05-10 20:23 ` Kees Cook
  2019-05-10 22:23 ` Doug Anderson
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Packham @ 2019-05-10  9:00 UTC (permalink / raw)
  To: keescook, re.emese; +Cc: kernel-hardening, linux-kernel, Chris Packham

Use gen_rtx_set instead of gen_rtx_SET. The former is a wrapper macro
that handles the difference between GCC versions implementing
the latter.

This fixes the following error on my system with g++ 5.4.0 as the host
compiler

   HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o
 scripts/gcc-plugins/arm_ssp_per_task_plugin.c:42:14: error: macro "gen_rtx_SET" requires 3 arguments, but only 2 given
          mask)),
               ^
 scripts/gcc-plugins/arm_ssp_per_task_plugin.c: In function ‘unsigned int arm_pertask_ssp_rtl_execute()’:
 scripts/gcc-plugins/arm_ssp_per_task_plugin.c:39:20: error: ‘gen_rtx_SET’ was not declared in this scope
    emit_insn_before(gen_rtx_SET

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 scripts/gcc-plugins/arm_ssp_per_task_plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
index 89c47f57d1ce..8c1af9bdcb1b 100644
--- a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
+++ b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
@@ -36,7 +36,7 @@ static unsigned int arm_pertask_ssp_rtl_execute(void)
 		mask = GEN_INT(sext_hwi(sp_mask, GET_MODE_PRECISION(Pmode)));
 		masked_sp = gen_reg_rtx(Pmode);
 
-		emit_insn_before(gen_rtx_SET(masked_sp,
+		emit_insn_before(gen_rtx_set(masked_sp,
 					     gen_rtx_AND(Pmode,
 							 stack_pointer_rtx,
 							 mask)),
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6
  2019-05-10  9:00 [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6 Chris Packham
@ 2019-05-10 20:23 ` Kees Cook
  2019-05-10 22:23 ` Doug Anderson
  1 sibling, 0 replies; 4+ messages in thread
From: Kees Cook @ 2019-05-10 20:23 UTC (permalink / raw)
  To: Chris Packham; +Cc: re.emese, kernel-hardening, linux-kernel, Ard Biesheuvel

On Fri, May 10, 2019 at 09:00:25PM +1200, Chris Packham wrote:
> Use gen_rtx_set instead of gen_rtx_SET. The former is a wrapper macro
> that handles the difference between GCC versions implementing
> the latter.
> 
> This fixes the following error on my system with g++ 5.4.0 as the host
> compiler
> 
>    HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:42:14: error: macro "gen_rtx_SET" requires 3 arguments, but only 2 given
>           mask)),
>                ^
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c: In function ‘unsigned int arm_pertask_ssp_rtl_execute()’:
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:39:20: error: ‘gen_rtx_SET’ was not declared in this scope
>     emit_insn_before(gen_rtx_SET
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Thanks for this! It seems correct to me. Ard, any thoughts? I can send
it to Linus next week...

Fixes: 189af4657186 ("ARM: smp: add support for per-task stack canaries")
Cc: stable@vger.kernel.org

-Kees

> ---
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
> index 89c47f57d1ce..8c1af9bdcb1b 100644
> --- a/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
> +++ b/scripts/gcc-plugins/arm_ssp_per_task_plugin.c
> @@ -36,7 +36,7 @@ static unsigned int arm_pertask_ssp_rtl_execute(void)
>  		mask = GEN_INT(sext_hwi(sp_mask, GET_MODE_PRECISION(Pmode)));
>  		masked_sp = gen_reg_rtx(Pmode);
>  
> -		emit_insn_before(gen_rtx_SET(masked_sp,
> +		emit_insn_before(gen_rtx_set(masked_sp,
>  					     gen_rtx_AND(Pmode,
>  							 stack_pointer_rtx,
>  							 mask)),
> -- 
> 2.21.0
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6
  2019-05-10  9:00 [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6 Chris Packham
  2019-05-10 20:23 ` Kees Cook
@ 2019-05-10 22:23 ` Doug Anderson
  2019-05-16  8:47   ` Ard Biesheuvel
  1 sibling, 1 reply; 4+ messages in thread
From: Doug Anderson @ 2019-05-10 22:23 UTC (permalink / raw)
  To: Chris Packham; +Cc: Kees Cook, re.emese, kernel-hardening, LKML

Hi,

> Use gen_rtx_set instead of gen_rtx_SET. The former is a wrapper macro
> that handles the difference between GCC versions implementing
> the latter.
>
> This fixes the following error on my system with g++ 5.4.0 as the host
> compiler
>
>    HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:42:14: error: macro "gen_rtx_SET" requires 3 arguments, but only 2 given
>           mask)),
>                ^
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c: In function ‘unsigned int arm_pertask_ssp_rtl_execute()’:
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:39:20: error: ‘gen_rtx_SET’ was not declared in this scope
>     emit_insn_before(gen_rtx_SET
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  scripts/gcc-plugins/arm_ssp_per_task_plugin.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I can confirm that I was getting compile errors before this patch and
applying it allowed me to compile and boot.  Thanks!  :-)

Tested-by: Douglas Anderson <dianders@chromium.org>

-Doug

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6
  2019-05-10 22:23 ` Doug Anderson
@ 2019-05-16  8:47   ` Ard Biesheuvel
  0 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2019-05-16  8:47 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Chris Packham, Kees Cook, Emese Revfy, Kernel Hardening, LKML

On Sat, 11 May 2019 at 00:42, Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> > Use gen_rtx_set instead of gen_rtx_SET. The former is a wrapper macro
> > that handles the difference between GCC versions implementing
> > the latter.
> >
> > This fixes the following error on my system with g++ 5.4.0 as the host
> > compiler
> >
> >    HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o
> >  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:42:14: error: macro "gen_rtx_SET" requires 3 arguments, but only 2 given
> >           mask)),
> >                ^
> >  scripts/gcc-plugins/arm_ssp_per_task_plugin.c: In function ‘unsigned int arm_pertask_ssp_rtl_execute()’:
> >  scripts/gcc-plugins/arm_ssp_per_task_plugin.c:39:20: error: ‘gen_rtx_SET’ was not declared in this scope
> >     emit_insn_before(gen_rtx_SET
> >
> > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> > ---
> >  scripts/gcc-plugins/arm_ssp_per_task_plugin.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> I can confirm that I was getting compile errors before this patch and
> applying it allowed me to compile and boot.  Thanks!  :-)
>
> Tested-by: Douglas Anderson <dianders@chromium.org>
>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-16  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10  9:00 [PATCH] gcc-plugins: arm_ssp_per_task_plugin: Fix for older GCC < 6 Chris Packham
2019-05-10 20:23 ` Kees Cook
2019-05-10 22:23 ` Doug Anderson
2019-05-16  8:47   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).