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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 64388C433DB for ; Tue, 29 Dec 2020 22:23:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28CA5207BC for ; Tue, 29 Dec 2020 22:23:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28CA5207BC 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 469DE8D006C; Tue, 29 Dec 2020 17:23:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F3808D006A; Tue, 29 Dec 2020 17:23:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32FB08D006C; Tue, 29 Dec 2020 17:23:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id 1D2618D006A for ; Tue, 29 Dec 2020 17:23:46 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D9BE5180AD801 for ; Tue, 29 Dec 2020 22:23:45 +0000 (UTC) X-FDA: 77647748010.25.join39_4904856274a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id B50EE1804E3A1 for ; Tue, 29 Dec 2020 22:23:45 +0000 (UTC) X-HE-Tag: join39_4904856274a0 X-Filterd-Recvd-Size: 2577 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 22:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=j/bNtqMm2dxQxj54tA+5zXYhll2ElA1bhXS58HU9rB8=; b=HF87GccL7FEt19lB2EOb+Dp1vL pJwxP4UUvqUkpZLrydtqaiJ6BMXK5dYiDyflIsEremMLY1RDv1d5wPWb2uBdcoLg1ahhcREGhwdtq JEYPbVZmI0fo5XY1nBo7Ft677yCx+6f9jGdTDEiuO8agsCmZX2BFdz5kQ7DKDjOzqFhy4qrQJf85i O2w17+RGBkyx1IrrGh+cDLxY7mE4lVQ/MK0z57C8w9M21pmu2PRVGmHO2XLS1TjAdxxp7yOT7CD+w zJKnUoqBj1NaMpWeBeHjSDfIirUbZd9Ohu1xfqJtmEroBAZjp2bhNMnWRU/IfaW7+HnM3ie1mrMaC tD3+xH3w==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kuNOZ-000H1i-D0; Tue, 29 Dec 2020 22:23:18 +0000 Date: Tue, 29 Dec 2020 22:23:11 +0000 From: Matthew Wilcox To: Randy Dunlap Cc: linux-kernel@vger.kernel.org, Toralf =?iso-8859-1?Q?F=F6rster?= , Andrew Morton , Jens Axboe , linux-mm@kvack.org Subject: Re: [PATCH -mm] mm: readahead: apply a default readahead size Message-ID: <20201229222311.GD28221@casper.infradead.org> References: <20201229212634.31307-1-rdunlap@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201229212634.31307-1-rdunlap@infradead.org> 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 Tue, Dec 29, 2020 at 01:26:34PM -0800, Randy Dunlap wrote: > UBSAN reports an invalid shift size: > > mr-fox kernel: UBSAN: shift-out-of-bounds in ./include/linux/log2.h:57:13 > mr-fox kernel: shift exponent 64 is too large for 64-bit type 'long unsigned int' > > Original report: > https://lore.kernel.org/lkml/c6e5eb81-680f-dd5c-8a81-62041a5ce50c@gmx.de/ > > Follow-up report: > https://lore.kernel.org/lkml/0c283ea9-b446-0e40-6dc8-e9585ae171b4@gmx.de/T/#m9b604660925f9e8a544f7453130c31d083c1e5bb > > > Willy suggested that get_init_ra_size() was being called with a size of 0, > which would cause this (instead of some Huge value), so add a check in > that function for size == 0, and if 0, default it to 32 (pages). No, this is wrong. 'size' in this case is the size of the read. And it's zero. Is this fixed by commit 3644e2d2dda78e21edd8f5415b6d7ab03f5f54f3