* Re: [PATCH] latent_entropy: make builtin_frame_address implicit
@ 2019-08-20 20:48 sahara
0 siblings, 0 replies; 3+ messages in thread
From: sahara @ 2019-08-20 20:48 UTC (permalink / raw)
To: kernel-hardening; +Cc: keescook, re.emese, keun-o.park
>> --- a/scripts/gcc-plugins/latent_entropy_plugin.c
>> +++ b/scripts/gcc-plugins/latent_entropy_plugin.c
>> @@ -446,6 +446,8 @@ static void init_local_entropy(basic_block bb, tree
local_entropy)
>> frame_addr = create_var(ptr_type_node, "local_entropy_frameaddr");
>>
>> /* 2. local_entropy_frameaddr = __builtin_frame_address() */
>> + if (!builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS))
>> + set_builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS, true);
>
>Interesting! Is this aarch64-specific or something that has changed in
>more recent GCC versions?
>
>Thanks!
>
>-Kees
>
This is Android's aarch64-specific. Tested and reproduced in 8.1.
I haven't seen this problem with Linaro toolchains.
- Sahara
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] latent_entropy: make builtin_frame_address implicit
2019-08-20 4:47 kpark3469
@ 2019-08-20 15:23 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-08-20 15:23 UTC (permalink / raw)
To: kpark3469; +Cc: kernel-hardening, re.emese, keun-o.park
On Tue, Aug 20, 2019 at 08:47:38AM +0400, kpark3469@gmail.com wrote:
> From: Sahara <keun-o.park@darkmatter.ae>
>
> When Android toolchain for aarch64 is used to build this plugin,
> builtin_decl_implicit(BUILT_IN_FRAME_ADDRESS) returns NULL_TREE.
> Due to this issue, the returned NULL_TREE from builtin_decl_implicit
> causes compiler's unexpected fault in the next gimple_build_call.
> To avoid this problem, let's make it implicit before calling
> builtin_decl_implicit() for the frame address.
>
> Signed-off-by: Sahara <keun-o.park@darkmatter.ae>
> ---
> scripts/gcc-plugins/latent_entropy_plugin.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c
> index cbe1d6c..7571990 100644
> --- a/scripts/gcc-plugins/latent_entropy_plugin.c
> +++ b/scripts/gcc-plugins/latent_entropy_plugin.c
> @@ -446,6 +446,8 @@ static void init_local_entropy(basic_block bb, tree local_entropy)
> frame_addr = create_var(ptr_type_node, "local_entropy_frameaddr");
>
> /* 2. local_entropy_frameaddr = __builtin_frame_address() */
> + if (!builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS))
> + set_builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS, true);
Interesting! Is this aarch64-specific or something that has changed in
more recent GCC versions?
Thanks!
-Kees
> fndecl = builtin_decl_implicit(BUILT_IN_FRAME_ADDRESS);
> call = gimple_build_call(fndecl, 1, integer_zero_node);
> gimple_call_set_lhs(call, frame_addr);
> --
> 2.7.4
>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] latent_entropy: make builtin_frame_address implicit
@ 2019-08-20 4:47 kpark3469
2019-08-20 15:23 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: kpark3469 @ 2019-08-20 4:47 UTC (permalink / raw)
To: kernel-hardening; +Cc: keescook, re.emese, keun-o.park
From: Sahara <keun-o.park@darkmatter.ae>
When Android toolchain for aarch64 is used to build this plugin,
builtin_decl_implicit(BUILT_IN_FRAME_ADDRESS) returns NULL_TREE.
Due to this issue, the returned NULL_TREE from builtin_decl_implicit
causes compiler's unexpected fault in the next gimple_build_call.
To avoid this problem, let's make it implicit before calling
builtin_decl_implicit() for the frame address.
Signed-off-by: Sahara <keun-o.park@darkmatter.ae>
---
scripts/gcc-plugins/latent_entropy_plugin.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c
index cbe1d6c..7571990 100644
--- a/scripts/gcc-plugins/latent_entropy_plugin.c
+++ b/scripts/gcc-plugins/latent_entropy_plugin.c
@@ -446,6 +446,8 @@ static void init_local_entropy(basic_block bb, tree local_entropy)
frame_addr = create_var(ptr_type_node, "local_entropy_frameaddr");
/* 2. local_entropy_frameaddr = __builtin_frame_address() */
+ if (!builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS))
+ set_builtin_decl_implicit_p(BUILT_IN_FRAME_ADDRESS, true);
fndecl = builtin_decl_implicit(BUILT_IN_FRAME_ADDRESS);
call = gimple_build_call(fndecl, 1, integer_zero_node);
gimple_call_set_lhs(call, frame_addr);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-20 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 20:48 [PATCH] latent_entropy: make builtin_frame_address implicit sahara
-- strict thread matches above, loose matches on Subject: below --
2019-08-20 4:47 kpark3469
2019-08-20 15:23 ` Kees Cook
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).