Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3799844imm; Mon, 30 Jul 2018 03:50:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+CESEcxRNPuwjZvlngEdh4aZXiFAVbJFCf7KSwYqigqaFsPnW8cdIvY/pywIHP6cDyGvf X-Received: by 2002:a17:902:8f93:: with SMTP id z19-v6mr15665986plo.241.1532947820006; Mon, 30 Jul 2018 03:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532947819; cv=none; d=google.com; s=arc-20160816; b=UqUdEv+ROHbNouG4ORjS49ezjQmblDJKJQTOc2PIbB2n6leOPNiMCQacMlZ7buFJdD sTXeA/xIo8mcV90x0nhT9ISf0VhfKlw6TgVFSKfsN/706yVV8jWh4g4hE/jpW0coJP1E bfSEkpdPH3tshlwARXMQPhGVW2d4QT0xHq4uz40+1LY2lw6BCndjBm8jS3Syf5oDf6L3 HxF+9NkBEDTXkhzIQ3M3Aeg5pQnrpI9W4J4bMiwD99VbLBvLiELesM+48Ds8OQj+tln8 Bv3UqEjvEURv+dYXU5heqQ7HuxmulWKH+WnNCh60/TY0qITNHC5pI54+2f8w43HmqTm7 QcJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=gS2PezVygtE6RsodTqbeEXZiii2lVtaEIz+Uie4RUsE=; b=NGClnjxMrts7omwmuvEzaUGyYVch8mPsXk5WT7BheNoKTCyTQF7LA07ZWPlsMcYMeL yGY01Cy1xkatoE/griFfu4PinDDhnsNrsXKL9MTGUX5sSDWtlAClLCQydMmSnA+U3Mk0 YCf0iPfF0oxjXaJFYrcdZPyUkIx5acgt7XeO+GPefHO/h70Ht6ssQb08BXFjli7b81Rp 4ckcPEW13WAPl8JBaQZ4Ah8LqYnoaycb9QFjZotTO7h+PxaBSMxd/gOv2wlsn8xXtaed Tsc/D3CW9Q2AQP86xrj+MGKdev8dXJz6/mLq/DN0v3p3tfyM5ERtpXVbeO59q9ynw1YK TUQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 95-v6si9533820plc.466.2018.07.30.03.50.05; Mon, 30 Jul 2018 03:50:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726935AbeG3MXm (ORCPT + 99 others); Mon, 30 Jul 2018 08:23:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33384 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726562AbeG3MXm (ORCPT ); Mon, 30 Jul 2018 08:23:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 625597DAC6; Mon, 30 Jul 2018 10:49:18 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-116.rdu2.redhat.com [10.10.120.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EEB7112D17A; Mon, 30 Jul 2018 10:49:16 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> <153271277078.9458.16912166489973051987.stgit@warthog.procyon.org.uk> To: Tetsuo Handa Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, tomoyo-dev-en@lists.sourceforge.jp, linux-security-module@vger.kernel.org, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, miklos@szeredi.hu, kent.overstreet@gmail.com Subject: Re: [PATCH 13/38] tomoyo: Implement security hooks for the new mount API [ver #10] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10223.1532947756.1@warthog.procyon.org.uk> Date: Mon, 30 Jul 2018 11:49:16 +0100 Message-ID: <10224.1532947756@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 10:49:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 10:49:18 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tetsuo Handa wrote: > Would you provide examples of each possible combination as a C program? > For example, if one mount point from multiple sources with different > options are possible, please describe such pattern using syscall so that > LSM modules can run it to see whether they are working as expected. One example could be overlayfs. So you might do, say: ufd = open("/overlay", O_PATH); fsfd = fsopen("overlay", 0); fsconfig(fsfd, fsconfig_set_path, "lowerdir", "/src", AT_FDCWD); fsconfig(fsfd, fsconfig_set_path, "upperdir", "upper", ufd); fsconfig(fsfd, fsconfig_set_path, "workdir", "scratch", ufd); mfd = fsmount(fsfd, 0, 0); move_mount(fsfd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH); which would allow you to specify the "sources" using dirfds. Another possibility is could be ext4 with separate journal: fsfd = fsopen("ext4", 0); fsconfig(fsfd, fsconfig_set_path, "source", "/dev/sda1", AT_FDCWD); fsconfig(fsfd, fsconfig_set_path, "journal_path", "/dev/sda2", AT_FDCWD); mfd = fsmount(fsfd, 0, 0); move_mount(fsfd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH); And then there's bcachefs which suggests on the webpage: mount -t bcachefs /dev/sda1:/dev/sdb1 /mnt but you could then do: fsfd = fsopen("bcachefs", 0); fsconfig(fsfd, fsconfig_set_path, "source", "/dev/sda1", AT_FDCWD); fsconfig(fsfd, fsconfig_set_path, "source", "/dev/sdb2", AT_FDCWD); mfd = fsmount(fsfd, 0, 0); move_mount(fsfd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH); One thing I'm not certain of is whether I should allow multiple values to the same key name, or whether I should require that each key be labelled differently, possibly something like: fsconfig(fsfd, fsconfig_set_path, "source", "/dev/sda1", AT_FDCWD); fsconfig(fsfd, fsconfig_set_path, "source.1", "/dev/sdb2", AT_FDCWD); David