From nobody Fri Nov 1 07:32:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1708089004; cv=none; d=zohomail.com; s=zohoarc; b=PzLbvCQA5l0Cb9reKM8Z2mEX0cDdEdS7cQh4yCrbIineiFuBwgTHzGWDpBenNAMu7B1F1PEd+RtLdMO/GNHK/THtf9bzyEsij+2+AjqXueT7pbt0yh9+Ss1qnPVxRIWxsRlnowPaDSf7Cnmsq+60BHuoytXRZbvmqi5tg4QMyVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708089004; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Wqjz0Piod7piT4rgCItegBzbLOXa/Xa5cwz933Vwxcs=; b=iWf+6jHSLu0KJeeQn09OTkS5B9NP9EzSGcOOEjOkgtl7fuFDmIhHM7ACd3OWDYY63N/5PDKLXKL2KQhDLelqYJhWcRIlPlrIS1rzutQPCPAwYrtmG+Ma4LqVrlKIXIgDxVuB8J7iKgPdNRKHjwN9iEWBfMpE7U+cAKl642dZZVc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708089004175566.1811864776287; Fri, 16 Feb 2024 05:10:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raxxD-0008AO-8O; Fri, 16 Feb 2024 08:08:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raxxC-00089x-6A for qemu-devel@nongnu.org; Fri, 16 Feb 2024 08:08:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raxxA-0001OS-1k for qemu-devel@nongnu.org; Fri, 16 Feb 2024 08:08:33 -0500 Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41GCrG2h029614; Fri, 16 Feb 2024 13:08:29 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wa83n8d0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 13:08:29 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41GD2lW0016517; Fri, 16 Feb 2024 13:08:28 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6myn39gf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 13:08:28 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41GD8OOe51446078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Feb 2024 13:08:26 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 488772004B; Fri, 16 Feb 2024 13:08:24 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FB3420043; Fri, 16 Feb 2024 13:08:24 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 16 Feb 2024 13:08:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Wqjz0Piod7piT4rgCItegBzbLOXa/Xa5cwz933Vwxcs=; b=phbcF4+J1FwNyD3HERynGE9eu+gijjeTKbbbutmaLRGVSDuIv81AXhVfd2WiMspakYWd 2/6M6VygaLiRHxIl7kon+hQuvvGoGb3puMbXS9QQ370m2QzGig605H+kLrDP1Sq780qa DVJ59XIqkTIm2jjOxjKMD1nv86fBYLLwiYD5vte/6Cs3qs7c9YhDjm3ic1AhO2vtI+pK ed4pL3WhIOapCxKxDPei6ulQFleByjGBopTsIMhaCei1yCQJDyGJC43GCpBskQ2z4/0m /EYEy1QP21zkrpk3SPPEarTAAgd3EUsLqoIFKHz2tgzMVtBjrGzOEBfcs8uM2r52NIIR dA== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Warner Losh Cc: Kyle Evans , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH v3 03/11] gdbstub: Introduce gdbserver_fork_start() Date: Fri, 16 Feb 2024 14:05:30 +0100 Message-ID: <20240216130817.369377-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240216130817.369377-1-iii@linux.ibm.com> References: <20240216130817.369377-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -xs672GQ8UA2acSGxvaBk5BBpcu60XXc X-Proofpoint-ORIG-GUID: -xs672GQ8UA2acSGxvaBk5BBpcu60XXc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-16_11,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 malwarescore=0 bulkscore=0 clxscore=1015 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=888 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402160105 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1708089006201100007 Content-Type: text/plain; charset="utf-8" The upcoming follow-fork-mode child support requires knowing when fork() is about to happen in order to initialize its state. Add a hook for that. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alex Benn=C3=A9e --- bsd-user/main.c | 1 + gdbstub/user.c | 4 ++++ include/gdbstub/user.h | 5 +++++ linux-user/main.c | 1 + 4 files changed, 11 insertions(+) diff --git a/bsd-user/main.c b/bsd-user/main.c index 4140edc8311..bfe6888ea89 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -106,6 +106,7 @@ void fork_start(void) start_exclusive(); cpu_list_lock(); mmap_fork_start(); + gdbserver_fork_start(); } =20 void fork_end(int child) diff --git a/gdbstub/user.c b/gdbstub/user.c index e17f7ece908..5024c670f85 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -356,6 +356,10 @@ int gdbserver_start(const char *port_or_path) return -1; } =20 +void gdbserver_fork_start(void) +{ +} + static void disable_gdbstub(void) { CPUState *cpu; diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index 68b6534130c..e33f8d9a9a6 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -45,6 +45,11 @@ static inline int gdb_handlesig(CPUState *cpu, int sig) */ void gdb_signalled(CPUArchState *as, int sig); =20 +/** + * gdbserver_fork_start() - inform gdb of the upcoming fork() + */ +void gdbserver_fork_start(void); + /** * gdbserver_fork() - disable gdb stub for child processes. * @cs: CPU diff --git a/linux-user/main.c b/linux-user/main.c index e6427d72332..8c7bea1c631 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -144,6 +144,7 @@ void fork_start(void) mmap_fork_start(); cpu_list_lock(); qemu_plugin_user_prefork_lock(); + gdbserver_fork_start(); } =20 void fork_end(int child) --=20 2.43.0