Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4099021imm; Mon, 6 Aug 2018 16:59:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcpAjAL8aauNgGdmE3ZYYfoNElCATBSkzoszzLxHFtyBeu6vHbqZLJbY4GQMSm/fvpVK4A3 X-Received: by 2002:a65:614a:: with SMTP id o10-v6mr15765482pgv.387.1533599969414; Mon, 06 Aug 2018 16:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533599969; cv=none; d=google.com; s=arc-20160816; b=zepv24HyxtPSVKDaQoAlENxpmGztz0yFk1PHT+Wo8HZU7wk0NXcH3ddFcT4bMvTOVa MaSexFg9fyh9KH0fXJfOTKbnOtrBCrM/BIuN9GzvYd9HRkIcT8f3JwsR5BSL2fyHDEPV 25BGltqWus3ncQTAvVRat+wEqrqg+IU/dakf4h7oF3Vri3I7VipuZLfBcHU29y42jC84 6szHVCMzVuVX9y+PHFpdlMpyGx9HKXGosJVdRfHkvKzAzJYI6/nfpWwddw3fjnPxqB0R l6gs86mqCaFDc3+co6RVSJ6V3Bj8VIBE0gEZly5ZIx1TCdsHjWELFxcAL0UKEXIqXOTG zgOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=q57UZY7D2rNtKaq3OkJqB6oi5SJ+a923Ilv443rgtTY=; b=tYWe5lPyovyTBhLKHwkbKIuX4smuN0InBMMwAdkgFyODxbJjB/O5JLIN/DNVz2pGft w5V4A6xPzcPhvRqBYqI7Oz4HBRrgSYlX8sJYu+Sbjszzkip2AR95WitODH4nY1BRplbB ZBqjMwZlxzmAYpxjB2AfaTDtqytUhbfsXtbCk2wkE3eJw3NPmC4NN3b9Kr5A9IBr9tTp Bhq6skoZO3/nuDvEG9YijV6EE5MJvbto1b4ULPfth+kUqWNm+3fZ0N5++XSUJUnkWZx9 IVcMuwUc5FHpAzgGeTIb7gwHdROqsHn3dnCt1lKiAkIKcQd+/+yhet5kLKqLRPb71Zrl X9fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11-v6si10595321plz.333.2018.08.06.16.59.14; Mon, 06 Aug 2018 16:59:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387630AbeHGBKr (ORCPT + 99 others); Mon, 6 Aug 2018 21:10:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45780 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731200AbeHGBKr (ORCPT ); Mon, 6 Aug 2018 21:10:47 -0400 Received: from localhost.localdomain (c-24-4-125-7.hsd1.ca.comcast.net [24.4.125.7]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D9F37EC3; Mon, 6 Aug 2018 22:59:28 +0000 (UTC) Date: Mon, 6 Aug 2018 15:59:27 -0700 From: Andrew Morton To: Jan Kara Cc: Chengguang Xu , mgorman@techsingularity.net, jlayton@redhat.com, ak@linux.intel.com, mawilcox@microsoft.com, tim.c.chen@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Al Viro Subject: Re: [PATCH] mm: adjust max read count in generic_file_buffered_read() Message-Id: <20180806155927.4740babd057df9d5078281b1@linux-foundation.org> In-Reply-To: <20180806102203.hmobd26cujmlfcsw@quack2.suse.cz> References: <20180719081726.3341-1-cgxu519@gmx.com> <20180719085812.sjup2odrjyuigt3l@quack2.suse.cz> <20180720161429.d63dccb9f66799dc0ff74dba@linux-foundation.org> <20180806102203.hmobd26cujmlfcsw@quack2.suse.cz> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 6 Aug 2018 12:22:03 +0200 Jan Kara wrote: > On Fri 20-07-18 16:14:29, Andrew Morton wrote: > > On Thu, 19 Jul 2018 10:58:12 +0200 Jan Kara wrote: > > > > > On Thu 19-07-18 16:17:26, Chengguang Xu wrote: > > > > When we try to truncate read count in generic_file_buffered_read(), > > > > should deliver (sb->s_maxbytes - offset) as maximum count not > > > > sb->s_maxbytes itself. > > > > > > > > Signed-off-by: Chengguang Xu > > > > > > Looks good to me. You can add: > > > > > > Reviewed-by: Jan Kara > > > > Yup. > > > > What are the runtime effects of this bug? > > Good question. I think ->readpage() could be called for index beyond > maximum file size supported by the filesystem leading to weird filesystem > behavior due to overflows in internal calculations. > Sure. But is it possible for userspace to trigger this behaviour? Possibly all callers have already sanitized the arguments by this stage in which case the statement is arguably redundant. I guess I'll put a cc:stable on it and send it in for 4.19-rc1, so we get a bit more time to poke at it. But we should have a better understanding of the userspace impact.