From nobody Fri Apr 26 09:09:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549647431257198.79407995278143; Fri, 8 Feb 2019 09:37:11 -0800 (PST) Received: from localhost ([127.0.0.1]:60577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsA5M-0007fV-9x for importer@patchew.org; Fri, 08 Feb 2019 12:37:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsA3i-0006z9-EA for qemu-devel@nongnu.org; Fri, 08 Feb 2019 12:35:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsA3h-00018N-MZ for qemu-devel@nongnu.org; Fri, 08 Feb 2019 12:35:26 -0500 Received: from poy.remlab.net ([2001:41d0:2:5a1a::]:44628 helo=ns207790.ip-94-23-215.eu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsA3h-00013E-GL for qemu-devel@nongnu.org; Fri, 08 Feb 2019 12:35:25 -0500 Received: from basile.remlab.net (ip6-localhost [IPv6:::1]) by ns207790.ip-94-23-215.eu (Postfix) with ESMTP id 5C50A5FCAB for ; Fri, 8 Feb 2019 18:35:20 +0100 (CET) From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= To: qemu-devel@nongnu.org Date: Fri, 8 Feb 2019 19:35:20 +0200 Message-Id: <20190208173520.15007-1-remi@remlab.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41d0:2:5a1a:: Subject: [Qemu-devel] [PATCH] linux-user: check valid address in access_ok() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This works around the LTP crash, but there are problably better ways to go about it. Signed-off-by: R=C3=A9mi Denis-Courmont Cc: --- linux-user/qemu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index ef400cb78a..1d222a0cce 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -457,7 +457,8 @@ extern unsigned long guest_stack_size; =20 static inline int access_ok(int type, abi_ulong addr, abi_ulong size) { - return page_check_range((target_ulong)addr, size, + return guest_addr_valid(addr) && guest_addr_valid(addr + size) && + page_check_range((target_ulong)addr, size, (type =3D=3D VERIFY_READ) ? PAGE_READ : (PAGE_= READ | PAGE_WRITE)) =3D=3D 0; } =20 --=20 2.20.1