From nobody Sat May 18 06:04:26 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=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1666961055; cv=none; d=zohomail.com; s=zohoarc; b=Wx1NmnX/0tmoLcEdA/L7mIfEZUUvg5hsmvaPV3dvJY2oG2XgSGtC5faU6N3w+ATxuXeXUhR7NtIwrt2dXQlHXyhbvuwFYS08e/t04lg33B0dD4T6R/TjFghfAhdujrIj2YWkIHxDbThidf+058xOCVIA2P+CcWIZEMP6ygr/sPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666961055; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=APjp4q6dQZxZ3Ea3tysFhW2CetwEOH94gYqfg94Ugsw=; b=EcKFJd/H4Yk2xw/exzJkLOEXKvQzCIdM3jzN7icsl/1albkinHwI5/oDDrYFhPX+WCdiOk8eD0NSQSiEOtzgTZVBZbPNF1gd5S2rWKwEusuTS/EcGnJ6XnALeI5+/FgKl87/LW/Vp316ez0Af5k4nLkJY8EJtsw49kzWU2X9/3o= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666961055063268.2415112505; Fri, 28 Oct 2022 05:44:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooOhT-0001sD-2m; Fri, 28 Oct 2022 08:43:03 -0400 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 1ooOhH-0001fj-Js for qemu-devel@nongnu.org; Fri, 28 Oct 2022 08:42:51 -0400 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 1ooOhD-00064l-4W for qemu-devel@nongnu.org; Fri, 28 Oct 2022 08:42:50 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29SCVu3Z037179; Fri, 28 Oct 2022 12:42:40 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgf5r0em4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:40 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29SCYWw2006992; Fri, 28 Oct 2022 12:42:39 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgf5r0ejr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:39 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29SCZ1cD026295; Fri, 28 Oct 2022 12:42:37 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 3kfaht2me2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:37 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29SCgZcs57606540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Oct 2022 12:42:35 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EC93A4053; Fri, 28 Oct 2022 12:42:35 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A25DA404D; Fri, 28 Oct 2022 12:42:35 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.171.39.72]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 28 Oct 2022 12:42:35 +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=APjp4q6dQZxZ3Ea3tysFhW2CetwEOH94gYqfg94Ugsw=; b=JHqqn5ConHOe02hYzG7JInWSbktdH4VJ4JtZF/rD9kgOvVCag82zpscXpgzcykz4B77D Hutz782a3DMrILJ9loyJaMXgFwQaLUx5wLgiKUI1n0S5agfW7BCLJ8ypDZw3OYHGVYDA RNt9+rKjQpxExTnBNJUtgb4PvAH7mtbWRTqM0KNAv+t9OB8bmtxwLz5J1LMX3vqgdJN0 1SciMaqunMZgTeg5xMNLq9ITQTaNVnW/8aZ4JogE8Ca/Z/Zzn9gCelJ5dKAzV4gBJS14 cpl3NHpCLWD1TxcihIE25+heLWe/GOiU4B1Y5Wy6fjTu0GWXNtyzJlJyFVtYZz0ONMGp GA== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini Cc: qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 1/2] accel/tcg: Fix concurrent pthread_create() and munmap() Date: Fri, 28 Oct 2022 14:42:26 +0200 Message-Id: <20221028124227.2354792-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221028124227.2354792-1-iii@linux.ibm.com> References: <20221028124227.2354792-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: EvuyQIxoZg12pqXmHM4H6dWi4bVWSakj X-Proofpoint-ORIG-GUID: ArUPimZoDNu7cOPcPLsf1Hyo-jYaWhtv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-28_06,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 priorityscore=1501 clxscore=1015 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210280077 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1666961055464100011 Content-Type: text/plain; charset="utf-8" munmap() flushes jump cache on all CPUs if the unmapped range contains a translation block. This currently includes new CPUs (i.e. qemu-user threads), for which there is no jump cache yet, which leads to a null pointer dereference. Fix by skipping new CPUs. Fixes: a976a99a2975 ("include/hw/core: Create struct CPUJumpCache") Signed-off-by: Ilya Leoshkevich --- accel/tcg/tb-maint.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index c8e921089df..2a063f91aa6 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -241,6 +241,11 @@ static void tb_jmp_cache_inval_tb(TranslationBlock *tb) CPU_FOREACH(cpu) { CPUJumpCache *jc =3D cpu->tb_jmp_cache; =20 + if (unlikely(!jc)) { + /* This is a new CPU that is not initialized yet. */ + continue; + } + if (qatomic_read(&jc->array[h].tb) =3D=3D tb) { qatomic_set(&jc->array[h].tb, NULL); } --=20 2.37.2 From nobody Sat May 18 06:04:26 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=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1666961051; cv=none; d=zohomail.com; s=zohoarc; b=cmGvAV3wcxkBO4B6hIc0TlWP5BckEhm1npW4jVhNBjtcYUkg7L96ilkckzsIwVusqYMJ1T0N312YmPH2B3B4LJFunMYtgRl9Ev0Yic7oTb1qngGJK7utJjp0kdujVo8QclJVcYyMued+ym0dWF6e/4ps4Dz7TmMt+xaSFv6mkpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666961051; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VdxPTl3PYzSF/etfqvu4vIPffjXQdMNkqzRIeTxS+Ls=; b=NfaR8WXXzlP9Cq6RjjWnrzafv//JYx5fYjRPAWkn4z6aOf6wQKOwNX+pzBAOzvtEt+ZY5cUTlToso2PkwiNUKFGWtCIrv1wH064R7aXfs0LWnvrwpGoQf7t8Oy3SbTZHyidNRK/to66klGP4MfLzZF5UdDa+NSHDMxJ9AOUwois= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666961051351195.68769628438633; Fri, 28 Oct 2022 05:44:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooOhf-00023L-E8; Fri, 28 Oct 2022 08:43:15 -0400 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 1ooOhN-0001hu-Hn for qemu-devel@nongnu.org; Fri, 28 Oct 2022 08:42:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooOhF-00064y-E5 for qemu-devel@nongnu.org; Fri, 28 Oct 2022 08:42:56 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29SCOlMf037606; Fri, 28 Oct 2022 12:42:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgf2k0way-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:44 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 29SCPGPW040418; Fri, 28 Oct 2022 12:42:43 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kgf2k0w94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:43 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29SCa6NQ000955; Fri, 28 Oct 2022 12:42:41 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 3kftf1spej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Oct 2022 12:42:40 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29SCbJod36569368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Oct 2022 12:37:19 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E059A4053; Fri, 28 Oct 2022 12:42:38 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E073A4055; Fri, 28 Oct 2022 12:42:38 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.171.39.72]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 28 Oct 2022 12:42:38 +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=VdxPTl3PYzSF/etfqvu4vIPffjXQdMNkqzRIeTxS+Ls=; b=COYwXAkXQFNrKrZ+M/M+zhYc7rNXGflrh5GMcx1OAnBAnq4ixnqUWcI/WcaciWkxlCzP lMpI6o1kMncTtHrhiPj9T+8uocv6/oSEXwz8Q1v4eJ0B73je7xIhFp4p5deDb/+XHtJZ 4Kzg+5T6Lt272l8wtUf+OeXznYQDeCZfA8m34ooZlOGfVihAVFnnxexKOKBPcbumm7i/ 7+hMUmkAbpKPdsk49AE6M9CQ2XzBKHxeEdhCiVdAZ0eDrgZWBe/71VPtCZ5vBptr35K5 Kq4jtX3RhEUTEwiCvsruAp/OGwRV4VBw/6t+CwHQCEt4W1OneuoZ8q6qUHW9pAo6Mtnt zA== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini Cc: qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 2/2] tests/tcg/multiarch: Add munmap-pthread.c Date: Fri, 28 Oct 2022 14:42:27 +0200 Message-Id: <20221028124227.2354792-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221028124227.2354792-1-iii@linux.ibm.com> References: <20221028124227.2354792-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: rcLeGqdTkmMaw8eMAIjRApjsnRdxONkk X-Proofpoint-GUID: kqBENIP9kQDOWVf5sNA7WpDudI69QsLa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-28_06,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210280077 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.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1666961053483100006 Content-Type: text/plain; charset="utf-8" Add a test to detect races between munmap() and creating new threads. Signed-off-by: Ilya Leoshkevich --- tests/tcg/multiarch/Makefile.target | 3 ++ tests/tcg/multiarch/munmap-pthread.c | 71 ++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/tcg/multiarch/munmap-pthread.c diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Make= file.target index 78104f9bbb7..5f0fee1aadb 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -36,6 +36,9 @@ threadcount: LDFLAGS+=3D-lpthread =20 signals: LDFLAGS+=3D-lrt -lpthread =20 +munmap-pthread: CFLAGS+=3D-pthread +munmap-pthread: LDFLAGS+=3D-pthread + # We define the runner for test-mmap after the individual # architectures have defined their supported pages sizes. If no # additional page sizes are defined we only run the default test. diff --git a/tests/tcg/multiarch/munmap-pthread.c b/tests/tcg/multiarch/mun= map-pthread.c new file mode 100644 index 00000000000..d2ac9aae604 --- /dev/null +++ b/tests/tcg/multiarch/munmap-pthread.c @@ -0,0 +1,71 @@ +/* Test that munmap() and thread creation do not race. */ +#include +#include +#include +#include +#include +#include +#include + +static const char nop_func[] =3D { +#if defined(__s390__) + /* br %r14 */ + 0x07, 0xfe, +#elif defined(__i386__) || defined(__x86_64__) + /* ret */ + 0xc3, +#endif +}; + +static void *thread_mmap_munmap(void *arg) +{ + volatile bool *run =3D arg; + char *p; + int ret; + + while (*run) { + p =3D mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + assert(p !=3D MAP_FAILED); + if (sizeof(nop_func) !=3D 0) { + /* + * Create a small translation block if we have a template for = the + * current architecture. + */ + memcpy(p, nop_func, sizeof(nop_func)); + ((void(*)(void))p)(); + } + ret =3D munmap(p, getpagesize()); + assert(ret =3D=3D 0); + } + + return NULL; +} + +static void *thread_dummy(void *arg) +{ + return NULL; +} + +int main(void) +{ + pthread_t mmap_munmap, dummy; + volatile bool run =3D true; + int i, ret; + + ret =3D pthread_create(&mmap_munmap, NULL, thread_mmap_munmap, (void *= )&run); + assert(ret =3D=3D 0); + + for (i =3D 0; i < 1000; i++) { + ret =3D pthread_create(&dummy, NULL, thread_dummy, NULL); + assert(ret =3D=3D 0); + ret =3D pthread_join(dummy, NULL); + assert(ret =3D=3D 0); + } + + run =3D false; + ret =3D pthread_join(mmap_munmap, NULL); + assert(ret =3D=3D 0); + + return EXIT_SUCCESS; +} --=20 2.37.2