On 11/12/13, 2:19 PM, Ingo Molnar wrote:

So this isn't very robust, because it assumes that all sources of SIGBUS
are due to that memcpy() hitting -ENOSPC...

There are several failure modes:

  - If mmap_jmp is not set yet and we get a SIGBUS is some other place,
    then the longjmp() result will be undefined.

  - If mmap_jmp environment is set, but we've returned from
    do_mmap_output() already, then the result will be undefined - likely a
    non-obvious crash.

So at minimum we need a flag that tells us whether the jump environment is
valid or not - i.e. whether we are executing inside the protected region
or not - and only do the longjmp() if that flag is set.

Right I meant to add that -- a flag to know when the jmp should be used. Got distracted.


Is there really no other way to handle the -ENOSPC case robustly? I guess
not because the memcpy() really needs memory to write to, but I thought
I'd ask ...

You need some means to interrupt memcpy and bounce out of it. longjmp is the only option I know of.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to