lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sun, 8 Aug 2010 12:31:40 -0700 From: Don Mullis <don.mullis@...il.com> To: dedekind1@...il.com Cc: linux-kernel@...r.kernel.org, David Airlie <airlied@...ux.ie>, Dave Chinner <david@...morbit.com> Subject: Re: [PATCH 0/6] improve list_sort test Artem Bityutskiy <dedekind1@...il.com> writes: > Actually, your 'list_sort()' version does have a problem. I found out > that it calls 'cmp(priv, a, b)' with 'a = b' sometimes, and in these > cases 'a' and 'b' can point to something which is not a valid element of > the original list. Probably a senitel or something like that. > > It is easy to work around this by adding: > > if (a == b) > return 0; > > in the 'cmp()' function, but this is nevertheless a bug (not too bad, > though) and should be fixed. Yes, invalid 'a' or 'b' pointers would be a bug. If providing a test case is hard, can you say what segment is pointed to? Into the stack? Into address ranges normal for elements, but not now on the list? Is there a pattern to the values returned? Is it perhaps always the first or last callback from a particular call to list_sort()? That sometimes a==b is, on the other hand, by design: /* * In worst cases this loop may run many iterations. * Continue callbacks to the client even though no * element comparison is needed, so the client's cmp() * routine can invoke cond_resched() periodically. */ (*cmp)(priv, tail, tail); Adding a sentence to the function header comment reminding callers that they need to be able to handle a==b seems like a good idea. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists