From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4368B3858402; Fri, 25 Feb 2022 00:12:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4368B3858402 From: "dannf at dannf dot org" To: systemtap@sourceware.org Subject: [Bug uprobes/28923] New: dtrace predictable temp file causes race Date: Fri, 25 Feb 2022 00:12:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: uprobes X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dannf at dannf dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2022 00:12:06 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28923 Bug ID: 28923 Summary: dtrace predictable temp file causes race Product: systemtap Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: uprobes Assignee: systemtap at sourceware dot org Reporter: dannf at dannf dot org Target Milestone: --- Hi! I've been seeing an issue when re-building the libvirt package from Ubuntu 20.04 on a 48-core system where it frequently crashes in dtrace. I created a simple reproducer for it: ------------------------------ user@host:~$ cat foo/Makefile=20 all: ../foo/foo.out foo.out %.out: dtrace -o foo.out -G -s /dev/null clean: rm -f foo.out user@host:~$ cd foo user@host:~/foo$ make dtrace -o foo.out -G -s /dev/null user@host:~/foo$ make clean rm -f foo.out user@host:~/foo$ make -j2 dtrace -o foo.out -G -s /dev/null dtrace -o foo.out -G -s /dev/null Traceback (most recent call last): File "/usr/bin/dtrace", line 455, in sys.exit(main()) File "/usr/bin/dtrace", line 440, in main os.remove(fname) FileNotFoundError: [Errno 2] No such file or directory: 'foo.out.dtrace-tem= p.c' make: *** [Makefile:4: ../foo/foo.out] Error 1 ------------------------------ Here we have 2 targets that actually resolve to the same file. It seems like something about the way pattern matching (%) works prevents make from reali= zing that. So, a parallel make will execute 2 dtrace processes to build the same file. Because dtrace uses the same temporary filename for both - foo.out.dtrace-temp.c - they race, and one dtrace delete the file while the other is still processing it. Calling dtrace w/ -k works around the problem= for me because it prevents the first dtrace process from trying to delete the f= ile. But that likely just leaves a harder-to-hit race where one dtrace process t= ries to re-write the process while the other is processing it. The reason dtrace uses the same temp filename is for reproducible builds: =20 https://sourceware.org/git/?p=3Dsystemtap.git;a=3Dcommitdiff;h=3Dc245153ca1= 93c471a8c8a2650834dc2f0b801bc1 The reproducible builds project suggests an alternative method of overriding the .file directive: https://reproducible-builds.org/docs/randomness/ Unfortunately I haven't found a good way to override .file outside of an assembly file. -dann --=20 You are receiving this mail because: You are the assignee for the bug.=