From patchwork Sun Oct 9 05:26:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 679995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ssBfR2dtWz9sR9 for ; Sun, 9 Oct 2016 16:30:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=TtU8gi6m; dkim-atps=neutral Received: from localhost ([::1]:43170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bt6gV-0007s2-UW for incoming@patchwork.ozlabs.org; Sun, 09 Oct 2016 01:30:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bt6dc-0005xv-9y for qemu-devel@nongnu.org; Sun, 09 Oct 2016 01:27:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bt6dY-00053s-2H for qemu-devel@nongnu.org; Sun, 09 Oct 2016 01:27:03 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:35667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bt6dX-00053c-Ur for qemu-devel@nongnu.org; Sun, 09 Oct 2016 01:27:00 -0400 Received: by mail-yw0-x242.google.com with SMTP id t193so3537836ywc.2 for ; Sat, 08 Oct 2016 22:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TwfmzmufmMpwttFzeCWiL/zvR6EaKuZkkC/G9Tx1uV0=; b=TtU8gi6mfW15ro3IjfHohyh2TkF0FfxN97yatcxHWfQOU+2WUFZS4wwy3na7GaXqA2 otX2E2pKHVFuIKHgsEWJ3dDy3lyvvvVcU/aTX/dVpBkCAuXND2qxfuk+X6c3V+1ST+x8 NV2sVERvKRmNO7CnhWt6uG3LD7hIxDFgCr6qBppzg+Nj+mzkr7Tv4G23o9z4iJB0PYLq 62RT5UqzStBl0+v8AT/30zB/Sjc+wfCSCqeXhENjdapIRm3gVhxpwbX4VompbRmqhCJG uLfVpqLyaeG5o88V8mXgxVemMiCXHD3b8LGmjOZ37Y6nybMV3NrB6j1P22TUqYIJXsIo PvNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TwfmzmufmMpwttFzeCWiL/zvR6EaKuZkkC/G9Tx1uV0=; b=Qq5cdoLEA74mz/b4DWKnCbL1CENe6GLqAkG1uPpH5JXgZg1D5/8gFbc4uTAtFI8E/h A1/TOy9Y3tX4swN9Gt/8/7o9Watfj2ydR03GK8IIN2RlvuXryAoohbDveRCGg1ENSdjJ yyG/O5w05mIfsom0xkSypufKAIEGYF7xuONM7cqLVqWsnMTrXmpoW2kelbLFfxSgqIZX Vf0JWJ5GmGXyJwr4o9ImJzHAZIRm31e8glDQ8qYLv9HFrfGtsBU2IOk65PGXssiupPew tYbFhoksfTJ0uOJ/i+BEv9wvWVu1UF092qtWSav4PleEbLZzb6IMYTX7jrWcwuYcW7Tr kAKg== X-Gm-Message-State: AA6/9RlyBIdaKtGRo9S5/m5O2EUuNFGFlCZMt2DnyiNFB+zv+UOckD9MajO5lnOv+jj8SA== X-Received: by 10.13.246.199 with SMTP id g190mr21110913ywf.124.1475990819562; Sat, 08 Oct 2016 22:26:59 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id r186sm5862352ywr.38.2016.10.08.22.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2016 22:26:59 -0700 (PDT) From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: groug@kaod.org, qemu-devel@nongnu.org Date: Sat, 8 Oct 2016 22:26:51 -0700 Message-Id: <6aefc5ee17ba6ac636de56bba8e7f24fd0262187.1475990063.git.liqiang6-s@360.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::242 Subject: [Qemu-devel] [PATCH 1/2] 9pfs: fix information leak in xattr read 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: , Cc: Li Qiang Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang 9pfs uses g_malloc() to allocate the xattr memory space, if the guest reads this memory before writing to it, this will leak host heap memory to the guest. This patch avoid this. Signed-off-by: Li Qiang Reviewed-by: Greg Kurz --- hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 119ee58..8751c19 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3282,7 +3282,7 @@ static void v9fs_xattrcreate(void *opaque) xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); - xattr_fidp->fs.xattr.value = g_malloc(size); + xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); out_nofid: