Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4293274pxu; Tue, 1 Dec 2020 01:02:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPZGZ0h6lRIO/YSX7gkmtRofZ33gIuFmsYltwZxEPdBmmhIRNqH1v4tFmaLu893mXOMZST X-Received: by 2002:aa7:da53:: with SMTP id w19mr1986881eds.190.1606813353529; Tue, 01 Dec 2020 01:02:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606813353; cv=none; d=google.com; s=arc-20160816; b=Rlu5AwrX1X15FksWIJ3iPN00j+H6sdMo9FcaY1YRQoyqwrNXE985eZFjDTo2q08YuN Tyf8vFRcNAYyU9S1JSujW9gParvl/5vQD5ZCntJgxCq0t4atjSoIEaSOD68K/HU6//8C UMQlfTsRXhBARK5H0NF6zXsqO6P61ISspBGNflGmDnXQ7+DzbGndut071XOEf8qw9Iz7 9fF8f+AqBRUP55OlDnfkiEnDVK9vGIFhTfYRrBYwGxzsJc2axSlhhLdCWZ61XhbwTrHp WF4aGjNwh76bZR0/OLbCuTBaRi7UgcVzlWRVZfCatOSK/DCQWuVBWy0fWdKiUflNkHwy QB2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yN+iMVbUSxeAR3dBBDnx5GDdtG3f2+iA4BfINsKoPys=; b=FxpUILjcFiIRC0rP9GsJB4Ls31Iz/8rW/dNRJsP8eXXhQbkQaSfSaEqx26ewr5O+pG DHsMlFbPba5fS1J3CPOGbnp6Wt3TN51WWNV2MvEmOV8BUUfl5phYkzB53FYC+GHNOlTM g5JXeDlycKOAMpm1TD2H0JivWP+TgAogjV+O85YM+vw4bzKHipXcdq3Nym2ACuZOQ073 buSR8kjVuNSMoei2I+Hv+1k0vjNgsdoQk9Yfo+pJH30WR6QerpBqUo8ws8Msr2ksj3vG e9L4uPvXnKnANp+D4JB9Y1PnwZK2nXlUpoItaywWc44ZL+WB9WBGa7OpVY7fKcRswNSu Fxzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w5pkbvq+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si675627edh.221.2020.12.01.01.02.11; Tue, 01 Dec 2020 01:02:33 -0800 (PST) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w5pkbvq+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388140AbgLAI7W (ORCPT + 99 others); Tue, 1 Dec 2020 03:59:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:34902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388094AbgLAI7O (ORCPT ); Tue, 1 Dec 2020 03:59:14 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 11B2021D7F; Tue, 1 Dec 2020 08:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813113; bh=S2hOqoDlK5MPvLUKCjduU+DTQ9JNcGnXtpFB+KJ6Wfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w5pkbvq+JYrJiGw4+Ky/JdhQ0/jTg6A1LjHLU7i3PnaR27lbXJVKPdqlUrN3gwK1h oCO/904NsdkIUH/ouXaJL3WdgaIiR8vYBPBwV5+w6F9HpYPUR+B6u60tzGKmN+zRE9 mKq4DegdnZJkKKCeJ9aGx3qncYcPdca7wKHnlFIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , Sasha Levin Subject: [PATCH 4.14 20/50] proc: dont allow async path resolution of /proc/self components Date: Tue, 1 Dec 2020 09:53:19 +0100 Message-Id: <20201201084647.650735416@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084644.803812112@linuxfoundation.org> References: <20201201084644.803812112@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jens Axboe [ Upstream commit 8d4c3e76e3be11a64df95ddee52e99092d42fc19 ] If this is attempted by a kthread, then return -EOPNOTSUPP as we don't currently support that. Once we can get task_pid_ptr() doing the right thing, then this can go away again. Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/proc/self.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/proc/self.c b/fs/proc/self.c index 398cdf9a9f0c6..eba167e1700ef 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c @@ -15,6 +15,13 @@ static const char *proc_self_get_link(struct dentry *dentry, pid_t tgid = task_tgid_nr_ns(current, ns); char *name; + /* + * Not currently supported. Once we can inherit all of struct pid, + * we can allow this. + */ + if (current->flags & PF_KTHREAD) + return ERR_PTR(-EOPNOTSUPP); + if (!tgid) return ERR_PTR(-ENOENT); /* 11 for max length of signed int in decimal + NULL term */ -- 2.27.0