Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 2024 22:13:45 -0500
From:      Kyle Evans <kevans@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 6e824f371301 - main - time: siginfo_recvd needs to be marked volatile
Message-ID:  <58e93be2-d0bc-403c-8aaf-6d3f5e0dd069@FreeBSD.org>
In-Reply-To: <ZloqYlL6gBDPfAvP@kib.kiev.ua>
References:  <202405220537.44M5bugu007292@gitrepo.freebsd.org> <ZloqYlL6gBDPfAvP@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?58e93be2-d0bc-403c-8aaf-6d3f5e0dd069>