From: Kees Cook <keescook@chromium.org>
To: kpark3469@gmail.com
Cc: kernel-hardening@lists.openwall.com, re.emese@gmail.com,
keun-o.park@darkmatter.ae
Subject: Re: [PATCH] latent_entropy: make builtin_frame_address implicit
Date: Tue, 20 Aug 2019 08:23:57 -0700 [thread overview]
Message-ID: <201908200823.FC9E4D26B@keescook> (raw)
In-Reply-To: <1566276458-6233-1-git-send-email-kpark3469@gmail.com>
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
next prev parent reply other threads:[~2019-08-20 15:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 4:47 [PATCH] latent_entropy: make builtin_frame_address implicit kpark3469
2019-08-20 15:23 ` Kees Cook [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-08-20 20:48 sahara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201908200823.FC9E4D26B@keescook \
--to=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=keun-o.park@darkmatter.ae \
--cc=kpark3469@gmail.com \
--cc=re.emese@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox