Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp417472pxb; Thu, 31 Mar 2022 08:18:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQm0eCvSqPwiJ/LR+8h577WWbCPKmfAldng5MpkL/nkTQugLXVfXBvcXI4uqUvvCI6NPfY X-Received: by 2002:a17:907:7f04:b0:6e0:39a2:79a6 with SMTP id qf4-20020a1709077f0400b006e039a279a6mr5282266ejc.243.1648739885895; Thu, 31 Mar 2022 08:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648739885; cv=none; d=google.com; s=arc-20160816; b=D8XWS/1uFVLIAl7L1ZCbW2vD8flsSW3VJSTJr98yq050wA8NU9vJPmIvXa9dLfgQvQ 3q3/SLWwu1vXObfvWBv8O0N5GipN8iUzHKvImL91UAvKY04TxI1gQXKUBr/jyehvpGOD RfP6Or/nx8ssDK7r+vyaUWoQ3ZqGMdUCzDdNUQ3z+Hn0vAqvzcDssFvtNw7hdPUmiMrM DnH7LNuqUZN1BG0WqepC/J+oOnPGSj/StLkFNMwUYBSUcc+CEPuoTCiNLXznDa1j9Q7y LfTkAS0/ifJuwIvgnfFcekoesNWpSa5wF+BFcKmH8oKNZfQOH2AzUm3d4qo5EYooiaPt 2vUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=FfqJEQoGErwXNp6fBt9awHj++W7+1e1gnIfr7wj0C9Y=; b=j/zSGZoU2oeOu0ATXqAjXP0l5xtTvHrgluoxXn4rZvtr6y4LuJEF7hGEsjAat9q2qR eU5ikHd1Egma37QsuY17qvniXbKjE5wDUnBJMtnk2/6DwFHgzqOC2GAr39HxkR1+bhIH xmiH5ICOmLm6AJ/GAAhDl7n/nldoHlWJmcZaLdm8ap51UfUmoFUeIB7djhfbfc0fViHl 8liUvnXe1SL5tP7Bv6Q/D7W0y7jcuVznQ63kGX+yEt3h9x2ZJrGqQfiqZ5o6VXHWSfP2 wsVdwKsUTzbUC+ZkIxaqRvySbqPVR2H5PXyUeZzSG6CAugcCQzLHHaqlYt3tdopd8Uws 9w8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F7XdH9Wq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd16-20020a1709072a1000b006df76385d9csi21502799ejc.572.2022.03.31.08.17.39; Thu, 31 Mar 2022 08:18:05 -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=@gmail.com header.s=20210112 header.b=F7XdH9Wq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232943AbiCaIim (ORCPT + 99 others); Thu, 31 Mar 2022 04:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiCaIik (ORCPT ); Thu, 31 Mar 2022 04:38:40 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7DC71F044C for ; Thu, 31 Mar 2022 01:36:53 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id s11so21278391pfu.13 for ; Thu, 31 Mar 2022 01:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=FfqJEQoGErwXNp6fBt9awHj++W7+1e1gnIfr7wj0C9Y=; b=F7XdH9Wq5B0XQUP2JI66crA6WPuRWEROHYIiyVUOf0f1P9BWJBWGgsabrRheMcLj2N ZdQgtRNDdNP37judw1XE08b+66FcpX7Tsp8NTQUJE1jK96ngLJc33MdcJhafx+r8i41L uyuNTzGvJIEyJHDA7qsGIuFaTvcUrkazCJVmu7EajH3G4/qd1JruznNCVrGfaeLcvxuv I7g/EcfSM5V0jAP0SKxOO3YegUyGVCBnTobJSXXBDolqbLx+AZwlKQs/r8Nva1B1zDky rciTf6d/lkzpQCNXiyFN/ALgs0AcZpgLCzQK1xSdOwSJxs+LdDthTJ7j6+OP0u5EX5xi SfuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FfqJEQoGErwXNp6fBt9awHj++W7+1e1gnIfr7wj0C9Y=; b=zBwHWbk3rQtbvEjheV1ayA5o85nJSWqfgO5gQwQI/BWV0oRMK+5z9xPiVp4jRG1qbw XXHreYOo6iotSmAazR10ggLGpv2HKoHKJvUMwGgUkRxGxV9gSxjBowa7p2oPyYlSMMGl kD+DUSYoU4CNjAU60yAXTWynuR9dq7IEorZ5aFipDw3DYWyTs/FphRWL46MpIEIEB0oe Sr6PToCpz2Wv0Y0HD/FctMEln5k0gVXgjIwt7uDcAWw+i7+KuVRIwbWbWDPA8SJTy+xB EV0KAKZ6aZQyOWSzw7GnzuK/6Z4a15c7rLAgYMeToLocYbd6vkozTh20t9c8Jest5yj/ hFlQ== X-Gm-Message-State: AOAM533iAZxmM0WNN+BN5/I0xReox5lwMmKKyXsdlB1IN3tfWT6Wedhq KgQqFfJMstLTkR4o/1Us4LivcxUTLLtNobvwkFtspAbdMDTSaw== X-Received: by 2002:a63:c24:0:b0:382:2a04:3dbe with SMTP id b36-20020a630c24000000b003822a043dbemr9819275pgl.158.1648715813184; Thu, 31 Mar 2022 01:36:53 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?= Date: Thu, 31 Mar 2022 13:36:42 +0500 Message-ID: Subject: BUG: vfork() returns EINVAL after unshare(CLONE_NEWTIME) To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 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(). -- Segmentation fault