Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1067393iob; Wed, 4 May 2022 13:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+qnqdKxLEtM2esTijp2ET82eSTAGna4Lhk6/bDVDOOETbCSCMSnYb+ziyvLKyVsgPAl6w X-Received: by 2002:a05:6402:11cd:b0:427:bf42:44ef with SMTP id j13-20020a05640211cd00b00427bf4244efmr19086301edw.336.1651697987916; Wed, 04 May 2022 13:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651697987; cv=none; d=google.com; s=arc-20160816; b=qrQeG1CHLqmuhHSofXz3IJcpLruxYocm9XJVSHIaA78tvFjC+6HM2O1Ss6jv1VMpOn Xo+vvfj6OIR1XXhcvsoIPFIR9NG0r6HPQ8WPerI8IXARKSxEAzbS4IQAUindxykD56Vd Dq0+fTJOuWH4dpCECsj4rMYFwduBLX5t3lyo2KZD7d7rhw4/TJFsfPVldW62j3G7AhJJ Qs6T+Ne9ZdNbndVNdCBuyxOjgi8EiiHBksRx+OwXineizxXScyjHHIdyfynNokVmF3/Y GB7ohQi5567z6zopZa6O9Z3if6DNSCNOSa8r0aqNeLejYAcN4jr3FOdHWZy6Do5YpwCw t6zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=KPMWPhYqEQF1ltoFBxRxCax/s1QZtZqIo48r/AMIaYE=; b=LC3RGB07oGleDodevYV7qr5rhSRKZU9nuRy4Gmaw6gDhrwoVjyaeyJxL0q1ts5ID2V +zZTOayQH/kpearETIu9sCBUbFIPksFO9RBCk1A7CnHWni8KZQ3EPM+EE96VPGx6ZOUg qNja8jF+4uOLgyGCKDy11NatAhleiXX7OylV9tytJMUYUzYgO3YsInmTFsyxPx1bdTsp 0YFg78DjDTSo+o2JvPla1Jae2xoXbYX9v9CRcnkjU74+0UWKalbm6kU0O/LOj9svMyXX OROOHFHxZ0QKQjSj3D7XVOAd57jZylOH1xl3ZKnhnbJr35MEDXpWGdJ0Sfbdu8pD60Tv /I4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hCsPe0mE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020aa7c787000000b00425f040b83bsi672527eds.87.2022.05.04.13.59.23; Wed, 04 May 2022 13:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hCsPe0mE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240341AbiECR3s (ORCPT + 99 others); Tue, 3 May 2022 13:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240340AbiECR3q (ORCPT ); Tue, 3 May 2022 13:29:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C78621E29 for ; Tue, 3 May 2022 10:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:To:Subject:MIME-Version:Date:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description; bh=KPMWPhYqEQF1ltoFBxRxCax/s1QZtZqIo48r/AMIaYE=; b=hCsPe0mEC+Saf+/kwAxM1SrY7L 3rQm3LYAinl9ekWKGZREBvFneuZKpGWFaD4RLGs9XHKu+wKqHw4r2QcDAeWpWEVM8l+eUe9e37hS7 30eufNmZa2F6HkniML8ldHeuvkqXQcQ409DrAwMcI5AzLQBh9+DuvcBSjXMq25HvaqoPwPFzUm32d Tix0oIb2dHwwxpGgUfW6Qd1OhdVgcxooI5epN3T5YA1gETn6s0EgYNoC3uPuSwdR65ajusY2HD9vE 5FifMB6xq9h0ridcn4B46Z/wdcc95NMFb2K5wxYwQXK+jUHMXDSrJgIjO6HSTEp/u91cR5kTO6NSh ZVzs8QZA==; Received: from [2601:1c0:6280:3f0::aa0b] by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlwHo-00FpVI-ID; Tue, 03 May 2022 17:26:08 +0000 Message-ID: Date: Tue, 3 May 2022 10:26:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: BUG: vfork() returns EINVAL after unshare(CLONE_NEWTIME) Content-Language: en-US To: =?UTF-8?B?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?= , linux-kernel@vger.kernel.org, Alexander Viro , Christian Brauner References: From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [add some readers:] On 3/31/22 01:36, Марк Коренберг wrote: > test: > ---------------------------------------- > #define _GNU_SOURCE 1 > #include > #include > #include > #include > #include > #include > #include > > #ifndef CLONE_NEWTIME > #define CLONE_NEWTIME 0x00000080 > #endif > > int main (void) > { > if (unshare (CLONE_NEWTIME)) err (EXIT_FAILURE, "UNSHARE_NEWTIME"); > > pid_t pid; > switch (pid=vfork ()) > { > case 0: > _exit(0); > case -1: > err(EXIT_FAILURE, "vfork BUG"); > default: > waitpid(pid, NULL, 0); > } > return 0; > } > ----------------------------------------------- > > Seems the bug in kernel/fork.c. It does not check for CLONE_VFORK > > if (clone_flags & (CLONE_THREAD | CLONE_VM)) { > if (nsp->time_ns != nsp->time_ns_for_children) > return ERR_PTR(-EINVAL); > } > > ----------------------------------- > Changing vfork() to fork() in the program works ok. > The bug has been found during regression in our system because Python > 3.10 runs subprocesses using vfork()+execve(). > -- ~Randy