Re: git: 6e824f371301 - main - time: siginfo_recvd needs to be marked volatile
Date: Tue, 11 Jun 2024 03:13:45 UTC
On 5/31/24 14:52, Konstantin Belousov wrote: > On Wed, May 22, 2024 at 05:37:56AM +0000, Kyle Evans wrote: >> The branch main has been updated by kevans: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=6e824f3713011f7955a4f88fb16445e8e2cbe72c >> >> commit 6e824f3713011f7955a4f88fb16445e8e2cbe72c >> Author: Kyle Evans <kevans@FreeBSD.org> >> AuthorDate: 2024-05-22 05:36:29 +0000 >> Commit: Kyle Evans <kevans@FreeBSD.org> >> CommitDate: 2024-05-22 05:37:41 +0000 >> >> time: siginfo_recvd needs to be marked volatile > I do not think so. It happens to work with the compilers we currently use. > Sorry, I meant to respond but it got lost somewhere in the stack. Can you expand on this specifically a bit more? I was under the impression that we'd generally need volatility due to write from SIGINFO handler / read repeatedly from main(), which serves to demonstrate my ignorance here. Is it that there are sufficient side-effect-y things between loads in the wait4() loop that the compiler won't do anything hinky, or more that it's insufficient and should have been fenced as well? >> >> sig_atomic_t does not imply volatility, we must do it ourselves to avoid >> caching of siginfo_recvd loads. > For this purpose, standard provides atomic_signal_fence(). > > You would need to put it before read of siginfo_recvd (after wait4()), and > after update of siginfo_recvd in the signal handler.