tech-kern archive

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

Re: Fixing excessive shootdowns during FFS read (kern/53124) on x86 - emap, direct map



On 6/10/2018 3:02 PM, Jaromír Doleček wrote:
2018-05-12 21:24 GMT+02:00 Chuck Silvers <chuq%chuq.com@localhost>:
the problem with keeping the pages locked (ie. PG_BUSY) while accessing
the user address space is that it can lead to deadlock if the page
Meanwhile I've tested this scenario - wrote a test program to do
mmap(2) for file, then calling write() using the memory from mmap as
the buffer for write(2) for the same file offset.

It actually caused the process to get SIGSEGV with new code, where the
old code made write(2) just returned with EINVAL. I think this happens
because fault resolution returns EINVAL when the page has PG_BUSY.
Funny thing is that actually on Mac OS X that code actually does end
up with deadlock, and unkillable process :D

Maybe the SIGSEGV is actually acceptable behaviour? I don't think
there would be valid reason to do mmap(2)/write(2) combination like
that.

FWIW, a similar test on a Linux box (Debian 8, 3.16 kernel) works w/o errors but behaves rather oddly if the offsets don't exactly line up. (e.g. w/ offset 1, the first 8 chars written repeat the first read, then every 32 chars one char is repeated) As long as we fail somehow, whether EINVAL or SIGSEGV, at least it'll be better than *that*. :)

Eric


Home | Main Index | Thread Index | Old Index