linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Emese Revfy <re.emese@gmail.com>
Cc: "kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	PaX Team <pageexec@freemail.hu>,
	Brad Spengler <spender@grsecurity.net>,
	Michal Marek <mmarek@suse.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	Theodore Ts'o <tytso@mit.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>, Jens Axboe <axboe@kernel.dk>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	bart.vanassche@sandisk.com,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v1 2/3] Mark functions with the latent_entropy attribute
Date: Tue, 24 May 2016 10:16:09 -0700	[thread overview]
Message-ID: <CAGXu5j+RQnSu2GgiRFP7UhDpLiuP=becZ-GXPoVRfXk6_wh3Gg@mail.gmail.com> (raw)
In-Reply-To: <20160524001629.7a9f0c5ce8427d0ad5e951fd@gmail.com>

On Mon, May 23, 2016 at 3:16 PM, Emese Revfy <re.emese@gmail.com> wrote:
> These functions have been selected because they are init functions or
> are called at random times or they have variable loops.
>
> Based on work created by the PaX Team.
>
> Signed-off-by: Emese Revfy <re.emese@gmail.com>
> [...]
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -188,6 +188,11 @@
>  #endif /* GCC_VERSION >= 40300 */
>
>  #if GCC_VERSION >= 40500
> +
> +#ifdef LATENT_ENTROPY_PLUGIN
> +#define __latent_entropy __attribute__((latent_entropy))
> +#endif

This deserves a full comment above it to describe its purpose and use
for when people go trying to figure out what it is and where to use
it. The commit message is a bit terse, so I'd try to expand both to
describe what function characteristics a developer should look for to
mark something with __latent_entropy.

> +
>  /*
>   * Mark a position in code as unreachable.  This can be used to
>   * suppress control flow warnings after asm blocks that transfer
> [...]
> diff --git a/include/linux/init.h b/include/linux/init.h
> index aedb254..68df2c3 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -37,9 +37,15 @@
>   * section.
>   */
>
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +#define add_meminit_latent_entropy
> +#else
> +#define add_meminit_latent_entropy __latent_entropy
> +#endif
> +
>  /* These are for everybody (although not all archs will actually
>     discard it in modules) */
> -#define __init         __section(.init.text) __cold notrace
> +#define __init         __section(.init.text) __cold notrace __latent_entropy
>  #define __initdata     __section(.init.data)
>  #define __initconst    __constsection(.init.rodata)
>  #define __exitdata     __section(.exit.data)
> @@ -92,7 +98,7 @@
>  #define __exit          __section(.exit.text) __exitused __cold notrace
>
>  /* Used for MEMORY_HOTPLUG */
> -#define __meminit        __section(.meminit.text) __cold notrace
> +#define __meminit        __section(.meminit.text) __cold notrace add_meminit_latent_entropy
>  #define __meminitdata    __section(.meminit.data)
>  #define __meminitconst   __constsection(.meminit.rodata)
>  #define __memexit        __section(.memexit.text) __exitused __cold notrace

I was confused by these defines. :) Maybe "add_meminit_latent_entropy"
should be named "__memory_hotplug_only_latent_entropy" or something
like that?

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-05-24 17:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 22:14 [PATCH v1 0/3] Introduce the latent_entropy gcc plugin Emese Revfy
2016-05-23 22:15 ` [PATCH v1 1/3] Add " Emese Revfy
2016-05-24 17:32   ` Kees Cook
2016-05-24 21:23     ` Emese Revfy
2016-05-24 23:40     ` PaX Team
2016-05-25  2:55       ` Kees Cook
2016-05-30 22:39         ` Emese Revfy
2016-05-23 22:16 ` [PATCH v1 2/3] Mark functions with the latent_entropy attribute Emese Revfy
2016-05-24 17:16   ` Kees Cook [this message]
2016-05-24 20:45     ` Emese Revfy
2016-05-24 20:55       ` Kees Cook
2016-05-23 22:17 ` [PATCH v1 3/3] Add the extra_latent_entropy kernel parameter Emese Revfy
2016-05-24 17:09   ` Kees Cook
2016-05-24 20:29     ` Emese Revfy

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='CAGXu5j+RQnSu2GgiRFP7UhDpLiuP=becZ-GXPoVRfXk6_wh3Gg@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@sandisk.com \
    --cc=davem@davemloft.net \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.com \
    --cc=pageexec@freemail.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=re.emese@gmail.com \
    --cc=spender@grsecurity.net \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yamada.masahiro@socionext.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