Messages in this thread |  | | Date | Wed, 13 Nov 2013 07:33:52 -0700 | From | David Ahern <> | Subject | Re: [PATCH 5/5] perf record: Handle out of space failures writing data with mmap |
| |
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
|  |