linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>,
	Brian Gerst <brgerst@gmail.com>,
	Julien Thierry <julien.thierry@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Will Deacon <will.deacon@arm.com>,
	valentin.schneider@arm.com, Ingo Molnar <mingo@redhat.com>,
	James Morse <james.morse@arm.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	"linux-alpha@vger.kernel.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC][PATCH] objtool: STAC/CLAC validation
Date: Fri, 22 Feb 2019 17:12:33 -0800	[thread overview]
Message-ID: <CAHk-=wjmp0UugFnD2KaXyGO8RprfgULwMhseDhAxQQMqqL1Eiw@mail.gmail.com> (raw)
In-Reply-To: <CALCETrVw18nHQGPqg_OF=pD7NePafYQ_c1MhfSm_OCQ-O3xzhQ@mail.gmail.com>

On Fri, Feb 22, 2019 at 4:34 PM Andy Lutomirski <luto@kernel.org> wrote:
>
> [mailing lists removed because this is a potentially large source of exploits]

I think you're overly worried.

AC doesn't protect against "large source of exploits". If it did, then
all CPU's before Broadwell would be insecure. They aren't. They'd
better not be, considering that there's a _lot_ of Xeon machines out
there based on older microarchitectures. I think some of them might
even be reasonably current (eg Xeon E7v3 isn't _that_ old, and is
Haswell-based, and doesn't have SMAP afaik).

SMAP is a great debugging and development aid, and makes sure that
developers - who hopefully run primarily on modern platforms - don't
write code that just accesses user space directly (because with SMAP,
it won't work).

And yes, SMAP can limit the effect of kernel bugs, and turn something
that would otherwise be a security issue into "just a bug".

But running with AC on isn't a security issue in itself - it just
makes SMAP slightly less powerful. The biggest issue of the whole "AC
doesn't get saved/redstored" is actually the *reverse* case, where a
preemption event could then cause a process that had AC on to be
scheduled away, then AC would stay on for some time, but then we might
schedule back with AC _clear_, and now you'd have a non-working user
access, and a possible DoS attack as a result because you returned
EFAULT to a system call that was perfectly fine.

See? It's not so much "AC stays on" that is a "sky is falling" issue,
it's actually "AC also gets turned off randomly" that actually has
real and immediate effects. "AC on" is unfortunate and not great,
don't get me wrong, but it's definitely not the end of the world.
Particularly not for short sequences.

That said:

> Um, wait a moment.  You didn't find an oddity in ptrace.c.  You found
> a giant freaking error in uaccess.h.

I agree that your patch is good, and should be applied. Mind writing
up a changelog and committing it to -tip?

> Am I missing something?  How are there not zillions of instances of
> this that your patch ought to catch?  Or is genregs_get() really the
> only example?

I really do think that it's very unusual to do "get/put_user()" with
complicated value arguments. So while your patch is obviously the
right thing to do, I really don't think this is a huge worry, or all
_that_ surprising that this issue apparently found just a single case
of a function call.

With all that said, I didn't even react to this part of PeterZ's
patch, but it's a good call, and I think it's also a great validation
of the objtool approach to validating AC. So cheers for that!

                Linus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-23  1:13 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 13:58 [PATCH v3 0/4] uaccess: Add unsafe accessors for arm64 Julien Thierry
2019-01-15 13:58 ` [PATCH v3 1/4] arm64: uaccess: Cleanup get/put_user() Julien Thierry
2019-01-15 13:58 ` [PATCH v3 2/4] arm64: uaccess: Implement unsafe accessors Julien Thierry
2019-01-15 13:58 ` [PATCH v3 3/4] uaccess: Check no rescheduling function is called in unsafe region Julien Thierry
2019-01-30 16:58   ` Valentin Schneider
2019-02-04 13:27     ` Julien Thierry
2019-02-11 13:45   ` Ingo Molnar
2019-02-11 13:51     ` Peter Zijlstra
2019-02-12  9:15       ` Julien Thierry
2019-02-13  8:21         ` Ingo Molnar
2019-02-13 10:35         ` Peter Zijlstra
2019-02-13 10:50           ` Julien Thierry
2019-02-13 13:17             ` Peter Zijlstra
2019-02-13 13:20               ` Peter Zijlstra
2019-02-13 14:00               ` Will Deacon
2019-02-13 14:07                 ` Julien Thierry
2019-02-13 14:17                 ` Peter Zijlstra
2019-02-13 14:24                   ` Julien Thierry
2019-02-13 14:40                     ` Peter Zijlstra
2019-02-13 15:08                       ` Peter Zijlstra
2019-02-13 14:25                 ` Peter Zijlstra
2019-02-13 14:39                   ` Julien Thierry
2019-02-13 14:41                     ` Peter Zijlstra
2019-02-13 15:45                       ` Peter Zijlstra
2019-02-13 18:54                         ` Peter Zijlstra
     [not found]                         ` <D61C430D-4321-4114-AB85-671A3C7B8EAE@amacapital.net>
2019-02-13 22:21                           ` Peter Zijlstra
2019-02-13 22:49                             ` Andy Lutomirski
2019-02-14 10:14                               ` [PATCH] sched/x86: Save [ER]FLAGS on context switch Peter Zijlstra
2019-02-14 16:18                                 ` Brian Gerst
2019-02-14 19:34                                   ` Peter Zijlstra
2019-02-15 14:34                                     ` Brian Gerst
2019-02-15 17:18                                     ` Linus Torvalds
2019-02-15 17:40                                       ` Peter Zijlstra
2019-02-15 18:28                                         ` Andy Lutomirski
2019-02-15 23:34                                         ` Peter Zijlstra
2019-02-16  0:21                                           ` Linus Torvalds
2019-02-16 10:32                                             ` Peter Zijlstra
2019-02-16  4:06                                 ` hpa
2019-02-16 10:30                                   ` Peter Zijlstra
2019-02-18 22:30                                     ` H. Peter Anvin
2019-02-19  0:24                                       ` Linus Torvalds
2019-02-19  2:20                                         ` Andy Lutomirski
2019-02-19  2:46                                           ` H. Peter Anvin
2019-02-19  9:07                                             ` Julien Thierry
2019-02-19  8:53                                         ` Julien Thierry
2019-02-19  9:15                                         ` Peter Zijlstra
2019-02-19  9:19                                           ` Peter Zijlstra
2019-02-19  9:04                                       ` Peter Zijlstra
2019-02-19  9:21                                         ` hpa
2019-02-19  9:44                                         ` Peter Zijlstra
2019-02-19 11:38                                           ` Thomas Gleixner
2019-02-19 11:58                                             ` Peter Zijlstra
2019-02-19 12:48                                         ` Will Deacon
2019-02-20 22:55                                           ` H. Peter Anvin
2019-02-21 12:06                                             ` Julien Thierry
2019-02-21 21:35                                               ` Thomas Gleixner
2019-02-21 22:08                                                 ` Linus Torvalds
2019-02-22 12:58                                                   ` Peter Zijlstra
2019-02-22 18:10                                                   ` Thomas Gleixner
2019-02-22 22:26                                                     ` [RFC][PATCH] objtool: STAC/CLAC validation Peter Zijlstra
2019-02-22 23:34                                                       ` Linus Torvalds
2019-02-23  8:43                                                         ` Peter Zijlstra
2019-02-22 23:39                                                       ` hpa
2019-02-23  8:39                                                         ` Peter Zijlstra
2019-02-25  8:47                                                           ` hpa
2019-02-25 13:21                                                             ` Peter Zijlstra
2019-03-01 15:07                                                               ` Peter Zijlstra
2019-02-25  8:49                                                           ` hpa
2019-02-22 23:55                                                       ` Andy Lutomirski
2019-02-23  8:37                                                         ` Peter Zijlstra
2019-02-23 10:52                                                           ` Peter Zijlstra
2019-02-25 10:51                                                         ` Peter Zijlstra
2019-02-25 11:53                                                           ` Peter Zijlstra
2019-02-25 15:36                                                             ` Andy Lutomirski
2019-02-23  0:34                                                       ` Andy Lutomirski
2019-02-23  1:12                                                         ` Linus Torvalds [this message]
2019-02-23  1:16                                                           ` Andy Lutomirski
2019-02-23  1:33                                                             ` Linus Torvalds
2019-02-23  1:40                                                             ` Linus Torvalds
2019-02-25  8:33                                                       ` Julien Thierry
2019-02-25 11:55                                                         ` Peter Zijlstra
2019-02-21 12:46                                             ` [PATCH] sched/x86: Save [ER]FLAGS on context switch Will Deacon
2019-02-21 22:06                                               ` Andy Lutomirski
2019-02-18  9:03                                 ` [PATCH v2] " Peter Zijlstra
2019-02-13 23:19                         ` [PATCH v3 3/4] uaccess: Check no rescheduling function is called in unsafe region Linus Torvalds
2019-01-15 13:58 ` [PATCH v3 4/4] arm64: uaccess: Implement user_access_region_active Julien Thierry
2019-01-25 14:27 ` [PATCH v3 0/4] uaccess: Add unsafe accessors for arm64 Catalin Marinas
2019-01-30 16:17 ` Julien Thierry

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='CAHk-=wjmp0UugFnD2KaXyGO8RprfgULwMhseDhAxQQMqqL1Eiw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jpoimboe@redhat.com \
    --cc=julien.thierry@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=valentin.schneider@arm.com \
    --cc=will.deacon@arm.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;
as well as URLs for NNTP newsgroup(s).