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=-11.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,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 6D23CC433DB for ; Tue, 29 Dec 2020 18:11:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A47622209 for ; Tue, 29 Dec 2020 18:11:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A47622209 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 B5ABD8D0033; Tue, 29 Dec 2020 13:11:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE42A8D002C; Tue, 29 Dec 2020 13:11:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AC568D0033; Tue, 29 Dec 2020 13:11:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 81AE98D002C for ; Tue, 29 Dec 2020 13:11:22 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 38CFC180AD804 for ; Tue, 29 Dec 2020 18:11:22 +0000 (UTC) X-FDA: 77647112004.07.cause02_5b00b842749e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 1FC7D1803F9A0 for ; Tue, 29 Dec 2020 18:11:22 +0000 (UTC) X-HE-Tag: cause02_5b00b842749e X-Filterd-Recvd-Size: 3215 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 18:11:20 +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:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=viV2rX2w2i9Hdm9ONoTqTJFY2cOrENzdsrkBg4PRr5I=; b=0WfJGaCXCUrUAefVlFICv4ymRr YI+ZcwDuluq7ussSVYQn0C3pjBbJX80DPtG0sMPBHFFJJG+o0s3SIq6KYzsmHVT6XHo/czVUixzw4 9s/VsFvCRO2fVLyND9RVCr6RKtT1pQ67041UKS3ORBNdzwUS+ukIwsKgVQs2IsEEsOP0J7OGEjBjK rrz/IBNvMyOsLYMabG3Y7vl/i3Ro9junBMg+zYBnJuBRhTPK1ez6Vd8AAwdek/owHP0aIWpXEcbZh uc+zfHt6BUmHlTMJQmCB7nmnNe04LaVaJkctJmYX8iVDFa5LZwOsNx5QOWdIBq4A/bvDs+73iZV4a B1Ji1YFg==; Received: from [2601:1c0:6280:3f0::2c43] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kuJSo-0003sk-Ry; Tue, 29 Dec 2020 18:11:19 +0000 Subject: Re: [RFC PATCH 2/2] mm: readahead: handle LARGE input to get_init_ra_size() 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> From: Randy Dunlap Message-ID: <1f5a6e7b-c779-861e-fde8-409ca8e2541b@infradead.org> Date: Tue, 29 Dec 2020 10:11:11 -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: 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: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 c= an >>> happen? >> Spotted in the wild: > I run 2 hardened Gentoo systems, a server and a desktop. >=20 > I patched the server with this: >=20 > 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, unsigne= d > long max) > =C2=A0{ > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long newsize =3D roundup= _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(si= ze); >=20 > =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; >=20 >=20 >=20 > and the issue did no longer occurred at the server (5.10.2). >=20 > I did not patched the desktop system and the issue occurred still 3 > times since 21th of december (5.10.2/3) Yes, that's the patch that I posted on 2020-DEC-22. Looks like I should submit a real patch for that. thanks. --=20 ~Randy