tech-kern archive

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

Re: SIGBUS + coredump



On 18.01.2019 09:00, Martin Husemann wrote:
> On Thu, Jan 17, 2019 at 09:52:17PM +0100, Kamil Rytarowski wrote:
>> The problem is that when we are in coredump_getseghdrs_elf64() and call
>> copyin_proc() -> copyin_vmspace() -> copyin() we trigger a trap that is
>> translated through trap() -> ... -> genfs_getpages() to EINVAL as there
>> are no pages assigned to a mamory address.
> 
> This is normal behaviour and uvm should assign an empty page at that
> point. Why is that not working - i.e. what is special about this situation?
> 
> Martin
> 

It's not working because in genfs_getpages() we trigger the following
condition:

        /*
         * Bounds-check the request.
         */

        if (origoffset + (ap->a_centeridx << PAGE_SHIFT) >= memeof) {
                if ((flags & PGO_LOCKED) == 0) {
                        mutex_exit(uobj->vmobjlock);
                }
                UVMHIST_LOG(ubchist, "off 0x%jx count %jd goes past EOF
0x%jx",
                    origoffset, *ap->a_count, memeof,0);
                error = EINVAL;
                goto out_err;
        }

 -- src/sys/miscfs/genfs/genfs_io.c

The test deliberately triggers equivalent scenario that results with a
trap and a core(5) file generation, issuing a SIGBUS signal.

The expected behavior is to dumped these page(s) into a core(5) file
with a zeroed content.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index