From: pageexec@freemail.hu Subject: undefined behaviour in fs/jbd*/revoke.c:hash() Date: Thu, 16 Jun 2011 00:57:29 +0200 Message-ID: <4DF938D9.32713.4300B4D5@pageexec.freemail.hu> Reply-To: pageexec@freemail.hu Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Cc: sedat Dilek , bryce Lelbach , torok Edwin To: linux-fsdevel@vger.kernel.org Return-path: Received: from r00tworld.com ([212.85.137.150]:55822 "EHLO r00tworld.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753281Ab1FOXiT (ORCPT ); Wed, 15 Jun 2011 19:38:19 -0400 Content-description: Mail message body Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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