stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [4.1 backport trouble] Re: BUGreport: fix minor infoleak in get_user_ex()
       [not found]     ` <20161028164033.GA29952@zipoli.ccur.com>
@ 2016-10-28 18:21       ` Linus Torvalds
  2016-10-28 19:49         ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2016-10-28 18:21 UTC (permalink / raw)
  To: Joe Korty; +Cc: Al Viro, Linux Kernel Mailing List, Sasha Levin, stable

 rea

On Fri, Oct 28, 2016 at 9:40 AM, Joe Korty <joe.korty@concurrent.com> wrote:
>
> Backporting 548acf19234d to 4.1.35 does indeed fix the
> issue.  However, it is not clear to my _why_ it works,
> so it might be better that someone else push the backport
> to stable.

The problem is that the old _ASM_EXTABLE_EXT hackery ends up being
this code in fixup_exception() back in 4.1 (and later).

                if (fixup->fixup - fixup->insn >= 0x7ffffff0 - 4) {
                        /* Special hack for uaccess_err */
                        current_thread_info()->uaccess_err = 1;
                        new_ip -= 0x7ffffff0;
                }

and it really does depend very intimately on the relationship with the
"fixup" address (fixup->fixup) with the instruction that took the
fault (fixup->insn).

Now, back in the original 4.1 days, that fixup-vs-insn relationship
was trivially always the case, since __get_user_asm_ex() always just
made the fixup be to fall through to the next instruction.

However, when commit 1c109fabbd51 ("fix minor infoleak in
get_user_ex()") was backported, now the fixup for __get_user_asm_ex()
ends up being in a different section entirely (".section .fixup"), and
the close relationship between the faulting instruction and the fixup
instruction went away.

End result: commit 1c109fabbd51lly effectively and very subtly depends
on commit 548acf19234d (introduced in v4.6) that gets rid of the
special hack.

Adding "stable" to the cc, because this might well affect other stable
backports than 4.1.

End result: either commit 1c109fabbd51 shouldn't be backported (it's
really not that important - if people properly check the exception
error results it shouldn't matter), or you need to also backport
548acf19234d as Al suggested.

I'd be inclined to say "don't backport 1c109fabbd51", but it's really
a judgment call.

           Linus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [4.1 backport trouble] Re: BUGreport: fix minor infoleak in get_user_ex()
  2016-10-28 18:21       ` [4.1 backport trouble] Re: BUGreport: fix minor infoleak in get_user_ex() Linus Torvalds
@ 2016-10-28 19:49         ` Al Viro
  2016-10-28 21:29           ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2016-10-28 19:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Joe Korty, Linux Kernel Mailing List, Sasha Levin, stable

On Fri, Oct 28, 2016 at 11:21:24AM -0700, Linus Torvalds wrote:

> End result: either commit 1c109fabbd51 shouldn't be backported (it's
> really not that important - if people properly check the exception
> error results it shouldn't matter), or you need to also backport
> 548acf19234d as Al suggested.
> 
> I'd be inclined to say "don't backport 1c109fabbd51", but it's really
> a judgment call.

*nod*

FWIW, that infoleak _does_ allow to leak an uninitialized word into
coredump (in sigreturn the value from uninitialized local variable is
copied into pt_regs of process and when we eventually check that error
has happened and hit the sucker with SIGSEGV, that value gets stored into
the coredump), but in the worst case that's 64 bits leaked from fixed depth
in the kernel stack of attacker's process, with fixed call chain.

I very much doubt that it's escalatable to anything practically interesting.
If spender et.al. can come up with a usable way to escalate that, I would be
quite surprised (and would love to see the details), but hey, it might be
possible.  More likely possibility is that the bug is harmless in practice.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [4.1 backport trouble] Re: BUGreport: fix minor infoleak in get_user_ex()
  2016-10-28 19:49         ` Al Viro
@ 2016-10-28 21:29           ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2016-10-28 21:29 UTC (permalink / raw)
  To: Al Viro
  Cc: Linus Torvalds, Joe Korty, Linux Kernel Mailing List, Sasha Levin,
	stable

On Fri, Oct 28, 2016 at 08:49:58PM +0100, Al Viro wrote:
> On Fri, Oct 28, 2016 at 11:21:24AM -0700, Linus Torvalds wrote:
> 
> > End result: either commit 1c109fabbd51 shouldn't be backported (it's
> > really not that important - if people properly check the exception
> > error results it shouldn't matter), or you need to also backport
> > 548acf19234d as Al suggested.
> > 
> > I'd be inclined to say "don't backport 1c109fabbd51", but it's really
> > a judgment call.
> 
> *nod*
> 
> FWIW, that infoleak _does_ allow to leak an uninitialized word into
> coredump (in sigreturn the value from uninitialized local variable is
> copied into pt_regs of process and when we eventually check that error
> has happened and hit the sucker with SIGSEGV, that value gets stored into
> the coredump), but in the worst case that's 64 bits leaked from fixed depth
> in the kernel stack of attacker's process, with fixed call chain.
> 
> I very much doubt that it's escalatable to anything practically interesting.
> If spender et.al. can come up with a usable way to escalate that, I would be
> quite surprised (and would love to see the details), but hey, it might be
> possible.  More likely possibility is that the bug is harmless in practice.

Hm, I think I'll backport 548acf19234d to 4.4-stable, as people have
shown that leaking anything can be used in odd ways that they shouldn't
be, just to be "safe" :)

thanks for the heads up.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-28 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20161027193210.GA23006@zipoli.ccur.com>
     [not found] ` <20161028000355.GK19539@ZenIV.linux.org.uk>
     [not found]   ` <20161028020210.GL19539@ZenIV.linux.org.uk>
     [not found]     ` <20161028164033.GA29952@zipoli.ccur.com>
2016-10-28 18:21       ` [4.1 backport trouble] Re: BUGreport: fix minor infoleak in get_user_ex() Linus Torvalds
2016-10-28 19:49         ` Al Viro
2016-10-28 21:29           ` Greg KH

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