Re: git: 6e824f371301 - main - time: siginfo_recvd needs to be marked volatile

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Fri, 31 May 2024 19:52:02 UTC
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.

>     
>     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.