linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Q: si_code for SIGBUS caused by mmap() write error
@ 2017-05-08  9:27 Stoermeldung Infrastruktur-Ukr
  2017-05-08 13:09 ` Antw: " Ulrich Windl
  0 siblings, 1 reply; 2+ messages in thread
From: Stoermeldung Infrastruktur-Ukr @ 2017-05-08  9:27 UTC (permalink / raw)
  To: linux-mm; +Cc: Ulrich Windl, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1024 bytes --]

Hi!

I observed this for 3.0.101-97 kernel (SLES11 SP4, x86_64): When a mmap()ed file has a write error (e.g. bad sector), the program is terminated with SIGBUS. Trying to handle the situation, I noticed that the error code in siginfo is 2 (BUS_ADRERR, nonexistent physical address). My expectation was that the error would be 3 (BUS_OBJERR, object-specific hardware error).

For debugging I created this dummy device with a bad block:
DEV=bad_disk
dmsetup create "$DEV" <<EOF
0 8 zero
8 1 error
9 255 zero
EOF

The kernel error logged is " kernel: [2932614.419355] Buffer I/O error on device dm-8, logical block 1"

Is my expectation on the si_code wrong, or is the implementation wrong?

At a quick glance at do_sigbus() of /usr/src/linux/arch/x86/mm/fault.c I see that only codes BUS_ADRERR (default) and BUS_MCEERR_AR are used. However I don't know whether I looked at the correct source.
(The code in 4.4.62 still looks similar)

Regards,
Ulrich Windl
P.S: Keep me on CC: in your replies, please!

[-- Attachment #1.2: HTML --]
[-- Type: text/html, Size: 1653 bytes --]

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

end of thread, other threads:[~2017-05-08 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08  9:27 Q: si_code for SIGBUS caused by mmap() write error Stoermeldung Infrastruktur-Ukr
2017-05-08 13:09 ` Antw: " Ulrich Windl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox