Re: [bisected] 3c8ba0d61d04ced9f8d9ff93977995a9e4e96e91 oopses on s390

From: Sebastian Ott
Date: Mon Apr 09 2018 - 12:18:45 EST


On Fri, 6 Apr 2018, Kees Cook wrote:
> On Fri, Apr 6, 2018 at 2:47 AM, Sebastian Ott <sebott@xxxxxxxxxxxxxxxxxx> wrote:
> > Today's kernel oopsed on s390. Bisect points to:
> > 3c8ba0d61d04 ("kernel.h: Retain constant expression output for max()/min()")
> >
> > [ 1.898277] dasd-eckd 0.0.3304: DASD with 4 KB/block, 21636720 KB total size, 48 KB/track, compatible disk layout
> > [ 1.898308] ------------[ cut here ]------------
> > [ 1.898310] kernel BUG at block/bio.c:1798!
>
> Well that's extremely bad. :(

What happened is that the bio build by the partition detection code was
attempted to be split by the block layer because the block queue had a
max_sector setting of 0. blk_queue_max_hw_sectors uses min_not_zero.

Both of the following return 0 on my machine:
+ pr_warn("%u\n", min_not_zero(100, 1000));
+ pr_warn("%u\n", min_not_zero(1000, 100));

So, we now know what failed...the question is why?

Sebastian