Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp334311yba; Mon, 20 May 2019 09:29:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx00EcU+jelnhTyLuFbwmnUDOrWGMpYJPpJ3+8b0Mn25Je03+6kkDLTg7d3gIVUcD1LRPZ6 X-Received: by 2002:a63:4a4f:: with SMTP id j15mr75840097pgl.338.1558369777036; Mon, 20 May 2019 09:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558369777; cv=none; d=google.com; s=arc-20160816; b=NLYzZiaSqO1QOffSOk91qotLNJ4ITfWhIafHw+oajHvthAzWsVL9TpJt1j8gr6DbVl vucz6jmXw4Mri8W9oe2lFdZy0+7kcnRatl9mv7q7H9zsiU6NMwUvhDuFMd1bn2EKwiZ0 dgD1kA8c3YO/z4nbtQSUCyQuAPC35Ujm1L59QT8k4ryXX4KsNtH4De0PpDcdLp8LXuIk RepWzuFxgQcT6L4f4uHIFwpIkCkDr4QA1fn8E6htf2nzn4Qvs4OLCn2ABPBHig3T4V9Y Hwdcy1mjnu3JTbCDkiBYyDFz54m3EBBCyERVECckiDHetOzfwypFG20VXepAK37bVO1B jiFg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zJM4ZC+ESCRcUAgdRfZuAp1eKuHJb+N/6nTWkylP/2g=; b=lJLAQBiKUEMTsLKXXLqeu69FtOeL51iBirr2dOBLKbk7Q7O7u/GWkUw9RBezMIVBfb 1A+9JILzZrEwPvsOayACacUPqAPvhoIYABakT2WMdtNu8jVCRoOEWcS7BkLToZTyv/TZ vLn7kU/GegLGof824DGuZplOsPfDXjIuBM7Mj1spDTqB9ycg/fIFqfySIDE0S03iV3Ej iYy2KYHmagPOswwZR99ADdPCAezX0PoQSh/RTtEeAxwI2UJxlGujOOT/W45IbyMM2f8D aEQV/73m+0WQLWL5s2mHJbHJyZbifJOxBdT6PJA0mddTApP/2lADcueA/QWHNGDeLYmd Yk7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CF/735w5"; 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 p22si17251477plo.341.2019.05.20.09.29.22; Mon, 20 May 2019 09:29:37 -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="CF/735w5"; 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 S2389651AbfETM2T (ORCPT + 99 others); Mon, 20 May 2019 08:28:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:43988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389644AbfETM2P (ORCPT ); Mon, 20 May 2019 08:28:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6214C20645; Mon, 20 May 2019 12:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355294; bh=tYzvmzxlgCAbu7295+HojwnrPPuXKNiISilXMntA4Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CF/735w5b5Ksle5ba3que3kM8RfG1AgG8GqUmBnjxyt3P6O4tDNphjRdAtydpdA8f c0IOV7YgD9NXZ1Hj8o+5j0AVCHX5n7SC9PogwzFCn9VcSk6j6BmslNvqxv9AQqCwNP G4I0p8r4Fq4WE/jDYSd7ctK9U7uprQhrGmzvlzSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boyang Zhou , Will Deacon Subject: [PATCH 5.0 014/123] arm64: mmap: Ensure file offset is treated as unsigned Date: Mon, 20 May 2019 14:13:14 +0200 Message-Id: <20190520115246.007140417@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115245.439864225@linuxfoundation.org> References: <20190520115245.439864225@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boyang Zhou commit f08cae2f28db24d95be5204046b60618d8de4ddc upstream. The file offset argument to the arm64 sys_mmap() implementation is scaled from bytes to pages by shifting right by PAGE_SHIFT. Unfortunately, the offset is passed in as a signed 'off_t' type and therefore large offsets (i.e. with the top bit set) are incorrectly sign-extended by the shift. This has been observed to cause false mmap() failures when mapping GPU doorbells on an arm64 server part. Change the type of the file offset argument to sys_mmap() from 'off_t' to 'unsigned long' so that the shifting scales the value as expected. Cc: Signed-off-by: Boyang Zhou [will: rewrote commit message] Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c @@ -31,7 +31,7 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, - unsigned long, fd, off_t, off) + unsigned long, fd, unsigned long, off) { if (offset_in_page(off) != 0) return -EINVAL;