Re: [PATCH] fs: ratelimit __find_get_block_slow() failure message.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019/01/16 19:43, Jan Kara wrote:
> On Wed 16-01-19 10:47:56, Dmitry Vyukov wrote:
>>> I still cannot catch. Read/write of sizeof(long) bytes at naturally
>>> aligned address is atomic, isn't it?
>>
>> Nobody guarantees this. According to C non-atomic conflicting
>> reads/writes of sizeof(long) cause undefined behavior of the whole
>> program.
> 
> Yes, but to be fair the kernel has always relied on long accesses to be
> atomic pretty heavily so that it is now de-facto standard for the kernel
> AFAICT. I understand this makes life for static checkers hard but such is
> reality.

Regarding "load a long word from naturally aligned address" and 
"store a long word to naturally aligned address", they are required to be atomic
in Linux kernel, (for it is described as "On all systems running Linux, loads from
and stores to pointers are atomic, that is, if a store to a pointer occurs at the
same time as a load from that same pointer, the load will return either the initial
value or the value stored, never some bitwise mashup of the two." at
https://lwn.net/Articles/262464/ ) aren't they?

And I know we need to use READ_ONCE()/WRITE_ONCE() etc. when we need to guarantee
that reordering/reloading is not acceptable. But what damage can cause for this
specific case? It does only "compare two long variables" in addition to "load a
long word from naturally aligned address" and "store a long word to naturally
aligned address". Reordering/reloading these variables won't cause severe problems.

> 
> But in this particular case I agree with you that special logic is not
> really warranted.

Anyway, do we apply V2 patch at
https://marc.info/?i=cd9c47c9-1dc6-6949-a138-703f6a10bc9b@xxxxxxxxxxxxxxxxxxx ?



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux