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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9cb17f4-b698-7d9b-d435-e715ee14c489@c-s.fr>
Date:   Tue, 18 Feb 2020 14:58:00 +0100
From:   Christophe Leroy <christophe.leroy@....fr>
To:     Masami Hiramatsu <mhiramat@...nel.org>
Cc:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Larry Finger <Larry.Finger@...inger.net>,
        "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
        linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        stable@...nel.vger.org,
        Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in
 real mode



Le 18/02/2020 à 13:33, Masami Hiramatsu a écrit :
> On Tue, 18 Feb 2020 12:04:41 +0100
> Christophe Leroy <christophe.leroy@....fr> wrote:
> 
>>>> Nevertheless, if one symbol has been forgotten in the blacklist, I think
>>>> it is a problem if it generate Oopses.
>>>
>>> There is a long history also on x86 to make a blacklist. Anyway, how did
>>> you get this error on PPC32? Somewhere would you like to probe and
>>> it is a real mode function? Or, it happened unexpectedly?
>>
>> The first Oops I got was triggered by a WARN_ON() kind of trap in real
>> mode. The trap exception handler called kprobe_handler() which tried to
>> read the instruction at the trap address (which was a real-mode address)
>> so it triggered a Bad Access Fault.
>>
>> This was initially the purpose of my patch.
> 
> OK, then filtering the trap reason in kprobe handler is a bit strange.
> It should be done in the previous stage (maybe in trap.c)

See commit 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.6-rc2&id=6cc89bad60a673a24386f1ada83de8a068a78909

> Can we filter it by exception flag or only by checking the instruction
> which causes the exception, or needs get_kprobe()...?

The trap instruction used by kprobe is also used for other purposes like 
BUG_ON() or WARN_ON(), so needs get_kprobe()



> 
>> After discussion with you, I started looking at what would be the effect
>> of setting a kprobe event in a function which runs in real mode.
> 
> If the kprobe single-stepping (or emulation) works in real mode, just
> ignore the kprobes pre/post_handlers and increment nmissed count.
> 
> If that doesn't work, we have to call a BUG_ON, because we can not
> continue the code execution. And also, you have to find a way to make
> a blacklist for real mode code.

Yes, it has to be done function by function (hoppefully there's not more 
than a dozen).
But I'd like something which can fails gracefully for the functions we 
will forget to mark noprobe.

But as a first step I'd really like a bug fix in 5.6 to avoid Oopsing in 
kprobe_handler() at a non-kprobe trap.

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ