Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp897807pxb; Tue, 1 Feb 2022 12:42:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyy8Id1LqJIAmB+qj54zKv8XPMfp3xewcLmkuJUJIwpeFGVYOzIhoMzsXJ3sv5/gL6PPksJ X-Received: by 2002:a17:90b:4b8e:: with SMTP id lr14mr4410379pjb.54.1643748168984; Tue, 01 Feb 2022 12:42:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748168; cv=none; d=google.com; s=arc-20160816; b=CZXCEN/Ksc5ZAkoj7Jb0X0q0or+rJd4ACjdXPuNNJ0bHzkeEuCvSxdlRsuUYUeMYeh cqZXKnLpqpmexIqJm9QTD+F5O13JgVSy99ucCA2ENqRuJ7NDXvWUlNhHHuitRUaYPf8r GlPKX9YQ6KValZJm3R4izKmF64EY6y2HzgIYK7vox569LepOZkQEhfzZB2/X0tcX0qVF rO/ndWZ+qhH/Rw1s66vk628DqnvaF43GexUgT/wCVHJdzYqeUmYsSW6RK7SUsNKe5prl CazTI6ajfcayJBH8rl8Z8Wa8QJNO9yHU+jf2eucucrGKh6xa4rKpBCYFxiGNesu5vAO2 8Rtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jhKpcZkEDowSCd8hPiP4aOrjjBOOXWKUBDEZ4Umsnng=; b=wIZYLrCEAIjq4pI0gtwEz6zaDH5hS0kXyvo/qmCPu023dLr/JgvkWu08kua3ZkZr1Z /a2l7z8+XEwRvyAf+AQbkQO5Vxy401rrPd/2+JfjKSX13JqgLvYgUdN8R4Efpc8pIp3a rvPelHeWWJMzs0obUnL8fqtD+kr7LaWC4AZDUUemZNBYOkrHZHMyQKj5Sl3cX4c1aH5v Fj2+KCE0MmqygDtmcKq9YFbuT3sKQ1Cn9qFmBAS2tgBByo5Zk9Mh7wRMf1XrLLyf8t96 E+O7Zx53SXcwHQE1BOqirUcWM/NUd49yMln7/3TnxnMvZDNjrQcVIt60d5GX4K0I1TKR 5zdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ovC3C4cA; 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 a14si15976674pfa.154.2022.02.01.12.42.37; Tue, 01 Feb 2022 12:42:48 -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=@infradead.org header.s=casper.20170209 header.b=ovC3C4cA; 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 S1379916AbiAaPvk (ORCPT + 99 others); Mon, 31 Jan 2022 10:51:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379903AbiAaPvj (ORCPT ); Mon, 31 Jan 2022 10:51:39 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F87C061714; Mon, 31 Jan 2022 07:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jhKpcZkEDowSCd8hPiP4aOrjjBOOXWKUBDEZ4Umsnng=; b=ovC3C4cA6GsB7Jcp5zm/3ubOKO Wa9/sp7MaghHHz+SSng/nlpGk9Mc4DQkHSxMjKH3ajQr43FNVnP5btg07SOmzREk31vrplC2ltroF QtXnImYdOc3Q9mjAmuSSNOblBwKyqArsoLD8aI0nJ7Q08DEwSOMyPssK2+9fPQqbIRbPAaY1rcLEl eImwHgLXjz6VYbMjMQLCRrDR+3e7q4MTfuM/KjufxXHShHBHHbOcb/WwfdD+mQv+KDTSNorSsRdyz fqJlR7ssST58P/CvJnJJcs5D6woDyHLJO6ik3KwmCieDBOcRTg58vG3ysBmdZDaqu0ZbVKXKBe3j9 qp84V1Fg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEYxd-00A506-QH; Mon, 31 Jan 2022 15:51:21 +0000 Date: Mon, 31 Jan 2022 15:51:21 +0000 From: Matthew Wilcox To: Christian Brauner Cc: kernel test robot , Kees Cook , Ariadne Conill , 0day robot , Michael Kerrisk , Rich Felker , Eric Biederman , Alexander Viro , LKML , lkp@lists.01.org, Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [fs/exec] 80bd5afdd8: xfstests.generic.633.fail Message-ID: References: <20220127000724.15106-1-ariadne@dereferenced.org> <20220131144352.GE16385@xsang-OptiPlex-9020> <20220131150819.iuqlz3rz6q7cheap@wittgenstein> <20220131153707.oe45h7tuci2cbfuv@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220131153707.oe45h7tuci2cbfuv@wittgenstein> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 31, 2022 at 04:37:07PM +0100, Christian Brauner wrote: > On Mon, Jan 31, 2022 at 03:19:22PM +0000, Matthew Wilcox wrote: > > On Mon, Jan 31, 2022 at 04:08:19PM +0100, Christian Brauner wrote: > > > On Mon, Jan 31, 2022 at 10:43:52PM +0800, kernel test robot wrote: > > > I can fix this rather simply in our upstream fstests with: > > > > > > static char *argv[] = { > > > "", > > > }; > > > > > > I guess. > > > > > > But doesn't > > > > > > static char *argv[] = { > > > NULL, > > > }; > > > > > > seem something that should work especially with execveat()? > > > > The problem is that the exec'ed program sees an argc of 0, which is the > > problem we're trying to work around in the kernel (instead of leaving > > it to ld.so to fix for suid programs). > > Ok, just seems a bit more intuitive for path-based exec than for > fd-based execveat(). > > What's argv[0] supposed to contain in these cases? > > 1. execveat(fd, NULL, ..., AT_EMPTY_PATH) > 2. execveat(fd, "my-file", ..., ) > > "" in both 1. and 2.? > "" in 1. and "my-file" in 2.? You didn't specify argv for either of those, so I have no idea. Programs shouldn't be assuming anything about argv[0]; it's purely advisory. Unfortunately, some of them do. And some of them are suid.