Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5227255imm; Fri, 18 May 2018 20:16:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoCuDwOLCydErepsY23L7qy+ryPOGIG5QQXlFpWs4eIpWOlqcfLyNzBPnSw4uaJwuUcH+Q8 X-Received: by 2002:a63:9711:: with SMTP id n17-v6mr9586039pge.431.1526699773350; Fri, 18 May 2018 20:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526699773; cv=none; d=google.com; s=arc-20160816; b=Gv93Vk7bKsjxTQnHRli+en4OMcHJ0eg1EfMaL42yiWqVvQd48CIjVgZ6zjaIqfRGjY Jx+rkcidV/IPTz14BDx8OQbHBqPJa8m77mKzOSi7MQUdpUvdZZptONNO59+Lq558ApDA C1mJzVhhrfyPxsTVE2GBD7xyND3dR6Sb/kcAHox5u6eQ9ZIRtbhaUw8v+cdAI+c2atLt 7C2AdQJ6aJ1r1JRVwQCUUhd7tlTLN/beHNkBW9EUx/nPM8faLLH7NyiEXOgtvwZCEDxe /m6nRxNJaYV4MdrSWSZ0iyIRzVe1YG5KfCWkzQiVMHKQ5CLl5JemW1bmQgHZIiQOGoWy NagQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:subject:cc:to:from:date:arc-authentication-results; bh=y1q6Y0qwe8UyGFhsg6C1HH0wikqy3pGjjn33lL0VwpY=; b=CiiuiYwbWOrVG6lvF6flxHiFHz9InJDowKWv7YCXrr5T7lwkPGIS0a9ZpGkfaOA3+W jMw1AR9md0mVfmqSvy8e7leZIdWnclGjEsSs1KxO05wi2TBAW6gA8pBVQzEsXdzruev4 pp8ipg7BGrHkQB/yxSI1/dnZpKVzyjcSfUK/+w1nixTyFMCQyituuBUpsKE61NAwKVrt PSfXHt5wqUiCY4WDbZlnH/yNVwG5pwRkZgqkEpKKbRY7hkpUg4MTKxYf8PKX+K0D+R4+ Bp+AES/f0PE1J9QmXFLrfrkD/Kcj3Te3UbvwnCtycqXz3i47P1KTnwo+pWz3je8IhQbY mNHw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a100-v6si8750566pli.588.2018.05.18.20.15.47; Fri, 18 May 2018 20:16:13 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752214AbeESDPf (ORCPT + 99 others); Fri, 18 May 2018 23:15:35 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51664 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751700AbeESDPa (ORCPT ); Fri, 18 May 2018 23:15:30 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4J3E2tA135810 for ; Fri, 18 May 2018 23:15:30 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j28d9eqa8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 May 2018 23:15:29 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 19 May 2018 04:15:27 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 19 May 2018 04:15:25 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4J3FPfs49152010; Sat, 19 May 2018 03:15:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7E2FA4051; Sat, 19 May 2018 04:06:51 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BD02A404D; Sat, 19 May 2018 04:06:51 +0100 (BST) Received: from localhost (unknown [9.145.77.209]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sat, 19 May 2018 04:06:51 +0100 (BST) Date: Sat, 19 May 2018 05:15:23 +0200 From: Vasily Gorbik To: Linus Torvalds , Andrew Morton , Al Viro Cc: linux-kernel@vger.kernel.org, Heiko Carstens Subject: [PATCH] procfs: fix mmap() for /proc/vmcore References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-TM-AS-GCONF: 00 x-cbid: 18051903-0040-0000-0000-0000043B7C27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051903-0041-0000-0000-00002640A332 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-19_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805190035 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Procfs does not set max file size (s_maxbytes) and ends up with default value of MAX_NON_LFS ((1UL<<31) - 1) Commit be83bbf80682 ("mmap: introduce sane default mmap limits") introduced "pgoff" limits checks for mmap, considering fs max file size as upper limit, which made it impossible to mmap /proc/vmcore file contents above 2Gb (/proc/vmcore appears to be the only procfs file supporting mmap). Reuse MAX_LFS_FILESIZE as procfs s_maxbytes value. Fixes: be83bbf80682 ("mmap: introduce sane default mmap limits") Signed-off-by: Vasily Gorbik --- fs/proc/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 2cf3b74391ca..de1b3b1da883 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -502,6 +502,7 @@ int proc_fill_super(struct super_block *s, void *data, int silent) /* User space would break if executables or devices appear on proc */ s->s_iflags |= SB_I_USERNS_VISIBLE | SB_I_NOEXEC | SB_I_NODEV; s->s_flags |= SB_NODIRATIME | SB_NOSUID | SB_NOEXEC; + s->s_maxbytes = MAX_LFS_FILESIZE; s->s_blocksize = 1024; s->s_blocksize_bits = 10; s->s_magic = PROC_SUPER_MAGIC; -- ⢀⡵⣤⡴⣅ 2.17.0 ⠏⢟⡛⣛⠏⠇ space invaders edition