lkml.org 
[lkml]   [2013]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2013-11-13 15:41    [W:0.063 / U:4.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site