linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* undefined behaviour in fs/jbd*/revoke.c:hash()
@ 2011-06-15 22:57 pageexec
  2011-06-16  0:29 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: pageexec @ 2011-06-15 22:57 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: sedat Dilek, bryce Lelbach, torok Edwin

hi guys,

with a clang compiled kernel while enabling -fcatch-undefined-behavior one gets
a runtime assert in find_revoke_record(), more precisely, in the inlined hash()
function.

the issue is that one of the expressions is 'hash << (hash_shift - 12)' which is
undefined (in C99 at least) when the shift count is negative and it so happens
that hash_shift is 8 because JOURNAL_REVOKE_DEFAULT_HASH is defined to be 256.

i'm not sure what the right fix would be hence this mail ;). JOURNAL_REVOKE_DEFAULT_HASH
could be increased to 4096 (or more) to avoid the negative shift or the shift
count should be fixed to become explicitly non-negative. also given the comment
above the hash() function, this construct may be used elsewhere as well, i didn't
check myself but it might be worth a look.

cheers,
 PaX Team


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-16  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 22:57 undefined behaviour in fs/jbd*/revoke.c:hash() pageexec
2011-06-16  0:29 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).