Re: [PATCH] Xarray: Fix race in xa_get_order()

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

 



On Sun, Mar 03, 2024 at 12:11:05PM +0000, Matthew Wilcox wrote:
> On Sat, Mar 02, 2024 at 10:13:28PM +0800, Han Xing Yi wrote:
> > Hello! This is my first patch ever, so please bear with me if I make some rookie
> > mistakes. I've tried my best to follow the documentation :) 
> 
> Thanks!  This is indeed a mistake.  Probably a harmless one, but worth
> fixing to silence the warning.

Yeah, it is probably harmless since the RCU write means that either the
old or new value will be read, but not a temporary value. Thanks for
pointing this out!

> Annoyingly, building with C=1 (sparse) finds the problem:
> 
>   CHECK   ../lib/xarray.c
> ../lib/xarray.c:1779:54: warning: incorrect type in argument 1 (different address spaces)
> ../lib/xarray.c:1779:54:    expected void const *entry
> ../lib/xarray.c:1779:54:    got void [noderef] __rcu *
> 
> so that means I got out of the habit of running sparse, and for some
> reason none of the build bots notified me of the new warning (or I
> missed that email).

I'm so sorry for this mistake, I did not build the kernel with sparse
when testing the patch. I'll be sure to do that next time around. 

> This is such a common thing to do that I have a helper for it.
> So what I'll actually commit is:
> 
> -               if (!xa_is_sibling(xas.xa_node->slots[slot]))
> +               if (!xa_is_sibling(xa_entry(xas.xa, xas.xa_node, slot)))
> 
> but I'll leave your name on it since you did the actual work.

Thank you so much for fixing my mistakes and your quick response on
this, I really appreciate it :)




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

  Powered by Linux