On Wed, May 12, 2021 at 07:08:39PM -0500, Scott Cheloha wrote:
> Hi,
> 
> In a separate mail thread, bluhm@ mentioned that panic(9) does not
> cleanly handle multiple CPUs entering it simultaneously:
> 
> https://marc.info/?l=openbsd-tech&m=161908805925325&w=2
> 
> I'm unsure which part of panic(9) is causing the problem he mentions,
> but one obvious issue I see is that panicstr is not set atomically,
> so two CPUs entering panic(9) simultaneously may clobber panicbuf.
> 
> If we set panicstr atomically only one CPU will write panicbuf.
> 
> Thoughts?

I've seen panics caused by syzkaller where panicbuf looks scrambled by
more than one thread writing to the same static buffer. Assigning
panicstr before the vsnprintf() call therefore makes sense. This is also
what NetBSD does, although not as an atomic operation.

ok anton@

Reply via email to