All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emese Revfy <re.emese@gmail.com>
To: Kees Cook <keescook@chromium.org>
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 v2 1/3] Add the latent_entropy gcc plugin
Date: Wed, 15 Jun 2016 00:31:21 +0200	[thread overview]
Message-ID: <20160615003121.008b63c8152aa60c9c351530@gmail.com> (raw)
In-Reply-To: <CAGXu5j+-owKY_q-0Yow+OEsY3srdv0246H3ob-qRC6O3yg-qkg@mail.gmail.com>

On Tue, 14 Jun 2016 11:27:00 -0700
Kees Cook <keescook@chromium.org> wrote:

> On Mon, Jun 13, 2016 at 2:49 PM, Emese Revfy <re.emese@gmail.com> wrote:
> > On Thu, 9 Jun 2016 14:51:45 -0700
> > Kees Cook <keescook@chromium.org> wrote:
>
> >> > + * gcc plugin to help generate a little bit of entropy from program state,
> >> > + * used throughout the uptime of the kernel
> >>
> >> I think this comment needs a lot of expanding. What are all the ways
> >> that this plugin makes changes to code? Things I think I see are:
> >> pre-filling data variables with randomness, creating a local_entropy
> >> variable (local to what?), mixing stack pointer (into what?), updating
> >> latent_entropy global.
> >
> > I demonstrated the details here:
> > https://github.com/ephox-gcc-plugins/latent_entropy/commit/049acd9f478d47ee6526d8e93ab8cfcc3ff91b13
> 
> That helps, thanks. Can you also mention how __latent_entropy changes
> non-functions? (i.e. initializes them with random data.)
> 
> Also, I think this isn't accurate:
> 
>  * local_entropy ^= get_random_long();
> 
> Looking at the disassembly, it seems that static random values (i.e.
> randomly chosen at gcc runtime) are added, rather than making calls to
> the kernel's get_random_long() function.

The plugin doesn't insert calls to the kernel's get_random_long().
That was just an example (the plugin instrumentation would look like this in the kernel).
I rewrote these calls to a random constant.

-- 
Emese

WARNING: multiple messages have this Message-ID (diff)
From: Emese Revfy <re.emese@gmail.com>
To: Kees Cook <keescook@chromium.org>
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 v2 1/3] Add the latent_entropy gcc plugin
Date: Wed, 15 Jun 2016 00:31:21 +0200	[thread overview]
Message-ID: <20160615003121.008b63c8152aa60c9c351530@gmail.com> (raw)
In-Reply-To: <CAGXu5j+-owKY_q-0Yow+OEsY3srdv0246H3ob-qRC6O3yg-qkg@mail.gmail.com>

On Tue, 14 Jun 2016 11:27:00 -0700
Kees Cook <keescook@chromium.org> wrote:

> On Mon, Jun 13, 2016 at 2:49 PM, Emese Revfy <re.emese@gmail.com> wrote:
> > On Thu, 9 Jun 2016 14:51:45 -0700
> > Kees Cook <keescook@chromium.org> wrote:
>
> >> > + * gcc plugin to help generate a little bit of entropy from program state,
> >> > + * used throughout the uptime of the kernel
> >>
> >> I think this comment needs a lot of expanding. What are all the ways
> >> that this plugin makes changes to code? Things I think I see are:
> >> pre-filling data variables with randomness, creating a local_entropy
> >> variable (local to what?), mixing stack pointer (into what?), updating
> >> latent_entropy global.
> >
> > I demonstrated the details here:
> > https://github.com/ephox-gcc-plugins/latent_entropy/commit/049acd9f478d47ee6526d8e93ab8cfcc3ff91b13
> 
> That helps, thanks. Can you also mention how __latent_entropy changes
> non-functions? (i.e. initializes them with random data.)
> 
> Also, I think this isn't accurate:
> 
>  * local_entropy ^= get_random_long();
> 
> Looking at the disassembly, it seems that static random values (i.e.
> randomly chosen at gcc runtime) are added, rather than making calls to
> the kernel's get_random_long() function.

The plugin doesn't insert calls to the kernel's get_random_long().
That was just an example (the plugin instrumentation would look like this in the kernel).
I rewrote these calls to a random constant.

-- 
Emese

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Emese Revfy <re.emese@gmail.com>
To: Kees Cook <keescook@chromium.org>
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: [kernel-hardening] Re: [PATCH v2 1/3] Add the latent_entropy gcc plugin
Date: Wed, 15 Jun 2016 00:31:21 +0200	[thread overview]
Message-ID: <20160615003121.008b63c8152aa60c9c351530@gmail.com> (raw)
In-Reply-To: <CAGXu5j+-owKY_q-0Yow+OEsY3srdv0246H3ob-qRC6O3yg-qkg@mail.gmail.com>

On Tue, 14 Jun 2016 11:27:00 -0700
Kees Cook <keescook@chromium.org> wrote:

> On Mon, Jun 13, 2016 at 2:49 PM, Emese Revfy <re.emese@gmail.com> wrote:
> > On Thu, 9 Jun 2016 14:51:45 -0700
> > Kees Cook <keescook@chromium.org> wrote:
>
> >> > + * gcc plugin to help generate a little bit of entropy from program state,
> >> > + * used throughout the uptime of the kernel
> >>
> >> I think this comment needs a lot of expanding. What are all the ways
> >> that this plugin makes changes to code? Things I think I see are:
> >> pre-filling data variables with randomness, creating a local_entropy
> >> variable (local to what?), mixing stack pointer (into what?), updating
> >> latent_entropy global.
> >
> > I demonstrated the details here:
> > https://github.com/ephox-gcc-plugins/latent_entropy/commit/049acd9f478d47ee6526d8e93ab8cfcc3ff91b13
> 
> That helps, thanks. Can you also mention how __latent_entropy changes
> non-functions? (i.e. initializes them with random data.)
> 
> Also, I think this isn't accurate:
> 
>  * local_entropy ^= get_random_long();
> 
> Looking at the disassembly, it seems that static random values (i.e.
> randomly chosen at gcc runtime) are added, rather than making calls to
> the kernel's get_random_long() function.

The plugin doesn't insert calls to the kernel's get_random_long().
That was just an example (the plugin instrumentation would look like this in the kernel).
I rewrote these calls to a random constant.

-- 
Emese

  reply	other threads:[~2016-06-14 22:24 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 23:30 [PATCH v2 0/3] Introduce the latent_entropy gcc plugin Emese Revfy
2016-05-30 23:30 ` [kernel-hardening] " Emese Revfy
2016-05-30 23:30 ` Emese Revfy
2016-05-30 23:31 ` [PATCH v2 1/3] Add " Emese Revfy
2016-05-30 23:31   ` [kernel-hardening] " Emese Revfy
2016-05-30 23:31   ` Emese Revfy
2016-06-01 19:42   ` Andrew Morton
2016-06-01 19:42     ` [kernel-hardening] " Andrew Morton
2016-06-01 19:42     ` Andrew Morton
2016-06-03 17:42     ` Emese Revfy
2016-06-03 17:42       ` [kernel-hardening] " Emese Revfy
2016-06-03 17:42       ` Emese Revfy
2016-06-06 13:38       ` [kernel-hardening] " David Brown
2016-06-06 13:38         ` David Brown
2016-06-06 15:50         ` Kees Cook
2016-06-06 15:50           ` Kees Cook
2016-06-06 15:50           ` Kees Cook
2016-06-06 19:30         ` PaX Team
2016-06-06 19:30           ` PaX Team
2016-06-06 23:13           ` Theodore Ts'o
2016-06-06 23:13             ` Theodore Ts'o
2016-06-07 12:19             ` PaX Team
2016-06-07 12:19               ` PaX Team
2016-06-07 13:58               ` Theodore Ts'o
2016-06-07 13:58                 ` Theodore Ts'o
2016-06-09 17:22                 ` PaX Team
2016-06-09 17:22                   ` PaX Team
2016-06-09 19:55                   ` Theodore Ts'o
2016-06-09 19:55                     ` Theodore Ts'o
2016-06-09 20:08                     ` Kees Cook
2016-06-09 20:08                       ` Kees Cook
2016-06-09 20:08                       ` Kees Cook
2016-06-09 21:51   ` Kees Cook
2016-06-09 21:51     ` [kernel-hardening] " Kees Cook
2016-06-09 21:51     ` Kees Cook
2016-06-09 21:51     ` Kees Cook
2016-06-13 21:49     ` Emese Revfy
2016-06-13 21:49       ` [kernel-hardening] " Emese Revfy
2016-06-13 21:49       ` Emese Revfy
2016-06-13 21:49       ` Emese Revfy
2016-06-14 18:27       ` Kees Cook
2016-06-14 18:27         ` [kernel-hardening] " Kees Cook
2016-06-14 18:27         ` Kees Cook
2016-06-14 18:27         ` Kees Cook
2016-06-14 22:31         ` Emese Revfy [this message]
2016-06-14 22:31           ` [kernel-hardening] " Emese Revfy
2016-06-14 22:31           ` Emese Revfy
2016-06-14 22:31           ` Emese Revfy
2016-05-30 23:32 ` [PATCH v2 2/3] Mark functions with the latent_entropy attribute Emese Revfy
2016-05-30 23:32   ` [kernel-hardening] " Emese Revfy
2016-05-30 23:32   ` Emese Revfy
2016-05-30 23:34 ` [PATCH v2 3/3] Add the extra_latent_entropy kernel parameter Emese Revfy
2016-05-30 23:34   ` [kernel-hardening] " Emese Revfy
2016-05-30 23:34   ` Emese Revfy
2016-06-09 21:18 ` [PATCH v2 0/3] Introduce the latent_entropy gcc plugin Kees Cook
2016-06-09 21:18   ` [kernel-hardening] " Kees Cook
2016-06-09 21:18   ` Kees Cook
2016-06-09 21:18   ` Kees Cook
2016-06-09 23:33   ` Emese Revfy
2016-06-09 23:33     ` [kernel-hardening] " Emese Revfy
2016-06-09 23:33     ` Emese Revfy
2016-06-09 23:33     ` 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=20160615003121.008b63c8152aa60c9c351530@gmail.com \
    --to=re.emese@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@sandisk.com \
    --cc=davem@davemloft.net \
    --cc=keescook@chromium.org \
    --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=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 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.