From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 453D9C433F5 for ; Mon, 31 Jan 2022 15:51:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE3F26B00BC; Mon, 31 Jan 2022 10:51:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B94D38D0002; Mon, 31 Jan 2022 10:51:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5C038D0001; Mon, 31 Jan 2022 10:51:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id 91D466B00BC for ; Mon, 31 Jan 2022 10:51:44 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 56853876EC for ; Mon, 31 Jan 2022 15:51:44 +0000 (UTC) X-FDA: 79091022528.05.D877695 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP id CF49720002 for ; Mon, 31 Jan 2022 15:51:43 +0000 (UTC) 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> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: CF49720002 X-Stat-Signature: agncqmwuxradnzpww7b13a994e3sffu1 X-Rspam-User: nil Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ovC3C4cA; spf=none (imf31.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1643644303-193066 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.