Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1977823ybt; Mon, 15 Jun 2020 14:43:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3jp6WWnTP1CFHsCiS5G8PHyECUxLQtoRLVwit/t5ACGAKVlB+AJ3Uizux1fWJTlPk4E89 X-Received: by 2002:aa7:dc50:: with SMTP id g16mr26597672edu.318.1592257385762; Mon, 15 Jun 2020 14:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592257385; cv=none; d=google.com; s=arc-20160816; b=mVZP4IL6VYXGRramMiiQ9Z/x4fMpugIalCBcl3Kg6fdoVIvkRaKkWjlS6abQMc1YDS lKBq6V6RIh2UtWSkt6bZqO4ydJr5P/uIW4uO41XPvfHqBe2dyAvctKqu+BhYW/1/BS/K UPxiiRhkiT+IKFWa9fBSdf9ldAu/w5peId4Q/Mezp6NMCUCO8gl/JRQniF7p1iytHxHa sXMgZRlMb60QRzobGPVOl378yPj5YbhMreDTubZQE7up34EBaJESx+SBVXcPPF6E5uDq rntYqnAF/yscGLlEIxjR/AjOEKg45dsTr0WO8OHap5uka275qoDil3rxwtcjKQLZ/w4k j3KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/cUogu+iDFaDQvb8Kw9QsRBXG9SlrbxKRzkaurXH548=; b=SEU1ZsQs35608HJE7xK6qILy5xFNbfDpH3A8n1sHS2JQ696rbiKcOHS/xTFygbaJS8 BU4NweK4Y66Cx5zl0AzIUnmRfk650qV3nGnjRgiBjSkbBh2pYh/I013DUihFMA0xNOOZ FvZmGq0DWTVrvgPSKuGciTjS615cmJv0bk7kIB2oQl4gmOqoDOmif7I0yWLYsbqYZRdC Q1XucKzLmGnRQSYnZMJFZj0GOoPLtRKVWEOmg9Qqh0qQUoo5cF9A3VS8FPCy9xeS+hX8 z9PzLQrVxJNSQoMZF3C+2aiuJ/UmZXk7WXa/GPzcD14TX2S+WcLZmGBzJmTTuJPcaIV1 mPHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt5si13726674ejc.335.2020.06.15.14.42.42; Mon, 15 Jun 2020 14:43:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726271AbgFOVjA (ORCPT + 99 others); Mon, 15 Jun 2020 17:39:00 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55473 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgFOVjA (ORCPT ); Mon, 15 Jun 2020 17:39:00 -0400 Received: from ip-109-41-2-3.web.vodafone.de ([109.41.2.3] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jkwoY-00087y-2Y; Mon, 15 Jun 2020 21:38:46 +0000 Date: Mon, 15 Jun 2020 23:38:43 +0200 From: Christian Brauner To: Jan Stancek Cc: Cyril Hrubis , kernel test robot , "Eric W. Biederman" , Jann Horn , LKML , lkp@lists.01.org, Aleksa Sarai , Michael Kerrisk , ltp@lists.linux.it, Serge Hallyn Subject: Re: [LTP] 303cc571d1: ltp.setns01.fail Message-ID: <20200615213843.2ojgm3ob7kp3qq6a@wittgenstein> References: <20200615085836.GR12456@shao2-debian> <20200615091850.GA3373@yuki.lan> <1101600340.15989438.1592229781375.JavaMail.zimbra@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1101600340.15989438.1592229781375.JavaMail.zimbra@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 10:03:01AM -0400, Jan Stancek wrote: > > > ----- Original Message ----- > > Hi! > > > setns01 6 TFAIL : setns01.c:176: regular file fd exp_errno=22: > > > errno=EBADF(9): Bad file descriptor > > > setns01 0 TINFO : setns(12, 0x20000) > > > setns01 7 TFAIL : setns01.c:176: regular file fd exp_errno=22: > > > errno=EBADF(9): Bad file descriptor > > > setns01 0 TINFO : setns(12, 0x40000000) > > > setns01 8 TFAIL : setns01.c:176: regular file fd exp_errno=22: > > > errno=EBADF(9): Bad file descriptor > > > setns01 0 TINFO : setns(12, 0x20000000) > > > setns01 9 TFAIL : setns01.c:176: regular file fd exp_errno=22: > > > errno=EBADF(9): Bad file descriptor > > > setns01 0 TINFO : setns(12, 0x4000000) > > > setns01 10 TFAIL : setns01.c:176: regular file fd exp_errno=22: > > > errno=EBADF(9): Bad file descriptor > > > > The messages here are a bit cryptic, I will fix that later on, but what > > it means here is that the errno has changed from EINVAL to EBADF in a > > case we pass file descriptor to a regular file to setns(). > > I posted a series that accepts both errnos about week ago: > https://lists.linux.it/pipermail/ltp/2020-June/017467.html When you used to pass an fd that referred to an open file but the file was not a nsfd the kernel would report EINVAL. Since the pidfd support this now reports EBADF. While that is a user visible change it is not a particular worrying one but something we should still fix. Here's the patch that fixes this: diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index b03df67621d0..cd356630a311 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -531,7 +531,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, flags) } else if (!IS_ERR(pidfd_pid(file))) { err = check_setns_flags(flags); } else { - err = -EBADF; + err = -EINVAL; } if (err) goto out; I'll send a pr for this to Linus this week (or next since I'm on vacation this week) and get this fixed. Thanks for spotting this. What's the Reported-by: line format that LTP uses? Christian