[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <nunn2n7geqbz7pra6x5wlpqxlqfkrolae22lqerk4klk4wfofy@wx5hquzmi527>
Date: Thu, 17 Jul 2025 00:24:47 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Jens Remus <jremus@...ux.ibm.com>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org, x86@...nel.org,
Steven Rostedt <rostedt@...nel.org>, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>, Ilya Leoshkevich <iii@...ux.ibm.com>,
Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Thomas Gleixner <tglx@...utronix.de>,
Andrii Nakryiko <andrii@...nel.org>, Indu Bhagat <indu.bhagat@...cle.com>,
"Jose E. Marchesi" <jemarch@....org>, Beau Belgrave <beaub@...ux.microsoft.com>,
Linus Torvalds <torvalds@...ux-foundation.org>, Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>, Florian Weimer <fweimer@...hat.com>, Sam James <sam@...too.org>
Subject: Re: [RFC PATCH v1 08/16] unwind_user: Enable archs that save RA/FP
in other registers
On Wed, Jul 16, 2025 at 11:57:51PM -0400, Steven Rostedt wrote:
> On Wed, 16 Jul 2025 19:01:06 -0700
> Josh Poimboeuf <jpoimboe@...nel.org> wrote:
>
> > > + if (unwind_user_get_reg(&ra, frame->ra.regnum))
> > > + goto done;
> > > + break;
> > > + default:
> > > + WARN_ON_ONCE(1);
> > > + goto done;
> >
> > The default case will never happen, can we make it a BUG()?
>
> Is this really serious enough to crash the system? WARN_ON_ONCE() *is* for
> things that will never happen.
>
> The only time I ever use BUG() is if it's too dangerous to continue (like a
> function graph trampoline that gets corrupted and has no place to return
> to). In general, usage of BUG() should be avoided.
This is an unreachable code path, but __builtin_unreachable() is crap
due to undefined behavior. IMO, BUG() for unreachable paths is cleaner
than WARN_ON_ONCE(), but it doesn't matter much either way I suppose.
--
Josh
Powered by blists - more mailing lists