* Coverity: jbd_unlock_bh_journal_head(): Memory - corruptions
@ 2019-11-12 1:35 coverity-bot
2019-11-12 11:09 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: coverity-bot @ 2019-11-12 1:35 UTC (permalink / raw)
To: Jan Kara; +Cc: Theodore Ts'o, Gustavo A. R. Silva, linux-next
Hello!
This is an experimental automated report about issues detected by Coverity
from a scan of next-20191108 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by recent commits:
c290ea01abb7 ("fs: Remove ext3 filesystem driver")
Coverity reported the following:
*** CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
/include/linux/jbd2.h: 351 in jbd_unlock_bh_journal_head()
345 {
346 bit_spin_lock(BH_JournalHead, &bh->b_state);
347 }
348
349 static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
350 {
vvv CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
vvv Passing "&bh->b_state" to function "bit_spin_unlock" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
351 bit_spin_unlock(BH_JournalHead, &bh->b_state);
352 }
353
354 #define J_ASSERT(assert) BUG_ON(!(assert))
355
356 #define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1487847 ("Memory - corruptions")
Fixes: c290ea01abb7 ("fs: Remove ext3 filesystem driver")
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Coverity: jbd_unlock_bh_journal_head(): Memory - corruptions
2019-11-12 1:35 Coverity: jbd_unlock_bh_journal_head(): Memory - corruptions coverity-bot
@ 2019-11-12 11:09 ` Jan Kara
2019-11-12 20:58 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2019-11-12 11:09 UTC (permalink / raw)
To: coverity-bot; +Cc: Jan Kara, Theodore Ts'o, Gustavo A. R. Silva, linux-next
Hello,
On Mon 11-11-19 17:35:18, coverity-bot wrote:
> This is an experimental automated report about issues detected by Coverity
> from a scan of next-20191108 as part of the linux-next weekly scan project:
> https://scan.coverity.com/projects/linux-next-weekly-scan
>
> You're getting this email because you were associated with the identified
> lines of code (noted below) that were touched by recent commits:
>
> c290ea01abb7 ("fs: Remove ext3 filesystem driver")
>
> Coverity reported the following:
>
> *** CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
> /include/linux/jbd2.h: 351 in jbd_unlock_bh_journal_head()
> 345 {
> 346 bit_spin_lock(BH_JournalHead, &bh->b_state);
> 347 }
> 348
> 349 static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
> 350 {
> vvv CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
> vvv Passing "&bh->b_state" to function "bit_spin_unlock" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> 351 bit_spin_unlock(BH_JournalHead, &bh->b_state);
> 352 }
This is obviously false positive. I guess coverity needs to learn about
bit-spinlocks so that it doesn't generate false positive report about each
usage?
Honza
> 353
> 354 #define J_ASSERT(assert) BUG_ON(!(assert))
> 355
> 356 #define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
>
> If this is a false positive, please let us know so we can mark it as
> such, or teach the Coverity rules to be smarter. If not, please make
> sure fixes get into linux-next. :) For patches fixing this, please
> include these lines (but double-check the "Fixes" first):
>
> Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
> Addresses-Coverity-ID: 1487847 ("Memory - corruptions")
> Fixes: c290ea01abb7 ("fs: Remove ext3 filesystem driver")
>
>
> Thanks for your attention!
>
> --
> Coverity-bot
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Coverity: jbd_unlock_bh_journal_head(): Memory - corruptions
2019-11-12 11:09 ` Jan Kara
@ 2019-11-12 20:58 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-11-12 20:58 UTC (permalink / raw)
To: Jan Kara; +Cc: Theodore Ts'o, Gustavo A. R. Silva, linux-next
On Tue, Nov 12, 2019 at 12:09:21PM +0100, Jan Kara wrote:
> Hello,
>
> On Mon 11-11-19 17:35:18, coverity-bot wrote:
> > This is an experimental automated report about issues detected by Coverity
> > from a scan of next-20191108 as part of the linux-next weekly scan project:
> > https://scan.coverity.com/projects/linux-next-weekly-scan
> >
> > You're getting this email because you were associated with the identified
> > lines of code (noted below) that were touched by recent commits:
> >
> > c290ea01abb7 ("fs: Remove ext3 filesystem driver")
> >
> > Coverity reported the following:
> >
> > *** CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
> > /include/linux/jbd2.h: 351 in jbd_unlock_bh_journal_head()
> > 345 {
> > 346 bit_spin_lock(BH_JournalHead, &bh->b_state);
> > 347 }
> > 348
> > 349 static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
> > 350 {
> > vvv CID 1487847: Memory - corruptions (ARRAY_VS_SINGLETON)
> > vvv Passing "&bh->b_state" to function "bit_spin_unlock" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> > 351 bit_spin_unlock(BH_JournalHead, &bh->b_state);
> > 352 }
>
> This is obviously false positive. I guess coverity needs to learn about
> bit-spinlocks so that it doesn't generate false positive report about each
> usage?
Yeah, that's a pretty weird glitch on Coverity's part. I've taken a note
on this subset of warnings. Thanks for looking at it!
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-12 20:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-12 1:35 Coverity: jbd_unlock_bh_journal_head(): Memory - corruptions coverity-bot
2019-11-12 11:09 ` Jan Kara
2019-11-12 20:58 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox