Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1953877ybd; Thu, 27 Jun 2019 04:27:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqym+X9NlDGOEQgdBlq8OauSWnZV40lMuPuISybHGqEPTiF0VyMkZ+K5j51PMuPE5lnUooJm X-Received: by 2002:a65:6541:: with SMTP id a1mr3267200pgw.409.1561634821374; Thu, 27 Jun 2019 04:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561634821; cv=none; d=google.com; s=arc-20160816; b=q5e2RqrlXachgFvLsyTer7hVZJ3DWQjDSPLBYmRjXvlkgtLCY30BQ2TTsN0DS+fbz5 zWRYoaq/qcZDChpvjq6tKp6VeigB9CGjH5a/gniqjD0ORS3GJpVumEoMH1YAsTLO0R39 B7v6IvwMJ8yVyT1we+vCJ2w8RnVVF0DgLcRHU0GBrAkB0yBylC5iOy4LE4QIdJJ8uaQ6 6azSmQhVbNILu9j05Ptwd/fsdeRWbnpL4mUsHOkmJvB+K/mrUVyIJC7wwn1PgNUqvxJN B3weB6kdLiq9gskRH62NMnY1Sl6XcWRPuE2x8fwzqjnvMYotJmyXxIunSCHr4PfQYJR5 081Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+R8cZh89FEOeHcIUvPlsxuC14AmG6N9OhNcwtNtA4EA=; b=MumBY8mgJ6NbSqcLruTC7nEnXLRtdFa2abHmW+IHOFHQthjj8SKGAm6Ma94iOXpasO ZfSE1nPWRPhOZH+QwvT0ntXeJZ/JlmkMfdCEPznEJm9MgAHj3YfsB1JM55SwR8JjiItG kuhq/sX3KIX+tOkjI1H2XJl5c0taVCYjYdm7T+eq9H+DjEDJNBxOIbPkz+ClrFXyIOcA uT19TiokdqfgjLHmvNEhjq3yTmuCGMOjqTcbzBvSVqZjjmYBzwuTFbwrzEvoz9z9X4O9 /Lvqqf6oRbeV5SWwEseSPH6PxlwwDTT7zZUfPTti7aq01RX2Yfep5BhOKQ8EH6x/QT/W 0y0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b="IU/Kbska"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh8si2127282plb.175.2019.06.27.04.26.44; Thu, 27 Jun 2019 04:27:01 -0700 (PDT) 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=@brauner.io header.s=google header.b="IU/Kbska"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbfF0LYq (ORCPT + 99 others); Thu, 27 Jun 2019 07:24:46 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42166 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726437AbfF0LYp (ORCPT ); Thu, 27 Jun 2019 07:24:45 -0400 Received: by mail-wr1-f68.google.com with SMTP id x17so2106466wrl.9 for ; Thu, 27 Jun 2019 04:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+R8cZh89FEOeHcIUvPlsxuC14AmG6N9OhNcwtNtA4EA=; b=IU/KbskaBCUjKs+HsVZOriBfDVGNmyOJj1EBy5NhRvtb5iOp15a3Y3aIUXNcUGA3/I 0Vcufe+9lsoYsN5tOnH9YrUI2EtMlV87yldccWBxGvyMPbSoJH3+sNWT8+sKYnTr5Yss bp3XeaBv3TMYAHDlEBFGARlv1383v9CXkoMXpdRGujjz+pfaDp0JGf85uPPfD6lGhLDC hhjv74ZQKNSqOnktKQE9uMP5YiUHrKDXVb392dnVRxGJp9c3RMG7bAvE/uu2U3wUoADd 9ehi2H5bk4LOPi2m/ZNhxKiZWVKEyLs8JLT0ny6iTKZH7w80J8Jzq8tHUPvamxs6vGEq Df5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+R8cZh89FEOeHcIUvPlsxuC14AmG6N9OhNcwtNtA4EA=; b=oP6dZwJZ9e4+1eAkhv5qgdcMGUpRqdeh8CJxPEhVqD4LpKgrwgDsjGHh7FnJkgKmAZ q+2yUZmbXq1S9gTkqtETQhTKEQt4ChRONMhu0hxSHN2lbM6RQ8COLNK4fvYiJrCK/05i HB2JXHiyPK0nwoxb0WQAHVVAETtpw7brdoTwixzKA4wCKOIIWlZ3ZsIBZsx6LrTakGYp Yjf08NnnB41qhK8dKqIolzwK0lpt7hUTMvPGzztXOFdwQsNI476Z87VU2a1P0Nd6ryNB F4zxnU0QMiA9zi7cxegFNebLncNx5WF17gIlFjcQjxsobOV+6Pb57olJa/VPeCya6yw3 CWXQ== X-Gm-Message-State: APjAAAUCL3tj8MF5afbtFrulTe+5KgdgM1NEGKSHrDrPNJWTEgO/Wqqc GSF/7KSTA1o2yj3fdCGAy8Z5bA== X-Received: by 2002:a5d:4484:: with SMTP id j4mr2892379wrq.143.1561634683056; Thu, 27 Jun 2019 04:24:43 -0700 (PDT) Received: from localhost.localdomain ([212.91.227.56]) by smtp.gmail.com with ESMTPSA id z126sm7563789wmb.32.2019.06.27.04.24.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 04:24:42 -0700 (PDT) From: Christian Brauner To: torvalds@linux-foundation.org Cc: linux-kernel@vger.kernel.org, ldv@altlinux.org, viro@zeniv.linux.org.uk, jannh@google.com Subject: [GIT PULL] fixes for v5.2-rc7 Date: Thu, 27 Jun 2019 13:24:30 +0200 Message-Id: <20190627112430.6590-1-christian@brauner.io> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190627045602.pqv67qxjj7ooaqir@brauner.io> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, This contains a couple of fixes for the pidfd api by Dmitry, Al, and myself: The following changes since commit 4b972a01a7da614b4796475f933094751a295a2f: Linux 5.2-rc6 (2019-06-22 16:01:36 -0700) are available in the Git repository at: git@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-20190627 for you to fetch changes up to 30d158b143b6575261ab610ae7b1b4f7fe3830b3: proc: remove useless d_is_dir() check (2019-06-27 12:25:09 +0200) /* Remove check for pidfd == 0 with CLONE_PIDFD */ Userspace tools and libraries such as strace or glibc need a cheap and reliable way to tell whether CLONE_PIDFD is supported. The easiest way is to pass an invalid fd value in the return argument, perform the syscall and verify the value in the return argument has been changed to a valid fd. However, if CLONE_PIDFD is specified we currently check if pidfd == 0 and return EINVAL if not. The check for pidfd == 0 was originally added to enable us to abuse the return argument for passing additional flags along with CLONE_PIDFD in the future. Since extending legacy clone this way would be a terrible idea and with clone3 on the horizon and the ability to reuse CLONE_DETACHED with CLONE_PIDFD there's no real need for this clutch. So remove the pidfd == 0 check and help userspace out. /* Avoid using anon_inode_getfd() and ksys_close() */ Accordig to Al, anon_inode_getfd() should only be used past the point of no failure and ksys_close() should not be used at all since it is far too easy to get wrong. Al's motto being "basically, once it's in descriptor table, it's out of your control". So Al's patch switches back to what we already had in v1 of the original patchset and uses a anon_inode_getfile() + put_user() + fd_install() sequence in the success path and a fput() + put_unused_fd() in the failure path. The other two changes should be trivial. Please consider pulling these changes from the signed for-linus-20190627 tag. Thanks! Christian ---------------------------------------------------------------- for-linus-20190627 ---------------------------------------------------------------- Al Viro (1): copy_process(): don't use ksys_close() on cleanups Christian Brauner (1): proc: remove useless d_is_dir() check Dmitry V. Levin (2): fork: don't check parent_tidptr with CLONE_PIDFD samples: make pidfd-metadata fail gracefully on older kernels fs/proc/base.c | 3 +-- kernel/fork.c | 58 +++++++++++++----------------------------- samples/pidfd/pidfd-metadata.c | 8 ++++-- 3 files changed, 25 insertions(+), 44 deletions(-)