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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 13 Dec 2015 01:17:12 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Andrey Ryabinin <aryabinin@...n.com>,
	Wu Fengguang <fengguang.wu@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	LKML <linux-kernel@...r.kernel.org>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Sasha Levin <sasha.levin@...cle.com>
Subject: Re: undefined shift in wb_update_dirty_ratelimit()

On Mon, Dec 7, 2015 at 4:26 PM, Tejun Heo <tj@...nel.org> wrote:
> Hello, Andrey.
> On Mon, Dec 07, 2015 at 05:17:06PM +0300, Andrey Ryabinin wrote:
>> I've hit undefined shift in wb_update_dirty_ratelimit() which does some
>> mysterious 'step' calculations:
>>
>>       /*
>>        * Don't pursue 100% rate matching. It's impossible since the balanced
>>        * rate itself is constantly fluctuating. So decrease the track speed
>>        * when it gets close to the target. Helps eliminate pointless tremors.
>>        */
>>       step >>= dirty_ratelimit / (2 * step + 1);
>>
>>
>> dirty_ratelimit = INIT_BW and step = 0 results in this:
>>
>> [ 5006.957366] ================================================================================
>> [ 5006.957798] UBSAN: Undefined behaviour in ../mm/page-writeback.c:1286:7
>> [ 5006.958091] shift exponent 25600 is too large for 64-bit type 'long unsigned int'
>
> We prolly should do sth like
>
>         shift = dirty_ratelimit / (2 * step = 1);

>         if (shift < BITS_PER_LONG) {
>                 step = (step >> shift) + 7 / 8;

7/8 = 0. Missed parens?
In that case it's DIV_ROUND_UP(step >> shift, 8)


>         } else {
>                 step = 0;
>         }


-- 
With Best Regards,
Andy Shevchenko
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ