[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52838DD0.20906@gmail.com>
Date: Wed, 13 Nov 2013 07:33:52 -0700
From: David Ahern <dsahern@...il.com>
To: Ingo Molnar <mingo@...nel.org>
CC: acme@...stprotocols.net, linux-kernel@...r.kernel.org,
jolsa@...hat.com, Frederic Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Namhyung Kim <namhyung@...nel.org>,
Mike Galbraith <efault@....de>,
Stephane Eranian <eranian@...gle.com>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists