lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jLPJRCX2G31khiMyn5eRuAMchF=k3j0qH0MdL7mXUCCrg@mail.gmail.com>
Date:	Wed, 2 Oct 2013 11:10:15 -0700
From:	Kees Cook <keescook@...omium.org>
To:	Stephane Eranian <eranian@...gle.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	"mingo@...e.hu" <mingo@...e.hu>,
	"ak@...ux.intel.com" <ak@...ux.intel.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...hat.com>,
	Hugh Dickins <hughd@...gle.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC] perf: mmap2 not covering VM_CLONE regions

On Wed, Oct 2, 2013 at 10:49 AM, Stephane Eranian <eranian@...gle.com> wrote:
> On Wed, Oct 2, 2013 at 7:29 PM, Kees Cook <keescook@...omium.org> wrote:
>> On Wed, Oct 2, 2013 at 10:20 AM, Stephane Eranian <eranian@...gle.com> wrote:
>>> On Wed, Oct 2, 2013 at 7:14 PM, Kees Cook <keescook@...omium.org> wrote:
>>>> On Wed, Oct 2, 2013 at 6:37 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>>>>> On Wed, Oct 02, 2013 at 03:13:16PM +0200, Stephane Eranian wrote:
>>>>>> On Wed, Oct 2, 2013 at 3:01 PM, Peter Zijlstra <peterz@...radead.org> wrote:
>>>>>> > On Wed, Oct 02, 2013 at 02:59:32PM +0200, Stephane Eranian wrote:
>>>>>> >> On Wed, Oct 2, 2013 at 2:46 PM, Peter Zijlstra <peterz@...radead.org> wrote:
>>>>>> >> > On Wed, Oct 02, 2013 at 02:39:53PM +0200, Ingo Molnar wrote:
>>>>>> >> >>  - then there are timing attacks, and someone having access to a PMU
>>>>>> >> >>    context and who can trigger this SHA1 computation arbitrarily in task
>>>>>> >> >>    local context can run very accurate and low noise timing attacks...
>>>>>> >> >>
>>>>>> >> >>    I don't think the kernel's sha_transform() is hardened against timing
>>>>>> >> >>    attacks, it's performance optimized so it has variable execution time
>>>>>> >> >>    highly dependent on plaintext input - which leaks information about the
>>>>>> >> >>    plaintext.
>>>>>> >> >
>>>>>> >> > Typical user doesn't have enough priv to profile kernel space; once you
>>>>>> >> > do you also have enough priv to see kernel addresses outright (ie.
>>>>>> >> > kallsyms etc..).
>>>>>> >> >
>>>>>> >> I was going to say just that. But that's not the default, paranoid level
>>>>>> >> is at 1 by default and not 2. So I supposedly can still do:
>>>>>> >>
>>>>>> >> $ perf record -e cycles ......
>>>>>> >>
>>>>>> >> In per-thread mode and collect kernel level addresses.
>>>>>> >
>>>>>> > Oh right you are.. so yes that's a very viable avenue.
>>>>>>
>>>>>> You mean simply encoding the vma->vm_mm as the ino number, for instance.
>>>>>
>>>>> Nah.. I think Kees would very much shoot us on the spot for doing that.
>>>>> But with the paranoid level defaulting to 1 the PMU attack on the kernel
>>>>> SHA implenentation is feasible.
>>>>
>>>> We already have other kernel address leaks (e.g. heap addresses via
>>>> INET_DIAG), and I'd like to avoid adding more. It'd be nice if there
>>>> was a common way to uniquely mask these values that are really just
>>>> "handles". We could use it both here and in the network code.
>>>>
>>>> Would it be possible to just have a "regular" incrementing handle,
>>>> like fd, or are we talking about doing that map for all VMAs, which
>>>> would make that mapping unfeasible due to storage needs?
>>>>
>>> All we need is a way to report that two vmas point to the same
>>> vma->vm_mm, i..e, same physical data. If I understand what
>>> you are suggesting, you'd add some sort of generation number
>>> to the vm_mm. Each new vm_mm gets a new number. That
>>> would work, I think. No kernel addresses reported directly nor
>>> hashed.
>>
>> Right. Is that workable? It sounds like this handle is only needed at
>> inspection time, though. Is this uniqueness test limited to a single
>> process, or is this uniqueness test across processes?
>>
> Each time that vm_mm is allocated we would allocate a new generation
> number.

Seems like a simple enough solution. Surely there must be a catch. :)

>
> Uniqueness is across processes. But that's by construction of the
> address space.

Okay, that's what I figured.

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ