Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp11100ybm; Mon, 20 May 2019 10:58:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlm6uduFe9RBeWTuClIubygORo9AJsWspbX+BUTiOmJS25kzmSEyjj2pkxHRB7CN+AskMK X-Received: by 2002:a65:5c8c:: with SMTP id a12mr76798928pgt.452.1558375122460; Mon, 20 May 2019 10:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558375122; cv=none; d=google.com; s=arc-20160816; b=iOfjZ3MX28xAAIT6hsQQmO4ELDnbcBAIrZ2SlucePLOYNp0PRWxC1JBJi0JqG67Zuv lT5nGgPXkh8+cHySSI6ssR2KJoybHPRusEL1OrmyoZ7KKi3JmXyVzdqk9MFLYGROqHI0 yjFJ7NXJmR9IexBkwJ7sdNWaHE23TYIjDzd/rg3E96M3J+0Co9rAn2b554s8t1QH+1qk ysxBCbvwok9qXObJkl1eU19f2dhHK37rrD87qjxdNmdPotgW+xJ8/g+p3n0bbVGEm9Ih Usunrrtuv8yahw/ZnV2+RXVTf0kE+cWfoXCsl79++4NEGcZw1GOub26j72zSGo0bsdAk Qqqg== 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=sfaugS0XZ3d4CeTpgjWgT/OTbdJDuRphHoHHBafazJh8LyraMJLNRFNgsFCBi/vdC7 91IFNi3FyoCoqdxOZlWEztdhaauRSVchW6oir3fs8SDWVhDO1IO6eZGXoqhPhq4iGBIC gJ6kKnQibqMHZ4u7xnJQYrC8ZhgkqhxBYZW2wGbUsAssojVgdPrKHYxQ5IYmoppRcgi2 Xi38y/w1fVxbyRew9cWmpEFvoXGOUynB7GQaQPihWLaxAcbkWlFOxrAyrsHpFufjv4BZ jC8AsG1arYyZ5gmMFdm+7CEPtEcBJQbsJjpb6WjL2pzLaAkohuYXg0tFj5h4qnZq7UAm FXVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qoYvNdCp; 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 r69si11873536pgr.120.2019.05.20.10.58.28; Mon, 20 May 2019 10:58:42 -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=qoYvNdCp; 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 S2389799AbfETMuC (ORCPT + 99 others); Mon, 20 May 2019 08:50:02 -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;