Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2602330rdh; Mon, 30 Oct 2023 02:07:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbsAOnus8BCclrV2iFQWfcFNRKSDMtUy/19Ju1fQH8win7bjjGRpbgDA8S/HylHuI25FBC X-Received: by 2002:a17:902:c412:b0:1c9:bca1:d70c with SMTP id k18-20020a170902c41200b001c9bca1d70cmr9671981plk.30.1698656839975; Mon, 30 Oct 2023 02:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698656839; cv=none; d=google.com; s=arc-20160816; b=XWDpZsdgMnQ1v4D9BJVKn1rvzWzjMn/QDHU23b+QzgXc3jtG3PQy3noZDl8yS3PYCh gebOeN9YnPT+VOolKgqHf3WS+LWt/4Nq5ck5ldbM6MVJUdqQ4ypBr63E2ca2C2Sk1Bgk 00JBt/kIOjfzvMe836xdJUI6FDxGcal20tmtBsp80G7t+Qiiuyout2dYIhJUQnB0xiDb C6g0exkVcBO9UV3y26uZTiAlDocXIsqpv8EfyKdYJhweryE+So3lJGptgoiAJ39/TJSV FRApxDWFkjGSgfQkfF7rvF4ABiEEWZlw9GqZ+bnT2upHFEHQUorCMI+KzAoiY4h3AaSK s+kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=y0atX0+sSSXblFLFWLmbV5ArNow5LoKvzRBMtZdLmQk=; fh=ZfhrTBYYt4DlsjERYpWO+3OQYJpvdBA4xBBOyLsMixk=; b=rw/3zU29qTTi1MfdINV5iBNgxMqvU8xwB2nM/TW2zOEhH6PG2DkTyUFl9JsGO/i7fm 0WCdNFB16geSHIiboepppniibR8wrRMimeWqFTy7hdMRHS386+naabg6Y3lGYJME9Ybm DfyYSX2oiB1jCpdsZYkce98bYqMbscMEZtmRgyFyFm8jotTmNe3bIc7L313I+uU0ngfy 0DuvEiqB62T6K3vs+xPgTgpjpOLLgs1Q1M6copoo88oWDk4W4w296+WjWKEYlovGGqhO ePA/g59jD09MlYPW2hFAmixpIYWW9eRzeT6/nSesQlBUL5GbLmmA6hYGKBaBWnTGVZFr l0Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I4wOCjCm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u10-20020a17090282ca00b001c737e1d3bfsi4850892plz.237.2023.10.30.02.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:07:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I4wOCjCm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D4A2680C1103; Mon, 30 Oct 2023 02:07:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbjJ3JHQ (ORCPT + 99 others); Mon, 30 Oct 2023 05:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjJ3JHP (ORCPT ); Mon, 30 Oct 2023 05:07:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43B0D9 for ; Mon, 30 Oct 2023 02:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698656791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y0atX0+sSSXblFLFWLmbV5ArNow5LoKvzRBMtZdLmQk=; b=I4wOCjCmbMZH2szWGr1jeYupckfCRQQEu0y8R86MsQYfBd72Q+RSsmdsZqRwZRlxKF1Hfx R1gVxtYFTjzpcs/iL3RO+zzomCiFjaB4Sbkw8WXWRNn5+sZuKMFOQJPwg26sQWT5fp4Uxk YDfaX+/moHrvcpMWLuvsJGwXm9XtRk4= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-NZ3O8u6IMfCxbJ1fsP9oNw-1; Mon, 30 Oct 2023 05:06:30 -0400 X-MC-Unique: NZ3O8u6IMfCxbJ1fsP9oNw-1 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-6c0362a50bbso2906263b3a.2 for ; Mon, 30 Oct 2023 02:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698656789; x=1699261589; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y0atX0+sSSXblFLFWLmbV5ArNow5LoKvzRBMtZdLmQk=; b=MtnUNkoY2AaWn4NotXPysBfyDDDqhQBc2BsuXKxXv+GInc1niHZjvpRMSaev7CD8to M9YKUzIBSzpGxw4H6jxMyuDxU5+7oWjld83zuRjzPQwfKOv/lfAXIKY3e+w6fx75G1a0 1c39bmdYI2oDwR51Nym0PdqV8DmN3ksSq3kjGDnFv4xfnPXNpYjoHY5eiIGB4Q2CgDOY is5gyvzj1C2ZsGuqdjBQ3mELYwYC8tENfFmvPxUzo3p1s9i0f/PgLXY9Hw+3mjprOi77 jzDTlXAT5szJnns49a18lv3ST+mnKb05II0q88uG6+JeTEH0oEltV6xVPqdj5SWfEXtA uCNg== X-Gm-Message-State: AOJu0Yz89rk2Id2hdVvHkAEICt40doEJxh3tC4vfvk31WWZQiv2nUidI WKzThETY4MA3Bo1K34b7JhVmuRwNLlY/7diIz/bXQJg8S4enz1SnPqCxYL7/yrCDCGRYoVEN5aR iT8fYkgriRxwuOKLcf0u4pUGLBFoySEpPcjDEQddJ X-Received: by 2002:a05:6a20:7d8a:b0:171:a8bc:74b2 with SMTP id v10-20020a056a207d8a00b00171a8bc74b2mr8574558pzj.7.1698656789547; Mon, 30 Oct 2023 02:06:29 -0700 (PDT) X-Received: by 2002:a05:6a20:7d8a:b0:171:a8bc:74b2 with SMTP id v10-20020a056a207d8a00b00171a8bc74b2mr8574537pzj.7.1698656789216; Mon, 30 Oct 2023 02:06:29 -0700 (PDT) MIME-Version: 1.0 References: <20231025140205.3586473-1-mszeredi@redhat.com> <20231025140205.3586473-3-mszeredi@redhat.com> In-Reply-To: From: Miklos Szeredi Date: Mon, 30 Oct 2023 10:06:18 +0100 Message-ID: Subject: Re: [PATCH v4 2/6] mounts: keep list of mounts in an rbtree To: Ian Kent Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , Matthew House , Florian Weimer , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 02:07:18 -0700 (PDT) On Mon, Oct 30, 2023 at 6:45=E2=80=AFAM Ian Kent wrote: > Is fs/namespace.c:iterate_mounts() a problem? > > It's called from: > > 1) ./kernel/audit_tree.c:709: if (iterate_mounts(compare_root, > 2) ./kernel/audit_tree.c:839: err =3D iterate_mounts(tag_mount, tree, = mnt); > 3) ./kernel/audit_tree.c:917: failed =3D iterate_mounts(tag_mount, > tree, tagged); > > > From functions 1) audit_trim_trees(), 2) audit_add_tree_rule() and > > 3) audit_tag_tree(). So that interface works like this: - collect_mounts() creates a temporary copy of a mount tree, mounts are chained on mnt_list. - iterate_mounts() is used to do some work on the temporary tree - drop_collected_mounts() frees the temporary tree These mounts are never installed in a namespace. My guess is that a private copy is used instead of the original mount tree to prevent races. Thanks, Miklos