From patchwork Thu May 31 22:49:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 137444 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp207829lji; Thu, 31 May 2018 15:49:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIiWO3o8ZWV7pk9Gesi4bzVY02+Ne47GwavG2ynQOCVm7X26D4HCOqse9TOzfnl8pfempqm X-Received: by 2002:a37:4e8c:: with SMTP id c134-v6mr146033qkb.207.1527806983650; Thu, 31 May 2018 15:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527806983; cv=none; d=google.com; s=arc-20160816; b=czLHdCxVMoG5JL32DUyubdm1IeOh7/8fQ3UMV+RGP5Rfx0dxNyZNlLWbprE3rC5pbF J+egFug6LTbpTPnBOmjk8uLBRxZ2Z6NkUVjatXuGmKagAAF2daircN9rkhpCaUBxI+C/ 4KMym/ShwAVNvLsmEQ3/d7f7NShLa4gMEzy43WvFMqRwYEzn3uFEHBBSG42bCxNEn3XC P85i7Y8M+J3bWUSGTKITZL/TAocAnztitSocHrSj8KRIzn9zJxhGxElneyYucWPuSxk8 hmG6ylitHVYWhj9YUe+YB0H6j2qXygj9VhH5h6/RoNXv3K5yp42GkZ8PjIXaS+mZTQeY r4ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=dc9nmEC4EhhoiijrUSkV24PteoW8Hb15c4lSKrNTdhc=; b=0YYJG7/TiYx7R1ysu4JZD1RnPnH4BOq+0LsjO7h1HyCadikdemWIAu0BfZjleHco0/ 0E8W+/UoDbcB92MKlgB30Op07fSFT1Tksx1DGn4xMSuwWAklANFT5gftKmhABkLU2hcT c+/WwqjnAafS3Weywmf49vTTtaWK7pN+1hW7qoq+v7X+S81WYlsL+2o3TGXAlHJRBACE LfppDRTtO9atTk4nEQbOfI8iMB0k9Y0+jrRQrKPeE0rpAyqHD6aiUiMYK8t3pvtTjFvm iizfhz50/xRdv1YjI+dmyLQvWe0hK0FA6CXk0R7dAKgvCLNg8m3oq1cf/Fa0xVPZGXSZ /l9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b6KsWPso; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w17-v6si519451qvd.275.2018.05.31.15.49.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 31 May 2018 15:49:43 -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; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b6KsWPso; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOWO7-000584-3L for patch@linaro.org; Thu, 31 May 2018 18:49:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOWNi-00056J-EY for qemu-devel@nongnu.org; Thu, 31 May 2018 18:49:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOWNg-0000k1-9P for qemu-devel@nongnu.org; Thu, 31 May 2018 18:49:18 -0400 Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:38598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOWNg-0000jV-3I for qemu-devel@nongnu.org; Thu, 31 May 2018 18:49:16 -0400 Received: by mail-pg0-x22a.google.com with SMTP id c9-v6so7528196pgf.5 for ; Thu, 31 May 2018 15:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dc9nmEC4EhhoiijrUSkV24PteoW8Hb15c4lSKrNTdhc=; b=b6KsWPsowirLWGQeC0h95k+bgZWIOQEvTdR8u+xI0abJeRV/CfMZ+Ld1NHMqfvNBAE WFvnsKO6pl3dnH5EffsboswTLoUPMBFGSU4TUZaGg1senGtg4W86DluiSCHgMdiPbxxB N7AVODxaUGxalSjlm1/l5B5hiPdxkAojB3mHc= 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:in-reply-to :references; bh=dc9nmEC4EhhoiijrUSkV24PteoW8Hb15c4lSKrNTdhc=; b=AHAaZpE6NRo0TUSDCMKqNodNaTW/9xv2JT1iBZMvS7njHXBph5VUqUDkhlepInnrr7 V7lKbcC8EsyebDS+JxV1xMIzFZV4oPUOj1CT+QYMZAcf5PCUIy6qnHKv5kGIsJz8MTcy A1viHgycLUBXQNaie4gewRdfODSPMjOwV4HOymIQJ2eoMg2E17nSP8TWEM5hF326kseO onNYwKE/T+WYfqhPBgx4LFS72JOE0l6PUSGaux0lKlbHD/dz5kSYorit+W9gBwUyoKkm 8x3ZHrD05OghWHbAGe5lhinxA3cP9EBR/YBPshEZjfezXWuYlcU/qmQ5/vt1kAl4W9eK NCJQ== X-Gm-Message-State: ALKqPweIUiQ1Ym3qV8SSb+q5kewjAsh9wPYzufPR+P+9N7H5zWZGLpWT mTGiFqy8o1v2G1eTjahctmOmZGHvKb4= X-Received: by 2002:a62:ed12:: with SMTP id u18-v6mr8488604pfh.127.1527806954743; Thu, 31 May 2018 15:49:14 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id t3-v6sm33385584pgs.91.2018.05.31.15.49.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 15:49:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 15:49:06 -0700 Message-Id: <20180531224911.23725-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531224911.23725-1-richard.henderson@linaro.org> References: <20180531224911.23725-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22a Subject: [Qemu-devel] [PATCH 1/6] gdbstub: Return the fd from gdbserver_start 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: peter.maydell@linaro.org, laurent@vivier.eu, evgreen@chromium.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will allow us to protect gdbserver_fd from the guest. Signed-off-by: Richard Henderson --- gdbstub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.17.0 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier diff --git a/gdbstub.c b/gdbstub.c index 6081e719c5..057d0d65c5 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1890,15 +1890,16 @@ static int gdbserver_open(int port) int gdbserver_start(int port) { gdbserver_fd = gdbserver_open(port); - if (gdbserver_fd < 0) + if (gdbserver_fd < 0) { return -1; + } /* accept connections */ if (!gdb_accept()) { close(gdbserver_fd); gdbserver_fd = -1; return -1; } - return 0; + return gdbserver_fd; } /* Disable gdb stub for child processes. */