Message ID | e5181441b283a73984773f71ea2323170212f697.1408436940.git.riku.voipio@linaro.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <patchwork-forward+bncBC4MBBM76YMRBPE4ZSPQKGQE2F4GYWI@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 89D2F2136C for <linaro@patches.linaro.org>; Tue, 19 Aug 2014 08:43:41 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h18sf28296681igc.1 for <linaro@patches.linaro.org>; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=4eSBTViasNR+OwvbwfaKzsXr3kVkrhMabgfgqmqJH1o=; b=Sw2bBXH2jeJflJMd9TORXMUWBXNrfIVNEiK70kaLZ1l1X6iXyIpvfd8hOVflOPuPVb jAGAjtt8p3XVRSJ23tdZqIGqW1yA6HP9O7iviJCqYxqsWnvRVWa2VX0ZBkgeNt3btBBK 2R2dCvzrfuQWiXBbpH0zLZydfNIcxKNUhrDw2pp4/KxYCcycadfLIKTElkhjTTOwuGRl hWW3FpXz+RvEZxRjKCVejWaw2Bb1a4H/0M3AIR+N5N4ZdDfWwiSFvox8xk77SXhge9wU TRBqvR68MMGYdg0cfS/bWGfo1BLM7C0a3dVZUbY/+vfhwZQSyyEHoVySS71TVnna4/dx YtxA== X-Gm-Message-State: ALoCoQnxqZY+io1qpaTblnpb4xFiLE+8zpKQ/pNm6GN1KiRAyCjmTGIDxiSgB+VAwQhydRO2usBG X-Received: by 10.182.91.97 with SMTP id cd1mr22593676obb.33.1408437820924; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.45 with SMTP id l42ls2721737qga.61.gmail; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) X-Received: by 10.52.156.100 with SMTP id wd4mr4395017vdb.39.1408437820825; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id t9si8341999vco.90.2014.08.19.01.43.40 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so7111880vcb.30 for <patchwork-forward@linaro.org>; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) X-Received: by 10.220.81.132 with SMTP id x4mr1028919vck.0.1408437820732; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp220828vcb; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) X-Received: by 10.140.18.211 with SMTP id 77mr60326991qgf.57.1408437820044; Tue, 19 Aug 2014 01:43:40 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id m8si28053802qas.0.2014.08.19.01.43.39 for <patch@linaro.org> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 01:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1XJf11-0001Yb-Gn for patch@linaro.org; Tue, 19 Aug 2014 04:43:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <riku.voipio@linaro.org>) id 1XJeqv-00015l-8X for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <riku.voipio@linaro.org>) id 1XJeql-0001ai-Sc for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:13 -0400 Received: from afflict.kos.to ([92.243.29.197]:35176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <riku.voipio@linaro.org>) id 1XJeql-0001ZT-MV for qemu-devel@nongnu.org; Tue, 19 Aug 2014 04:33:03 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 2973826684; Tue, 19 Aug 2014 10:33:02 +0200 (CEST) From: riku.voipio@linaro.org To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org Date: Tue, 19 Aug 2014 11:32:50 +0300 Message-Id: <e5181441b283a73984773f71ea2323170212f697.1408436940.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <cover.1408436940.git.riku.voipio@linaro.org> References: <cover.1408436940.git.riku.voipio@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Tom Musta <tommusta@gmail.com> Subject: [Qemu-devel] [PULL v2 15/23] linux-user: Detect Negative Message Sizes in msgsnd System Call X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: <patchwork-forward.linaro.org> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 |
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c9a9d3d..d223cff 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2879,12 +2879,16 @@ struct target_msgbuf { }; static inline abi_long do_msgsnd(int msqid, abi_long msgp, - unsigned int msgsz, int msgflg) + ssize_t msgsz, int msgflg) { struct target_msgbuf *target_mb; struct msgbuf *host_mb; abi_long ret = 0; + if (msgsz < 0) { + return -TARGET_EINVAL; + } + if (!lock_user_struct(VERIFY_READ, target_mb, msgp, 0)) return -TARGET_EFAULT; host_mb = malloc(msgsz+sizeof(long));