From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06BC6C433E0 for ; Tue, 29 Dec 2020 20:00:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4CAB206ED for ; Tue, 29 Dec 2020 20:00:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4CAB206ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 027D58D0037; Tue, 29 Dec 2020 15:00:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F1AEE8D002C; Tue, 29 Dec 2020 15:00:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE1D88D0037; Tue, 29 Dec 2020 15:00:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id C9ECD8D002C for ; Tue, 29 Dec 2020 15:00:46 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 910651EE6 for ; Tue, 29 Dec 2020 20:00:46 +0000 (UTC) X-FDA: 77647387692.15.camp90_4e0cf712749f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 6434A1814B0CC for ; Tue, 29 Dec 2020 20:00:46 +0000 (UTC) X-HE-Tag: camp90_4e0cf712749f X-Filterd-Recvd-Size: 3469 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 20:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:References:Cc:To:From:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=hknaYncnvFzO1C779LIvHAn1a7BE6equJ8aDcI93zR8=; b=kj+AwoTcwamJZXhxHkWyKVxsQe foUYulmgp9J8vj+6JxeYNddC3xyDjTObRg0FyFEuqtPFIXKrppvG30lqrxw5vkXVOMtxH5yCeOc/M ue9tARmpv2vTHvxTphUP7vKmvBfLeGMJnNvcBUaPD3UafYN+vLWloTm4426v6nkITvPp5Mve7HVjT gTN1cViNW5uSAuigOF2avCuKU3wum7lt1339mv7pyOYPFxtvzFNdYBQlXRhHj1tQDpVEKZe3sWkFT Y19x7CBHkwo/lK3UcXGtFaiST7jdxQGSPlFHHHsuWKIB+1aoGjnLKycMz9iE5g8W3HDsYSO5Apu74 KoZqJ1TA==; Received: from [2601:1c0:6280:3f0::2c43] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kuLAe-0001DZ-S3; Tue, 29 Dec 2020 20:00:41 +0000 Subject: Re: [RFC PATCH 2/2] mm: readahead: handle LARGE input to get_init_ra_size() From: Randy Dunlap To: =?UTF-8?Q?Toralf_F=c3=b6rster?= , Andrew Morton Cc: linux-kernel@vger.kernel.org, Jens Axboe , linux-mm@kvack.org References: <20201220211051.1416-1-rdunlap@infradead.org> <20201222173533.c9e28416835d7487b0e28cda@linux-foundation.org> <6a595671-20a8-e63f-f3ea-f4749a574efa@infradead.org> <1f5a6e7b-c779-861e-fde8-409ca8e2541b@infradead.org> Message-ID: Date: Tue, 29 Dec 2020 12:00:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <1f5a6e7b-c779-861e-fde8-409ca8e2541b@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/29/20 10:11 AM, Randy Dunlap wrote: > On 12/29/20 10:01 AM, Toralf F=C3=B6rster wrote: >> On 12/23/20 2:50 AM, Randy Dunlap wrote: >>>> What motivates this change?=C2=A0 Is there any reason to think this = can >>>> happen? >>> Spotted in the wild: >> I run 2 hardened Gentoo systems, a server and a desktop. >> >> I patched the server with this: >> >> mr-fox ~ # cat ubsan.patch >> --- linux-5.10.1.orig/mm/readahead.c >> +++ linux-5.10.1/mm/readahead.c >> @@ -310,7 +310,11 @@ void force_page_cache_ra(struct readahea >> =C2=A0 */ >> =C2=A0static unsigned long get_init_ra_size(unsigned long size, unsign= ed >> long max) >> =C2=A0{ >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long newsize =3D roundu= p_pow_of_two(size); >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long newsize; >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!size) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 size =3D 32; >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 newsize =3D roundup_pow_of_two(s= ize); >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (newsize <=3D max / 32) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 newsize =3D newsize * 4; >> >> >> >> and the issue did no longer occurred at the server (5.10.2). >> >> I did not patched the desktop system and the issue occurred still 3 >> times since 21th of december (5.10.2/3) >=20 > Yes, that's the patch that I posted on 2020-DEC-22. >=20 > Looks like I should submit a real patch for that. >=20 > thanks. >=20 Hi Toralf, Do you want either or both of your Reported-by: and Tested-by: on the patch? thanks. --=20 ~Randy