From patchwork Thu Sep 28 10:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 1840693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=B5ztY1Qz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rx9J71lfFz1yp8 for ; Thu, 28 Sep 2023 20:51:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D203C3858410 for ; Thu, 28 Sep 2023 10:51:00 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 1436A3858D20 for ; Thu, 28 Sep 2023 10:50:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1436A3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38SAgraA021519 for ; Thu, 28 Sep 2023 10:50:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=/3KX5CxNAeXKuhDCsmw+4kB5L+ulvmJ3uMgpW0Ontxc=; b=B5ztY1QzFYN19TtJCoNdiWxNHVeD+SJksW2Ce+PGpbzMiaHIrj4bYACmCY1ijWiF6n2w 4MiPiNx02ikcvyo3Tabm5FUl4t+HdnU4OPFKz1zpj24y325wTA91zK2K/YOqUPuILiN/ XtzZhWz+Mrsgs8/WAe4L8aXkDiNL5T3SUQmgaSW9NyZ0hJowVGeX2ACW3LrRv3s78kfh 7+9+VZWm4n69HEKxXernyXFkXFkI3LIpwkNmO8oYHQvg7xS70ijlIokR4gZVLWBvIgl6 qKLKqbjh3tZRLpFaeLhM8gf7/O9TgHK8R7oH6jcBV5INLD5DB52e6YISex2SL9DphnUD Xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3td60au40r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 28 Sep 2023 10:50:50 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38SAjZsI030653 for ; Thu, 28 Sep 2023 10:50:49 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3td60au40h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 10:50:49 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38SA0hT1030409; Thu, 28 Sep 2023 10:50:49 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tad22325h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 10:50:49 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38SAoi0d41288128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Sep 2023 10:50:44 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 021E120071; Thu, 28 Sep 2023 10:50:44 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFF832006A; Thu, 28 Sep 2023 10:50:43 +0000 (GMT) Received: from a35lp68.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 28 Sep 2023 10:50:43 +0000 (GMT) From: Stefan Liebler To: libc-alpha@sourceware.org Cc: dj@redhat.com, Stefan Liebler Subject: [PATCH] Fix WAIT_FOR_DEBUGGER for container tests. Date: Thu, 28 Sep 2023 12:50:40 +0200 Message-ID: <20230928105040.2266853-1-stli@linux.ibm.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zcPkOe5E1zEDMjgNrnAvvoxW2yjeQ4eU X-Proofpoint-GUID: UzkKMCBWCc5vZmcLSZyxYPQYT-YKo2gh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-28_08,2023-09-28_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 mlxlogscore=621 lowpriorityscore=0 phishscore=0 clxscore=1015 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280089 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org For container tests, gdb needs to set the sysroot to the corresponding testroot.root directory. The assumption was that PIDs < 3 means that we are running within a container. Starting with commit 2fe64148a81f0d78050c302f34a6853d21f7cae4 "Allow for unpriviledged nested containers", the default is to use the PID namespace of the parent. Thus support_test_main.c does not recognize our container anymore. This patch now assumes that we are running inside a container if test-container.c has set PID_OUTSIDE_CONTAINER and always uses this PID independent of having a new PID namespace or not. Reviewed-by: Adhemerval Zanella --- support/support_test_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/support/support_test_main.c b/support/support_test_main.c index c20c19e774..f19fce5644 100644 --- a/support/support_test_main.c +++ b/support/support_test_main.c @@ -195,16 +195,14 @@ run_test_function (int argc, char **argv, const struct test_config *config) char *gdb_script_name; int inside_container = 0; - mypid = getpid(); - if (mypid < 3) + const char *outside_pid = getenv("PID_OUTSIDE_CONTAINER"); + if (outside_pid) { - const char *outside_pid = getenv("PID_OUTSIDE_CONTAINER"); - if (outside_pid) - { - mypid = atoi (outside_pid); - inside_container = 1; - } + mypid = atoi (outside_pid); + inside_container = 1; } + else + mypid = getpid(); gdb_script_name = (char *) xmalloc (strlen (argv[0]) + strlen (".gdb") + 1); sprintf (gdb_script_name, "%s.gdb", argv[0]);