lkml.org 
[lkml]   [2023]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [EXTERNAL] Re: audit: io_uring openat triggers audit reference count underflow in worker thread
Date
I retested with the following change as a sanity check:

- BUG_ON(name->refcnt <= 0);
+ BUG_ON(atomic_read(&name->refcnt) <= 0);

checkpatch.pl suggests using WARN_ON_ONCE rather than BUG.

devvm ~ $ ~/linux/scripts/checkpatch.pl --patch ~/io_uring_audit_hang_atomic.patch
WARNING: Do not crash the kernel unless it is absolutely unavoidable
--use WARN_ON_ONCE() plus recovery code (if feasible) instead of BUG() or variants
#28: FILE: fs/namei.c:262:
+ BUG_ON(atomic_read(&name->refcnt) <= 0);
...

refcount_t uses WARN_ON_ONCE.

I can think of three choices:

1. Use atomic_t and remove the BUG line.
2. Use refcount_t and remove the BUG line.
3. Use atomic_t and partially implement the warn behavior of refcount_t.

Choice 1 and 2 seem better than choice 3.



\
 
 \ /
  Last update: 2023-10-09 04:39    [W:0.169 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site