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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01DAC433E3 for ; Mon, 8 Jun 2020 23:58:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 894E12078D for ; Mon, 8 Jun 2020 23:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731442AbgFHXXH (ORCPT ); Mon, 8 Jun 2020 19:23:07 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:58937 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731430AbgFHXXF (ORCPT ); Mon, 8 Jun 2020 19:23:05 -0400 Received: from fsav301.sakura.ne.jp (fsav301.sakura.ne.jp [153.120.85.132]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 058NMDxO028517; Tue, 9 Jun 2020 08:22:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav301.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav301.sakura.ne.jp); Tue, 09 Jun 2020 08:22:13 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav301.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 058NMD61028513 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Jun 2020 08:22:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [RFC][PATCH] net/bpfilter: Remove this broken and apparently unmantained To: Alexei Starovoitov Cc: Linus Torvalds , "Eric W. Biederman" , Kees Cook , Andrew Morton , Alexei Starovoitov , David Miller , Al Viro , bpf , linux-fsdevel , Daniel Borkmann , Jakub Kicinski , Masahiro Yamada , Gary Lin , Bruno Meneguele References: <20200329005528.xeKtdz2A0%akpm@linux-foundation.org> <13fb3ab7-9ab1-b25f-52f2-40a6ca5655e1@i-love.sakura.ne.jp> <202006051903.C44988B@keescook> <875zc4c86z.fsf_-_@x220.int.ebiederm.org> <20200606201956.rvfanoqkevjcptfl@ast-mbp> <20200607014935.vhd3scr4qmawq7no@ast-mbp> <33cf7a57-0afa-9bb9-f831-61cca6c19eba@i-love.sakura.ne.jp> <20200608162306.iu35p4xoa2kcp3bu@ast-mbp.dhcp.thefacebook.com> From: Tetsuo Handa Message-ID: Date: Tue, 9 Jun 2020 08:22:13 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200608162306.iu35p4xoa2kcp3bu@ast-mbp.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 2020/06/09 1:23, Alexei Starovoitov wrote: > On Sun, Jun 07, 2020 at 11:31:05AM +0900, Tetsuo Handa wrote: >> On 2020/06/07 10:49, Alexei Starovoitov wrote: >>> So you're right that for most folks user space is the >>> answer. But there are cases where kernel has to have these things before >>> systemd starts. >> >> Why such cases can't use init= kernel command line argument? >> The program specified via init= kernel command line argument can do anything >> before systemd (a.k.a. global init process) starts. >> >> By the way, from the LSM perspective, doing a lot of things before global init >> process starts is not desirable, for access decision can be made only after policy >> is loaded (which is generally when /sbin/init on a device specified via root= >> kernel command line argument becomes ready). Since >> fork_usermode_blob((void *) "#!/bin/true\n", 12, info) is possible, I worry that >> the ability to start userspace code is abused for bypassing dentry/inode-based >> permission checks. > > bpf_lsm is that thing that needs to load and start acting early. > It's somewhat chicken and egg. fork_usermode_blob() will start a process > that will load and apply security policy to all further forks and execs. fork_usermode_blob() would start a process in userspace, but early in the boot stage means that things in the kernel might not be ready to serve for userspace processes (e.g. we can't open a shared library before a filesystem containing that file becomes ready, we can't mount a filesystem before mount point becomes ready, we can't access mount point before a device that contains that directory becomes ready). TOMOYO LSM module uses call_usermodehelper() from tomoyo_load_policy() in order to load and apply security policy. What is so nice with fork_usermode_blob() compared to existing call_usermodehelper(), at the cost of confusing LSM modules by allowing file-less execve() request from fork_usermode_blob() ?