Re: [RFC PATCH v1 08/16] unwind_user: Enable archs that save RA/FP in other registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux