On Thu, Jul 15, 2021 at 04:09:06PM +0100, Matthew Wilcox wrote: > On Thu, Jul 15, 2021 at 05:44:15PM +0300, Nikolay Borisov wrote: > > I was wondering the same thing, but AFAICS it seems to be possible i.e > > if userspace spaces bad offsets, while all kinds of internal fs > > synchronization ops are going to be performed on aligned offsets, that > > doesn't mean the original ones, passed from userspace are themselves > > aligned explicitly. > > Ah, I thought it'd be failed before we got to this point. > > But honestly, I think x86-64 needs to be fixed to either use > __builtin_memcmp() or to have a nicely written custom memcmp(). I > tried to find the gcc implementation of __builtin_memcmp() on > x86-64, but I can't. Yup, this. memcmp() is widley used in hot paths through all the filesystem code and the rest of the kernel. We should fix the generic infrastructure problem, not play whack-a-mole to with custom one-off fixes that avoid the problem just where it shows up in some profile... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx