From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 18420C04AAF for ; Mon, 20 May 2019 12:50:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6A222054F for ; Mon, 20 May 2019 12:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558356604; bh=tYzvmzxlgCAbu7295+HojwnrPPuXKNiISilXMntA4Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PWGlUVwwhq9S6ZNMRmJCbPJrDdSsbVOgLkZNHnTvFqQLAWok9KCx2uIVh1OEG7y7H TDgu6tcO/y46VMW9hULHYbzk2RnzO3+oxV8eUOYgQxscktlyFz2GebY+3m1tITQz90 RiR3ZtzdZQrPYFW4ysPU6VmLX22X49/4nglqBiKE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390111AbfETMuD (ORCPT ); Mon, 20 May 2019 08:50:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387676AbfETMVO (ORCPT ); Mon, 20 May 2019 08:21:14 -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 DE05820815; Mon, 20 May 2019 12:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354874; bh=tYzvmzxlgCAbu7295+HojwnrPPuXKNiISilXMntA4Lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qoYvNdCp/mLZXw0t22yjpBPO+H4tBlAtKWsslYVOtbSuQjXKV/tY5mtKT1OGSEPqX X2HCrkbP6fM7Lz2kofle1JDuPsrlvE/fWMLiA38MNEDFUwQtaSf5NnyCc+khVjdHvt rgZcw3F4VYiccdFI810uftTG2U5/i6L7s/4pPF5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boyang Zhou , Will Deacon Subject: [PATCH 4.19 012/105] arm64: mmap: Ensure file offset is treated as unsigned Date: Mon, 20 May 2019 14:13:18 +0200 Message-Id: <20190520115247.892819926@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@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;