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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED7ABCE7B10 for ; Thu, 28 Sep 2023 10:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbjI1KHf (ORCPT ); Thu, 28 Sep 2023 06:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbjI1KHe (ORCPT ); Thu, 28 Sep 2023 06:07:34 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F3AF198 for ; Thu, 28 Sep 2023 03:07:30 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5363227cc80so411833a12.3 for ; Thu, 28 Sep 2023 03:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1695895648; x=1696500448; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DtI3kB3DRHPB9DqqP0XY+HAtUyMDubLkneuHlzD3860=; b=gYiPrQmN1jhYL+x8C0LEoXUdQcqshHo58gF2gKveAmY9rYqXs3JSyK6HSznIH6b1i8 iRV/Or2UlbUuiqfPM4vmn3DQyXSjSbZTph6iyrIYNSHjMThz1dVLZzjbULl05eZl8fp3 crc2xqIaMfNBcq1E1iWQx3ucLokdBXwTU7fJ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695895648; x=1696500448; h=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=DtI3kB3DRHPB9DqqP0XY+HAtUyMDubLkneuHlzD3860=; b=hVQTQ+miEiCnZ/pVhi/yMT3GlaOLECE/qmU/6eL6uJAARgKTAAUxxVeKBijQBeDv8w XPYsTvP0GctLM4UZb3WUInki80EZ8P8mnVojD3GaqqxAVFJf/JORytiQ47QOIE3rWPVT AU0OaeAM/PqexFFwGYb11d09sLGvfIk45uHCbGWvUiFidsVBI4QMzDSJwXbZzFMFTCAL 3zvvdSKLR40XGOgO0jYMM93oW3EU1mVhodFWtpmxmZai8JPw4zOuMyv9Mee48MHA+xSI dRik3yEfLde/IA6fKsYwWHwGbMBC9ckCsyqap29xMwASj05w11Cp697Dv/4kWuScOGpg 3jPA== X-Gm-Message-State: AOJu0YyN1spVlfFWprXJGsC/MBS9rZG4W01JYhjN8Rv2XHAdtnpHhnhT 8y6IxCugdbcKurzidtqF0gHSs1SbfWLUjVWnKyhRkQ== X-Google-Smtp-Source: AGHT+IEDypM3eCKriTL3toxyQv8Q1keb6DT2jEmjFo0FJ1MxFnDwMp3fk9njVXSZqz8oyH0A9Xgaw9Xxa1l5dOcoVH0= X-Received: by 2002:a17:907:7609:b0:9a5:cf23:de5b with SMTP id jx9-20020a170907760900b009a5cf23de5bmr846668ejc.38.1695895648586; Thu, 28 Sep 2023 03:07:28 -0700 (PDT) MIME-Version: 1.0 References: <20230913152238.905247-1-mszeredi@redhat.com> <20230913152238.905247-4-mszeredi@redhat.com> <20230917005419.397938-1-mattlloydhouse@gmail.com> <20230918-einblick-klaut-0a010e0abc70@brauner> In-Reply-To: From: Miklos Szeredi Date: Thu, 28 Sep 2023 12:07:17 +0200 Message-ID: Subject: Re: [RFC PATCH 3/3] add listmnt(2) syscall To: Paul Moore Cc: Christian Brauner , Miklos Szeredi , Matthew House , 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 , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Tue, 19 Sept 2023 at 18:48, Paul Moore wrote: > > Ideally we avoid multiple capable(CAP_SYS_ADMIN) calls by only doing it > > once and saving the return value. capable() call's aren't that cheap. > > Agreed. The capability check doesn't do any subject/object > comparisons so calling it for each mount is overkill. However, I > would think we would want the LSM hook called from inside the loop as > that could involve a subject (@current) and object (individual mount > point) comparison. The security_sb_statfs() one? Should a single failure result in a complete failure? Why is it not enough to check permission on the parent? Thanks, Miklos