On 7/11/20 3:31 AM, Dmitry Vyukov wrote: > rings_size() sets sq_offset to the total size of the rings > (the returned value which is used for memory allocation). > This is wrong: sq array should be located within the rings, > not after them. Set sq_offset to where it should be. > > Signed-off-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx> > Cc: io-uring@xxxxxxxxxxxxxxx > Cc: Hristo Venev <hristo@xxxxxxxxxx> > Fixes: 75b28affdd6a ("io_uring: allocate the two rings together") > > --- > This looks so wrong and yet io_uring works. > So I am either missing something very obvious here, > or io_uring worked only due to lucky side-effects > of rounding size to power-of-2 number of pages > (which gave it enough slack at the end), > maybe reading/writing some unrelated memory > with some sizes. > If I am wrong, please poke my nose into what I am not seeing. > Otherwise, we probably need to CC stable as well. Well that's a noodle scratcher, it's definitely been working fine, and I've never seen any out-of-bounds on any of the testing I do. I regularly run anything with KASAN enabled too. In any case, the patch is obviously correct, I'll queue it up. -- Jens Axboe