From patchwork Wed Mar 6 14:40:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 778308 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:47:b0:33e:474f:8c56 with SMTP id k7csp325899wrx; Wed, 6 Mar 2024 06:44:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU4EDgWWoWCTjDNfRyV4JGt7LjhNDT0eE1FTOP/+n7Eo0+bXlGUeCHoqEbyGloQZ6st1kZigPOEN7kYcQzC35hN X-Google-Smtp-Source: AGHT+IFP1QvQmYgglxGrcqcO1bhqXZPBacvpfVrhVpNtos/FisrZGM0dLqGrSNWlUgRcWsHUgUPL X-Received: by 2002:a05:622a:1792:b0:42e:e949:7a40 with SMTP id s18-20020a05622a179200b0042ee9497a40mr6127326qtk.52.1709736260208; Wed, 06 Mar 2024 06:44:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709736260; cv=none; d=google.com; s=arc-20160816; b=lE2fl0K9Xu1P7mcbMpuGPq1tOQpkQFIZz+FEIu5W4GBi3nXAT0h3/8PUk/3SlmNS3M NEePh4rJxRZuBkIBm1YWYDtC798+affeMRrJulhyNqxg55m4CaqN50zJnj7qmKpIKarg 61O37fPFd6dn1a53kdS3Vj/ONk2UFFXTgBAHZt8A7/LqPKEedkPXfX7THg+mdzDPYKUe IwVmAhGG4zigbFUze4s0VwA/TAINTFfqu6R3mXm3LmkwYvHFg69Ih6NmiBIdI+6Lfi6n Nq9wjd9G+OwOmuxJX9MNvcypqTfBKrNdMoMRsnb0XTrM+/nPcH62vX4F6O9lsXAeE+G9 +ptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fupeVcwCDkBVKZ33Doy2sEKI/KbVAY0Qy8ZqQctJp/I=; fh=zThSDgYGIOVG8z7TLY6kj0qgqwLmcvT95XZqu917hRs=; b=SSkPGPJLypjHR3bDtnUTkGdw28m56vl/y3hFPostT8ugvqifQWrzLe5XlZOENAKziS 4gHCptguza8zFsA/+BkDJ4XomiaQjeGaFubgHU1hZqLqvg5YpkgzbVYubB99Jb1PfBjs nE216c4KMXjQSElw4jQMxoyGBsVX4Y5mZPmCherUw6h9vmmOqmPA57FcZUrNBCbDyUeI JUeO+VvCJQwFIWMQJgWGDxaC8aQCS0vWtWg1DZ6DG+QYo+N4IChXIGKOGkLC9q8rai1m 9Bp4nw+6dTyX7iwvD5joJtfpNcXUR4LvJpS7O7gK/hc4+/fh5mCVDQ4QTXDTmgzhZxpj +RmQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GnJyQVAh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h6-20020ac85846000000b0042ee01ff776si9143709qth.732.2024.03.06.06.44.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2024 06:44:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GnJyQVAh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhsS8-0007fk-6A; Wed, 06 Mar 2024 09:41:04 -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 1rhsS6-0007VB-Hy for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:41:02 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhsRx-0001U2-9B for qemu-devel@nongnu.org; Wed, 06 Mar 2024 09:41:00 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33da51fd636so3751129f8f.3 for ; Wed, 06 Mar 2024 06:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709736049; x=1710340849; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fupeVcwCDkBVKZ33Doy2sEKI/KbVAY0Qy8ZqQctJp/I=; b=GnJyQVAhsiRoBU59M1p680pB31XjYXajt4ziQ4cAi1kmwOolTJdZsTxv0+rhblMtxz grRCMEbqlEnO/EOcL4g1Askft4c/mjEI5PHIDteyZ42J3vTGnRr9NGk8IbiXbDQdDYrC DtXUmmaI5bpsbOq5C01bXWobNv4wmrlloQN/KbD8+wZZyaLsMUyZQCK9Jf/dPWLOkKxj yH4sGSOu9k1pcycMXrltoMzprIDaLr/EwEb30bj7ygAFvmyZb3adOIFKh1SEGoXsRVAJ 9MUaZGInNn/NIrEJpxRA8W+Rtu1ga4V+7h2tf8Oy/j6wxhw7XRuiVoEfcjgPSvdZ8EUA VBVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709736049; x=1710340849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fupeVcwCDkBVKZ33Doy2sEKI/KbVAY0Qy8ZqQctJp/I=; b=pSzgQxnWV4JhoLtZsl27y+gPkLRtE6Qsf3/JjErj358LdLpq/TJkPgztv4NtK8QOjh oskGQub9IH0wKs2Q+ba4Q7+YLn5+IIJ6k0WyH71xe5GFzKU6YRLtwLocwLAxK4T/Ha7z BTBMr61LbgrUMcHWwxr7mp7exJBcvyljssUzO7jr/XdCrK3XI8/7W5RtpyIkxzv/OFvb ZLtJnupoe4aluR9I8DV6gCPRIKCFjVzURfM6Qs3Ph/8cQgM5NYjRqkfZ8eSc4AoFbGEO v7b4HaL17c6tif8XM2t/0eT0Y9TUZZxjCJq1jb8zOjSnVxKBc/YjsY+ejVN/pwS+As2S TSdg== X-Gm-Message-State: AOJu0Yy1UM68FfzU4X8UAihgQq/hOztmFnq5HbYzrrxV5HK4eBQpRcT1 bybqWdipCJH5HuV4W2ifuanoeiJOIMrCOuOOBvZaID6jEXqAgX2qT3jQhz60G1A= X-Received: by 2002:a5d:55c4:0:b0:33e:17fe:8c23 with SMTP id i4-20020a5d55c4000000b0033e17fe8c23mr10714673wrw.22.1709736049684; Wed, 06 Mar 2024 06:40:49 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id bv16-20020a0560001f1000b0033e0523b829sm18239207wrb.13.2024.03.06.06.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 06:40:45 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4DF0D5F95B; Wed, 6 Mar 2024 14:40:42 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Warner Losh , Kyle Evans , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 07/29] {linux,bsd}-user: Pass pid to gdbserver_fork() Date: Wed, 6 Mar 2024 14:40:19 +0000 Message-Id: <20240306144041.3787188-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240306144041.3787188-1-alex.bennee@linaro.org> References: <20240306144041.3787188-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich The upcoming follow-fork-mode child support requires knowing the child pid. Pass it down. Reviewed-by: Richard Henderson Signed-off-by: Ilya Leoshkevich Message-Id: <20240219141628.246823-7-iii@linux.ibm.com> Signed-off-by: Alex Bennée Message-Id: <20240305121005.3528075-8-alex.bennee@linaro.org> diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index e33f8d9a9a6..3f9f45946e0 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -54,7 +54,7 @@ void gdbserver_fork_start(void); * gdbserver_fork() - disable gdb stub for child processes. * @cs: CPU */ -void gdbserver_fork(CPUState *cs); +void gdbserver_fork(CPUState *cs, pid_t pid); /** * gdb_syscall_entry() - inform gdb of syscall entry and yield control to it diff --git a/bsd-user/main.c b/bsd-user/main.c index fca9b302043..0dbd1cf8801 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -138,7 +138,7 @@ void fork_end(pid_t pid) */ qemu_init_cpu_list(); get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id(); - gdbserver_fork(thread_cpu); + gdbserver_fork(thread_cpu, pid); } else { mmap_fork_end(child); cpu_list_unlock(); diff --git a/gdbstub/user.c b/gdbstub/user.c index 536fb43b03e..c61e1a0d1f6 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -375,7 +375,7 @@ static void disable_gdbstub(CPUState *thread_cpu) } /* Disable gdb stub for child processes. */ -void gdbserver_fork(CPUState *cpu) +void gdbserver_fork(CPUState *cpu, pid_t pid) { if (!gdbserver_state.init || gdbserver_user_state.fd < 0) { return; diff --git a/linux-user/main.c b/linux-user/main.c index cab95f5b0aa..70314e0ab6a 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -165,7 +165,7 @@ void fork_end(pid_t pid) } qemu_init_cpu_list(); get_task_state(thread_cpu)->ts_tid = qemu_get_thread_id(); - gdbserver_fork(thread_cpu); + gdbserver_fork(thread_cpu, pid); } else { cpu_list_unlock(); }