Q: si_code for SIGBUS caused by mmap() write error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux