Summary: | race in lib/libc/nls/msgcat.c | ||
---|---|---|---|
Product: | Base System | Reporter: | Henry Hu <henry.hu.sh> |
Component: | threads | Assignee: | Xin LI <delphij> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | delphij, emaste, gabor |
Priority: | --- | Keywords: | patch |
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Henry Hu
2015-08-25 03:21:04 UTC
I can reproduce this on -CURRENT with LANG=zh_CN.UTF-8 (but not with my default en_CA.UTF-8) and the analysis seems sound. Note that the proposed patch changes the only uses of RLOCK to WLOCK so this change is in effect removing r/w locking. A commit references this bug: Author: delphij Date: Thu Mar 19 06:33:06 UTC 2020 New revision: 359118 URL: https://svnweb.freebsd.org/changeset/base/359118 Log: Fix race condition in catopen(3). The current code uses a rwlock to protect the cached list, which in turn holds a list of catentry objects, and increments reference count while holding only read lock. Fix this by converting the reference counter to use atomic operations. While I'm there, also perform some clean ups around memory operations. PR: 202636 Reported by: Henry Hu <henry.hu.sh@gmail.com> Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24095 Changes: head/lib/libc/nls/msgcat.c |