From patchwork Tue Apr 4 12:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seraphime Kirkovski X-Patchwork-Id: 9661701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 45DB9602B9 for ; Tue, 4 Apr 2017 12:43:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 320C6284A7 for ; Tue, 4 Apr 2017 12:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 239F8284ED; Tue, 4 Apr 2017 12:43:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 236A2284A7 for ; Tue, 4 Apr 2017 12:43:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvNle-0002wI-Cv; Tue, 04 Apr 2017 12:41:02 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvNlc-0002w2-TR for xen-devel@lists.xen.org; Tue, 04 Apr 2017 12:41:01 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 7A/6D-23940-C5493E85; Tue, 04 Apr 2017 12:41:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGIsWRWlGSWpSXmKPExsVyMbThkG70lMc RBruvaFgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkvDhxmKZjMWXHw8i3WBsYu9i5GTg4hgYmM Etc6zboYuThYBC6xSHxY+pARxJEQeMci0b7qJ1sXIweQEyPR8DoApEFCoEriwrUeRohmZYl5J 5+wgdQLCXQzSbQvaWWGSIRIbHi3CWgDOwebgIHEjRSQqIiAtMS1z5fBWpkFKiQOvJ8LdoOwgK PEhlvbwOIsAqoSV9bPZwGxeQUsJCYv3M0OsVZeYlfbRdYJjPwLGBlWMaoXpxaVpRbpmuglFWW mZ5TkJmbm6BoaGOvlphYXJ6an5iQmFesl5+duYgSGDgMQ7GBs/OJ0iFGSg0lJlPew5+MIIb6k /JTKjMTijPii0pzU4kOMMhwcShK8fZOAcoJFqempFWmZOcAghklLcPAoifD6gKR5iwsSc4sz0 yFSpxiNOR6c2vWGieNT/+E3TEIsefl5qVLivIcnA5UKgJRmlObBDYJF1yVGWSlhXkag04R4Cl KLcjNLUOVfMYpzMCoJ8x4BWciTmVcCt+8V0ClMQKc8ufMQ5JSSRISUVAMj85nA2D01Lqpy/0q fSnrY936QrF+6YWU0q+EtLfuNhvPlnu+aFzzDrKzy3vd6E6N6iw9iH+8V3tnNXHvaUSPmgUh2 tyarr+jdxwcyFrWbLIjr4xfnTpt4sfZZ5Fcm50+hFkk3Ojk+7OrQvT11pcX0fWH/bkVkpr7ex Tzh2P6oPyp3vG04pZ2VWIozEg21mIuKEwGHk6VhqQIAAA== X-Env-Sender: kirkseraph@gmail.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1491309659!82378632!1 X-Originating-IP: [209.85.128.194] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38449 invoked from network); 4 Apr 2017 12:40:59 -0000 Received: from mail-wr0-f194.google.com (HELO mail-wr0-f194.google.com) (209.85.128.194) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Apr 2017 12:40:59 -0000 Received: by mail-wr0-f194.google.com with SMTP id t20so3575140wra.2 for ; Tue, 04 Apr 2017 05:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=oxAB5gIa3d8ZvpIRyPGKWxKkUR2y5Eh73Kx+q+lIupw=; b=nQHaZZDv7XjY8TTjqw+L9duEcIh9jBlXETi3wfgY3/o79Fe6jq95pT+/pO6DWYckB0 RsUuiIGjrtKx+YHOW+/zgxxMs1QqEr4xQHCl2r9+WWrWqBhb8+2hPJKZdxRGIg2xbAHf JSktGDnGqAu94cRQni4tA2w1dEbrKQSsvqSh3MAk9es7p9vjUJbSlIuSwySVlXRwQSzW CTlZmz5sAl+EwU46spcOwNxeNaEQpWlI+wUNLacRrD9TzSqvxp6Feoadl2+nQNgrvOb0 smXTT/7BKyIdnxZop12CEJpNZwo1dNX4pfaWGyik/Rroi/Od6S8KIWg2ecBneYeBCAjs 2DvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oxAB5gIa3d8ZvpIRyPGKWxKkUR2y5Eh73Kx+q+lIupw=; b=oUiGzkeneurEwmsYzPcEdkz4b7zPTtkO+6pRsswB/oElJ5X9+A2fxs3tzqISFCgqYO Gycs7TRHzRmc6cZv1XZz8Ou8fgVvqUjd0p06+l02cFiPg4RKx87p8mnAlJ1qRHou1Zzh C5sMozylvpOpxqYb6zb+nR/q75VysQfnSoTPUoUwA0t2zvPA1u45dNZWuxs0NAijrKBj h7gwwJu5w7AJPkRioM6R9T4QVc+9xnOP3jpZul3Z7+o556MDb7SkvvZEi+R+mt89oKh1 iUFM1WUf72S+6R71Dk67DAHxSVETCMeuFpZqkyDA3c+zpKDZ4GcqI5lZFsitYIz2t5vZ wj3A== X-Gm-Message-State: AFeK/H0KKD2yzfnUDA4gkK/ZLwWWhEi8COZR1X+QeETCZFLkKnpUtd1BNHfO+GY9NbS4kw== X-Received: by 10.223.176.161 with SMTP id i30mr1451115wra.32.1491309659276; Tue, 04 Apr 2017 05:40:59 -0700 (PDT) Received: from macchiaveli (cha92-19-78-239-153-115.fbx.proxad.net. [78.239.153.115]) by smtp.gmail.com with ESMTPSA id p7sm22178908wrc.19.2017.04.04.05.40.57 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 04 Apr 2017 05:40:58 -0700 (PDT) Received: by macchiaveli (sSMTP sendmail emulation); Tue, 04 Apr 2017 14:40:56 +0200 From: Seraphime Kirkovski To: xen-devel@lists.xen.org Date: Tue, 4 Apr 2017 14:40:48 +0200 Message-Id: <20170404124048.9603-1-kirkseraph@gmail.com> X-Mailer: git-send-email 2.11.0 Cc: Ian Jackson , Wei Liu , Seraphime Kirkovski Subject: [Xen-devel] [PATCHv2] libxc: fix segfault on uninitialized xch->fmem X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently in xc_interface_open, xch->fmem is not initialized and in some rare case the code fails before ever assigning a value to it. I got this in master: $ sudo ./xl/xl run xencall: error: Could not obtain handle on privileged command interface: No such file or directory Segmentation fault This initializes the whole xch_buff to 0. Signed-off-by: Seraphime Kirkovski Acked-by: Wei Liu --- Changes from v1: * Initialize the entire struct xc_interface_core to 0 tools/libxc/xc_private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 72e6242417..f395594a8f 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -30,7 +30,7 @@ struct xc_interface_core *xc_interface_open(xentoollog_logger *logger, xentoollog_logger *dombuild_logger, unsigned open_flags) { - struct xc_interface_core xch_buf, *xch = &xch_buf; + struct xc_interface_core xch_buf = { 0 }, *xch = &xch_buf; xch->flags = open_flags; xch->dombuild_logger_file = 0;