Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp787463ybz; Wed, 29 Apr 2020 09:22:17 -0700 (PDT) X-Google-Smtp-Source: APiQypJTaOxq5trzswB077G+BQKqIQCjv3Ik57VaiCqJZr0dZpUQvyQwP18jH3tVJRVFEgi4qCNw X-Received: by 2002:a50:a2e5:: with SMTP id 92mr3284755edm.139.1588177337125; Wed, 29 Apr 2020 09:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588177337; cv=none; d=google.com; s=arc-20160816; b=Bwb/WQOveQbthfJ4B1Eo9iA5+81rojmCq1u4McE/mFPU3cOjdkd+0G2yp8iNfwT6ir EBt1PaL2yjsk72AW3izHYkmGGxX0AeFFgdHwbZD13mPrDbTK9pHzjqXC8tsAjJ+ePuhB L1ImUwFdnJEp65W1RdVgiNEpJipUlkBl8gaS7u1dZJkkiP9IXpflY5QgEtRV3ewWHJ34 7kbiWtn16WphrU2i1a62Y9YrBaDR/Rs+5ojxU5iFbyxWw0xA5Exgg+3yVfFiQcfQEBvq WblSdSUT269KjGDAcijiWKf7GiICubWdS0Ui7wzs1lqPx7+JG4mqSCzL+R4uWxrhbNll LYZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=hC339AlYWIKjaIvmnsbzPnIvgC6f8npdAivdjP/WncE=; b=EAK+DHJ9iHqQFjrM0QwOUMgrch4fNE49iUk6eCVLTdmnEPeApwthPJ2Bu4aUXUx9R5 h7ghG2IaJLhMUWoeXNoyoensvAkLn9s0d+Lh4V07GMGQAiaDXsA/5aRusDD4dEiy/qHt rZQFwgCjNG3mUXMnY1PJcWybwpLpbqWssa7EqjQuVrPqsDpBEZ4yq2wF2DdQ1vq3PzpX 4g0YC5C5Uq81iGoRHUn1b31m7yObRMreReGQVaDefyohDwKGuqU1EyuPtW2VkRe0kQtT MspOynn5S2I+4ffFcld/TJKQ4gOetqKPNfdx/fUz0EI3vu4PQ1YrKqNa9cLkJThKktjS MaDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=duJ1CAR3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si3705982edr.14.2020.04.29.09.21.43; Wed, 29 Apr 2020 09:22:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=duJ1CAR3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726794AbgD2QRz (ORCPT + 99 others); Wed, 29 Apr 2020 12:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726774AbgD2QRw (ORCPT ); Wed, 29 Apr 2020 12:17:52 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A34BC03C1AD for ; Wed, 29 Apr 2020 09:17:52 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id g12so2669056wmh.3 for ; Wed, 29 Apr 2020 09:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hC339AlYWIKjaIvmnsbzPnIvgC6f8npdAivdjP/WncE=; b=duJ1CAR3oC0XJTSkov4YIS7U0gdKnijRTK0zU7OF120jvwnIAqXrOiZukp76t7gqEg +sws3pAd0Fp715kcqIQUZ6ILybSDYsmpYBhd+d742FyzXAnETdeW6IOhAPErL4HwCrgM 462kB+7nxNLniPCRDs6WRnbW6aa9rbAFfqsEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hC339AlYWIKjaIvmnsbzPnIvgC6f8npdAivdjP/WncE=; b=JFO95gnf/dD5HyG864NtdVYY/hJt+rL8kcFsh1hJqamixNQha7M4ijTP1SyVznKz3i ikoPmpnbGh5eT9vxG6k+3mpYel5z9uYNBKou2ApFbojfYlOB7fWi3uXf4CTSBsvRkIfM Od2efd2U5Vx+kx6+n7z9awkC4CGFp+tWEUI5YycNQgR6EhVLnzm7pwC09X9YOmH6hd9p uPrLWvmY9wjUiAUkrVQndh+55ZukPwJYTQ0Cd01WRF2nfT+OOyUV3p+QL1VbpCgEKsYa JT7/ErYB3noSvq0nDDy+M0Zd81BSRe6aqANnybi8CPy8mTIVOp0qNRj//7o0fGgSLYQL w43w== X-Gm-Message-State: AGi0PuaofmrBO1Pb4aZafS0indtsPdLA+BZwR5hwbfwnsThAb3QEg68b AkW/G6vTj4S8DpsZxDL53NyfiA== X-Received: by 2002:a1c:3dd6:: with SMTP id k205mr4139049wma.138.1588177071094; Wed, 29 Apr 2020 09:17:51 -0700 (PDT) Received: from google.com ([81.6.44.51]) by smtp.gmail.com with ESMTPSA id d143sm8275651wmd.16.2020.04.29.09.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 09:17:50 -0700 (PDT) From: KP Singh X-Google-Original-From: KP Singh Date: Wed, 29 Apr 2020 18:17:47 +0200 To: Mikko Ylinen Cc: KP Singh , open list , bpf , Linux Security Module list , Alexei Starovoitov , Daniel Borkmann , James Morris , Kees Cook , Paul Turner , Jann Horn , Florent Revest , Brendan Jackman , Greg Kroah-Hartman Subject: Re: [PATCH bpf-next v9 0/8] MAC and Audit policy using eBPF (KRSI) Message-ID: <20200429161747.GA113900@google.com> References: <20200329004356.27286-1-kpsingh@chromium.org> <0165887d-e9d0-c03e-18b9-72e74a0cbd59@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So I was able to reproduce the issue and also fix it (will separately send a patch). diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h index 9cd4455528e5..1bdd027766d4 100644 --- a/include/linux/lsm_hook_defs.h +++ b/include/linux/lsm_hook_defs.h @@ -55,7 +55,7 @@ LSM_HOOK(void, LSM_RET_VOID, bprm_committing_creds, struct linux_binprm *bprm) LSM_HOOK(void, LSM_RET_VOID, bprm_committed_creds, struct linux_binprm *bprm) LSM_HOOK(int, 0, fs_context_dup, struct fs_context *fc, struct fs_context *src_sc) -LSM_HOOK(int, 0, fs_context_parse_param, struct fs_context *fc, +LSM_HOOK(int, -ENOPARAM, fs_context_parse_param, struct fs_context *fc, struct fs_parameter *param) LSM_HOOK(int, 0, sb_alloc_security, struct super_block *sb) LSM_HOOK(void, LSM_RET_VOID, sb_free_security, struct super_block *sb) So what was happening was that: bpf_lsm hook for fs_context_parse_param was returning 0 which led this bit of logic to believe the parameter was parsed by the LSM. int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param) { [...] ret = security_fs_context_parse_param(fc, param); if (ret != -ENOPARAM) /* Param belongs to the LSM or is disallowed by the * LSM; so * don't pass to the FS. */ return ret; if (fc->ops->parse_param) { ret = fc->ops->parse_param(fc, param); if (ret != -ENOPARAM) return ret; } [...] This resulted in the fs_context->dev_name being NULL and the following chain to throw an -EINVAL resulting in unsuccessful mount of the root file-system: - do_mount_root -> do_mount -> do_new_mount -> vfs_get_tree -> -> fc->ops->get_tree -> legacy->get_tree -> fc->fs_type->mount -> ext4_mount -> mount_bdev -> blkdev_get_by_path -> lookup_bdev - KP On 29-Apr 15:45, Mikko Ylinen wrote: > > > On 29/04/2020 15:34, KP Singh wrote: > > Thanks for reporting this! Can you share your Kconfig please? > > This is what I originally started with > https://raw.githubusercontent.com/clearlinux-pkgs/linux-mainline/master/config > > but I also tried your _LSM_ settings found in this > https://lore.kernel.org/bpf/20200402040357.GA217889@google.com/ > > -- Regards, Mikko