dtrace predictable temp file causes race
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemtap (Debian) |
Fix Released
|
Unknown
|
|||
systemtap (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
dann frazier | ||
Impish |
Fix Released
|
Undecided
|
dann frazier | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
dtrace generates .c code in a predictable temporary file which makes it susceptible to crashes. I've seen this happen in practice when rebuilding libvirt/focal on a system with 48 cores. The race window is wide enough that the crash is nearly 100% reproducible.
[Test Case]
user@host:~$ cat foo/Makefile
all: ../foo/foo.out foo.out
%.out:
dtrace -o $@ -G -s /dev/null
clean:
rm -f foo.out
user@host:~$ cd foo
user@host:~/foo$ make
dtrace -o ../foo/foo.out -G -s /dev/null
user@host:~/foo$ make clean
rm -f foo.out
user@host:~/foo$ make -j2
dtrace -o ../foo/foo.out -G -s /dev/null
dtrace -o foo.out -G -s /dev/null
Traceback (most recent call last):
File "/usr/bin/dtrace", line 445, in <module>
sys.
File "/usr/bin/dtrace", line 432, in main
os.
FileNotFoundError: [Errno 2] No such file or directory: 'foo.out.
make: *** [Makefile:4: foo.out] Error 1
[Fix]
https:/
[What could go wrong]
It is possible that a race still exists, but the fix should be an overall improvement. Perhaps it is possible that a funky filename string could cause UTF-8 encoding to fail resulting in a crash - though it would seem that such input wouldn't be a valid path name and dtrace would crash anyway.
Changed in systemtap (Debian): | |
status: | Unknown → New |
Changed in systemtap (Debian): | |
status: | New → Fix Released |
Changed in systemtap (Ubuntu Impish): | |
status: | New → In Progress |
Changed in systemtap (Ubuntu Focal): | |
status: | New → In Progress |
assignee: | nobody → dann frazier (dannf) |
Changed in systemtap (Ubuntu Impish): | |
assignee: | nobody → dann frazier (dannf) |
description: | updated |
description: | updated |
Suggest adding commit cfabd38cfdd75e also, which makes it more robust toward identical concurrent jobs.