Skip to content

userspace code can crash kernel thread (specifically ext4) if address is invalid #1

Description

@jncronin

ext4 thread assumes the lower half mappings for any user thread that passes messages to it

If the destination address is invalid, ext4 will fault and exit whereas instead the thread should.

We can either:

  • validate the destination address page by page with vtp or via checking the region against vblock

or:

  • for all kernel threads, allow them to handle invalid page faults themselves. Have translationfault handler update exception_regs so that the return is to a "handle_invalid_address" function or similar. This needs to then appear to the executing thread as though it had been called from the faulting instruction (i.e. lr set appropriately). It then throws an exception which should be caught by a try{} block higher up (e.g. protecting the memcpy in sdc_read/write).

The latter is more generic and preferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions