Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4605483ybc; Fri, 15 Nov 2019 07:16:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyq/GEEKfGujowOHjHkVVO9EsEYovl0EsOVIzKupfou9NEJrshTrItu5z5rGTfAc3eylHL8 X-Received: by 2002:a19:8c1c:: with SMTP id o28mr11600763lfd.105.1573831010202; Fri, 15 Nov 2019 07:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573831010; cv=none; d=google.com; s=arc-20160816; b=OZHMoLDj2uTM9ZVWipYou7bOn8scS8taLC4LJd8/woJBdTzYIeCP8J4xw3zl32iqCg g7YIEB+/AWQTXSocyZxQEj40mQbnp99K37Rghtodh3b87D+JOHGLF59NqvVWqgBnItLG Xu9D18Nvnt3F2Yfh3ZGwwNC5sNH9MQk2Gdocygfj8oNI3PTlc2lNNtRWwtZMzlWJ/Rfc Ani0zmUNkHitVxbkDRG0WT0KLgl6PwP+EZigrgV3SrqLuxRg2eUMpzCe8v5u8sbh0f1v sKz2AjrKvhmSS8Txo9r7zxf6ym+MstMy+AmlzOUkXAYs7xWVvJCmB/j9GCF4kH76RcPF IFCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:organization:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=rRI7hzbYQQAGOZWSyPBQQ1xIiuvBL9bck/KjwaW/r+Y=; b=nhpSvKeMlrEsZuxvM8et3QEAEikZxwsNzo+OV4fAzHVcZtyJVH3ZrgHZRyurIgaZvJ Ap9Q1d/2wwLBuTN5Kr6cdYziIJ+IXpJPZuGk9OJDmfG6xfuZJyZwMeRWAG+Qm5mQqU3l v2fbB6jbDLQVYp2omHPIDpDmU8xBin6YhMu+wCSlnPEDJdl+S0VeuecfiYXINwXynK7d O0PWg+U3Qj4dt0dFpJuqGKlSo8lBdPzQkhh7aO8nfjqPM6CR/4TKxJOLz/Jke32FcLbM TbIAPq8sjHe4u+BjxEDST7g9DysbWC3WaVZBA2xRKgs2mcmqKxeIVbwld9y4gQHEqpMq jCmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FWe3Om0j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si5598429ejm.162.2019.11.15.07.16.24; Fri, 15 Nov 2019 07:16:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FWe3Om0j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbfKOPOb (ORCPT + 99 others); Fri, 15 Nov 2019 10:14:31 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40681 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727429AbfKOPOb (ORCPT ); Fri, 15 Nov 2019 10:14:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573830870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rRI7hzbYQQAGOZWSyPBQQ1xIiuvBL9bck/KjwaW/r+Y=; b=FWe3Om0jSLWTKovYOcI3IIlHe943GK6KXQ26+/GmS0ywuN8CrsPsbnmEeBX0mZhTobjV5v 5IKZ1LyEZjM4u/kp31d/AgDyXsJ87cW6opZJHn/In1y7Xt5KxiQpfr0hqQfcXkv7BCW4/O RZ+T+XnNdaVRXcu6X6XKvlV4hplmSoo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-yaz7qSmkOgSx8zd1Rsx6iQ-1; Fri, 15 Nov 2019 10:14:27 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 063CC8EF717; Fri, 15 Nov 2019 15:14:25 +0000 (UTC) Received: from dcbz.redhat.com (ovpn-116-116.ams2.redhat.com [10.36.116.116]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4CFA5C1B0; Fri, 15 Nov 2019 15:14:22 +0000 (UTC) Date: Fri, 15 Nov 2019 16:14:20 +0100 From: Adrian Reber To: Andrei Vagin Cc: Christian Brauner , Eric Biederman , Pavel Emelyanov , Jann Horn , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, Rasmus Villemoes , linux-kernel@vger.kernel.org, Mike Rapoport , Radostin Stoyanov Subject: Re: [PATCH v10 2/2] selftests: add tests for clone3() with *set_tid Message-ID: <20191115151420.GC20767@dcbz.redhat.com> References: <20191114142707.1608679-1-areber@redhat.com> <20191114142707.1608679-2-areber@redhat.com> <20191114183421.GA171963@gmail.com> MIME-Version: 1.0 In-Reply-To: <20191114183421.GA171963@gmail.com> X-Operating-System: Linux (5.3.11-300.fc31.x86_64) X-Load-Average: 1.53 1.49 1.89 X-Unexpected: The Spanish Inquisition X-GnuPG-Key: gpg --recv-keys D3C4906A X-Url: Organization: Red Hat User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: yaz7qSmkOgSx8zd1Rsx6iQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 14, 2019 at 10:34:21AM -0800, Andrei Vagin wrote: > > +=09=09/* > > +=09=09 * This should work and from the parent we should see > > +=09=09 * something like 'NSpid:=09pid=0942=091'. > > +=09=09 */ > > +=09=09test_clone3_set_tid(set_tid, 3, CLONE_NEWPID, 0, 42, true); > > + > > +=09=09_exit(ksft_cnt.ksft_pass); > > +=09} > > + > > +=09close(pipe_1[1]); > > +=09close(pipe_2[0]); > > +=09while (read(pipe_1[0], &buf, 1) > 0) { >=20 > If a child process will crash, this will be a busyloop. No. To be honest the whole loop is unnecessary. If the loop is entered there is immediately a break. > > +=09=09ksft_print_msg("[%d] Child is ready and waiting\n", getpid()); > > +=09=09break; > > +=09} If the loop is not entered it does not loop. So the whole thing is useless. I think I was expecting it to block, but it doesn't work that way. > > +=09snprintf(proc_path, sizeof(proc_path), "/proc/%d/status", pid); > > +=09f =3D fopen(proc_path, "r"); > > +=09if (f =3D=3D NULL) > > +=09=09ksft_exit_fail_msg( > > +=09=09=09"%s - Could not open %s\n", > > +=09=09=09strerror(errno), proc_path); If the child does not exist anymore, the test will fail here and exit. Besides this while() I tried to address all your comments in v11. Any further comments on the test? =09=09Adrian