From: Christian Borntraeger <borntraeger@de.ibm.com>
To: linux-s390@vger.kernel.org
Subject: Re: sigsegv/sigbus not setting si_addr correctly for insn faults
Date: Mon, 02 Mar 2015 19:51:45 +0000 [thread overview]
Message-ID: <54F4BF51.2010504@de.ibm.com> (raw)
In-Reply-To: <20150302171835.GI8519@vapier>
Am 02.03.2015 um 18:18 schrieb Mike Frysinger:
> On 02 Mar 2015 09:56, Christian Borntraeger wrote:
>> Am 28.02.2015 um 22:24 schrieb Mike Frysinger:
>>> when running strace tests, we noticed that si_addr appears to be wrong. the
>>> attached test shows the problem -- si_addr isn't set to the faulting address.
>>>
>>> i hacked arch/s390/mm/fault.c:do_sigsegv to load regs->psw.addr (sans mask),
>>> and it worked for insn based crashes. but obviously that doesn't work for
>>> data based ones. i'm not familiar with how regs->int_parm_long works though,
>>> so maybe it's supposed to be loaded indirectly. the use of __FAIL_ADDR_MASK
>>> blindly is most certainly incorrect ...
>>>
>>> whatever the fix, do_sigbus probably needs it too.
>>
>> The problem is that all faults on s390 give the address only on page
>> granularity (HW-wise)
>> e.g. if you use 0x123456 as fail address you get si_addr == 0x123000
>
> can't you detect when the fault is data-vs-code access ? you could at least
> make the code fault exact.
> -mike
There is no indication which part caused the fault. Worst case: there can be
3 sources: instruction address, address1 and address 2 (for example the MVC
instruction). Now, we could start with "guessing", but what happens if 2 or
3 of the addresses are in the same page (e.g. some trampoline code on the
stack). Or we could start walking page tables: this would require us to decode
~1000 instructions just to race against other kernel code that does invalidation,
e.g. vmscan/swap. IMHO the proper solution is to accept that translation faults
are on the page, unless the maintainers Martin or Heiko have a clever idea.
Christian
PS: Programs that need the fault address might need special handling. For an example
have a look at valgrind: https://github.com/svn2github/valgrind/blob/master/coregrind/m_signals.c
line 2385 fault_mask
next parent reply other threads:[~2015-03-02 19:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150302171835.GI8519@vapier>
2015-03-02 19:51 ` Christian Borntraeger [this message]
2015-02-28 21:24 sigsegv/sigbus not setting si_addr correctly for insn faults Mike Frysinger
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=54F4BF51.2010504@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
/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