Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5584180imm; Tue, 12 Jun 2018 10:00:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLViDzu/jcicto+tip43YOOz0yyqpNYAegCbse6PMib3ijOD7FVMBn0uERovovMTfE8MqVu X-Received: by 2002:a63:7a49:: with SMTP id j9-v6mr989004pgn.353.1528822819188; Tue, 12 Jun 2018 10:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528822819; cv=none; d=google.com; s=arc-20160816; b=lkVDz0NXJaDj4/R2Sl9b22gGK/JhW0ck5PTwyiovfb3SO5AUIk1au9BDzBz+fVWT0x 1/TW3+rj6NKBussMO+w353wmz91Ho/XXoz1iU4s+wVlJNd37oddLiRoT3NnQNSwJ3uN1 xmMyRd16GbvFCwCuqhFwX4uSuAVSeWve3v6zD/cxe5sEUAJ2lOD5Q8e2JTqm4+LIjy91 SJVnaKC5ddBfi53toq8tlZsr5MWUUO3ThUhU7y6t69nvS74n7/Cxvr3nY/lXucfdIozk YaukRN4Q82PQGkret8l+bXO0t9F6hn7EyCoEuNYsrhVb1NWrOsOHKXJdSd2Y2+RzqClx 1IJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=CXOvBIzeDa0MKSkRYdqR0ccEpayrbAzoINhDON6uzxY=; b=ZthOv3HAIFSe5Ac9Fl7Q7W9InZUQ9naCoCIwppAjsy5BOXxmTPBlK/rozFJd5yMqs6 hbFM+O1O2+1zGDX5BQuiRr99KYlFjDcpmyjJKBtMZWp+/ZDCy0wQM63bJcta82XBKNZp cJlEsWy5EUDEepBq91ZqtstaKTT3KQd6hieCAeeN6mkcvaG3YICzs2umTXpHXWrLcAs0 ztfVddJ1MxaEMnonPZD7Stl+Wn/Dku1eH02vhHB4fhGioMbp3H0K6v4DJWYcsOUI/+6J pyulf1oNDn70IEJ6qNX7PffNxkZ6glBQDx/a/0ULhL29mD8A9a2xXwJ5jpK3F8NljBHD qRvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="T3R/pqBM"; 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 k24-v6si502676pff.91.2018.06.12.10.00.04; Tue, 12 Jun 2018 10:00:19 -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; dkim=pass header.i=@kernel.org header.s=default header.b="T3R/pqBM"; 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 S934882AbeFLQ6e (ORCPT + 99 others); Tue, 12 Jun 2018 12:58:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:54246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934780AbeFLQxy (ORCPT ); Tue, 12 Jun 2018 12:53:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 039B9208B4; Tue, 12 Jun 2018 16:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528822433; bh=rmATY/HaQ6nrShvYAEFoZGiYE//sw9JUvYQPoylMgsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T3R/pqBMpx1yy45n5w4YqYJsEH1ALut+/8sVnlzFG6ERbKgvsVLd4sONuDPNbxXNi xcfzWV2VXJg2DuWBsyQXdXKYWpkOc5El+DvkSuB7THqJVC0PB2gViaETKElqZqU4xw 9PXCVTidBuEtAg2hJ8AeDyMwYcW6bk/Qd4Rm48JI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Gorbik , Al Viro , Linus Torvalds Subject: [PATCH 3.18 10/21] mmap: relax file size limit for regular files Date: Tue, 12 Jun 2018 18:52:07 +0200 Message-Id: <20180612164825.827125212@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180612164825.401145490@linuxfoundation.org> References: <20180612164825.401145490@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Torvalds commit 423913ad4ae5b3e8fb8983f70969fb522261ba26 upstream. Commit be83bbf80682 ("mmap: introduce sane default mmap limits") was introduced to catch problems in various ad-hoc character device drivers doing mmap and getting the size limits wrong. In the process, it used "known good" limits for the normal cases of mapping regular files and block device drivers. It turns out that the "s_maxbytes" limit was less "known good" than I thought. In particular, /proc doesn't set it, but exposes one regular file to mmap: /proc/vmcore. As a result, that file got limited to the default MAX_INT s_maxbytes value. This went unnoticed for a while, because apparently the only thing that needs it is the s390 kernel zfcpdump, but there might be other tools that use this too. Vasily suggested just changing s_maxbytes for all of /proc, which isn't wrong, but makes me nervous at this stage. So instead, just make the new mmap limit always be MAX_LFS_FILESIZE for regular files, which won't affect anything else. It wasn't the regular file case I was worried about. I'd really prefer for maxsize to have been per-inode, but that is not how things are today. Fixes: be83bbf80682 ("mmap: introduce sane default mmap limits") Reported-by: Vasily Gorbik Cc: Al Viro Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1274,7 +1274,7 @@ static inline int mlock_future_check(str static inline u64 file_mmap_size_max(struct file *file, struct inode *inode) { if (S_ISREG(inode->i_mode)) - return inode->i_sb->s_maxbytes; + return MAX_LFS_FILESIZE; if (S_ISBLK(inode->i_mode)) return MAX_LFS_FILESIZE;