From patchwork Tue Apr 12 11:33:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12810597 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52FD5C4167B for ; Tue, 12 Apr 2022 11:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350926AbiDLLvC (ORCPT ); Tue, 12 Apr 2022 07:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355040AbiDLLtJ (ORCPT ); Tue, 12 Apr 2022 07:49:09 -0400 Received: from mail1.bemta32.messagelabs.com (mail1.bemta32.messagelabs.com [195.245.230.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E89D06165; Tue, 12 Apr 2022 03:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1649759590; i=@fujitsu.com; bh=CIzjA74MEWi+h5owqklrQgjAz3Lbuv5+Ro+Bd5ui2SA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cWvc+RNJfuMp6pdMclfWbYhJQ038JvIhpg2CmbN1MPXalcwCxvtaZxW+0oZS65gVv 1EfU5Fv066cYhj05CeVs7vO1Hgyy4Py0yih1QKU2uqRFbIoUOX1sdb0rVwlSPzAtCO 5qNZwjRqgh6yOxb1+bMK5/S6ZcpFRc2mzTsB61NUHkSZYQW+FSpmoHdcFaIxLByClO Tl2tk1BaQV/iwQ+CZGxKaTPbXaG0Sz5wydWZ+a4evgcPJisNjL0/ISEUycducZD/rv caiDSm3T3mSg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3U+T5t+vPJq4t9d ji63novsNL+QF7RdiaU4I9FQi7moOBEAFB/db2ADAAA= X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-14.tower-587.messagelabs.com!1649759589!2976!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20749 invoked from network); 12 Apr 2022 10:33:09 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-14.tower-587.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Apr 2022 10:33:09 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 5CA13100445; Tue, 12 Apr 2022 11:33:09 +0100 (BST) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id 4E120100331; Tue, 12 Apr 2022 11:33:09 +0100 (BST) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 12 Apr 2022 11:33:03 +0100 From: Yang Xu To: , , CC: , , Yang Xu Subject: [PATCH v3 1/5] idmapped-mounts: Reset errno to zero after detect fs_allow_idmap Date: Tue, 12 Apr 2022 19:33:42 +0800 Message-ID: <1649763226-2329-1-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org If we run case on old kernel that doesn't support mount_setattr and then fail on our own function before call is_setgid/is_setuid function to reset errno, run_test will print "Function not implement" error. Signed-off-by: Yang Xu Acked-by: Christian Brauner (Microsoft) --- src/idmapped-mounts/idmapped-mounts.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c index 4cf6c3bb..8e6405c5 100644 --- a/src/idmapped-mounts/idmapped-mounts.c +++ b/src/idmapped-mounts/idmapped-mounts.c @@ -14070,6 +14070,8 @@ int main(int argc, char *argv[]) die("failed to open %s", t_mountpoint_scratch); t_fs_allow_idmap = fs_allow_idmap(); + /* don't copy ENOSYS errno to child process on older kernel */ + errno = 0; if (supported) { /* * Caller just wants to know whether the filesystem we're on