Message ID | ZC8Dbux56HbJjpTy@char.us.oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1201947vqo; Thu, 6 Apr 2023 10:52:02 -0700 (PDT) X-Google-Smtp-Source: AKy350Z5b+CCNP6WwcOIniD73GVKwt9ZWc/e75kPmAq4M0ByEX8vtR4IaSpa1Qibhn35XemEqur4 X-Received: by 2002:a17:902:d506:b0:1a2:749:5f1a with SMTP id b6-20020a170902d50600b001a207495f1amr7957026plg.26.1680803521989; Thu, 06 Apr 2023 10:52:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680803521; cv=pass; d=google.com; s=arc-20160816; b=rjhOjJE+U3aXPqynbWuIqkEYYfwluj9YELhKrQqAMptYJIo9U5jI2siJIxk9TE+iKe zUICf1cjo737+q7C65Jncn/JJfRlOLxvkoHuXP4NqeJYnIizrqEGQ9NlwzTxx1yfkaAW Dg4CfU55zRc65/bQHPHS5akBcxwSwX1SxSAyvAiS3AKztHvymMHylYRd1ruJrYn00VkP Q0zzOd71kQ+hZu6wHkiTeTsB5Do0+bdXt/rdoRgamAEgDMnCKJ07M8qcj4qgPXjo9MFv 119catHVMgDQNZHoUWlPO0XwrbmayXMuryDRm0rdcf7FFvRreh5cO+dvvrC5rzTIbGWg eQ3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-disposition:message-id:subject:to:from:date:dkim-signature :dkim-signature; bh=k49EoDHJovtRM5MPKhxMeaVtnBGGH8CDi7giycPX3us=; b=kEBCQJGhoRU6jkMumK0E/vsgX1ZEij7oipOIMPNyEOuExN2X+0PKQZvXR/CsXkWER1 dqn2IKijnW90ouP9K0w8v3SHw2SefyXfEN+GtJRoDvCIIFkJMUIjmivEgBK+PGkzGITe nPvB0lVO13WAucn/UbTXc9SYH//4DNr5Ubc+y4nIkOB/6GZDBWUyf1NFCjExQK/FSSfc UHCbIaBr12kkyAiLkmOFbgtq/ZQHfSlGv6wJlkGYG/GKe+pKuz5v0OATFNwUVzmeN8g3 cpuREG7uZXWEraTdq0SpV2cY9+z2KFa8UMiCD+cjOzOr5mXyeTsVznpJRQD99/y/FNbQ MthA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="cv0y1/qY"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Hrxrd8t+; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170903230100b001a235350e69si2401194plh.104.2023.04.06.10.51.48; Thu, 06 Apr 2023 10:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="cv0y1/qY"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Hrxrd8t+; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239418AbjDFRi1 (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Thu, 6 Apr 2023 13:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238972AbjDFRiY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Apr 2023 13:38:24 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B66FD4C21; Thu, 6 Apr 2023 10:38:22 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 336EhKS1015317; Thu, 6 Apr 2023 17:38:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : subject : message-id : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=k49EoDHJovtRM5MPKhxMeaVtnBGGH8CDi7giycPX3us=; b=cv0y1/qY7GbTqh0IeJhkmg1nIne+KirnWCyR+d47AZeDhasI0/ihHpr09DbivEOWIn2v EImYeElRqhJ9/WIfMsGkN+E77B95XjXuVJArHbWopF4TYk/bOhC9mQyoJ8yup8V2SjBy Fx3JjNCuI7ZFghVc3jor8N7RwYikPfAXu1sma36fd1xEulc3hCmBtZjBTCPfL6p5YXug Im3eeaQNOeMfUAokLuq863jGh4FxefiPJNm5rwAltEPnqPTH6oS5qsAWGkbw/JlQK86V qKAsvZEjHh4LVMmAjpmDI7/XlrSH1zbBOTVC2lclO6/sIthcjFpstXNVTww+y19gtcIP cA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppc7u3ees-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 17:38:10 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 336GrVRx034243; Thu, 6 Apr 2023 17:38:09 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pptjvm6kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 17:38:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sf0DwGbmHaPoJzueJQt1sIipJV8GIaS/kkJXtJh/2iA+eY/tDgFDJLmoDPtNOpFDWxFxHyqiU8kGAbz5pAqR46hrzixZ1XDz4piKOMDsbVNIDpD/J+mGc06kQ7j7zE3YDC9hOhIos6EnxMln3txTRuKqBO1w7BECzdYiAIAgxAbBY+fInL4PoKE4/Li+/L8NOJ03P8n5BvNhBkWKVzLRHWkyLjrHnCekqpo6tuFWfVl/bbKsqMZCJyhTRCZmyL3wYyWub+3yJuxZ6msYZ/brpexA0TlaTSaio7UrI6UHZHTur52ClTuOyrO0q7V3i2oFL29eG9HQOQDGng0ma03OMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k49EoDHJovtRM5MPKhxMeaVtnBGGH8CDi7giycPX3us=; b=Yia8HPLuliyUKrg/D2V7PiBSf2+pXGuW0NPu4DaphfjyHX+OMeGkb8/LwtNFftPA7gqsh89LvsYRK0SRsZhtK9y73SNTVr3iILhzcxz9t/b/qr/tmeNY2UHT082ClxM1Etg7IFJhbLbJOMbmE+IgJwABdjETfIf7W89f6nSGCAH0SxTAeurrGVvqwR2Y+sKPqqAS8zHenuW2zSKTvDC2DcND38Jh0nzANU5xU+zQwhblQ2FYhYuoxx6Mr7g896aBjy8/08TzrO8w9UTqumjJtojFMJCzZRwfe7WRexc6WHzof+OANHeVgKeV1Bi0c1Qt/lLkno5JzXkiGnMSSD3lHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k49EoDHJovtRM5MPKhxMeaVtnBGGH8CDi7giycPX3us=; b=Hrxrd8t+0r9691psE0DtxM+ZmksV7NGTy//rVHj/UeQbFh2tYiWeYz9FTjrKsxu1y7wup8rfKPjYNjukWXg5FeUqsDVPZm8+iVVMx9iYY4U1Plnszez9M6EnG2cIyW+yqUEtJtcrlNPzCpFmDkVmZ86DN2A5BrSMxAb9lyfcDh8= Received: from BYAPR10MB2999.namprd10.prod.outlook.com (2603:10b6:a03:85::27) by CH3PR10MB6882.namprd10.prod.outlook.com (2603:10b6:610:14e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Thu, 6 Apr 2023 17:38:07 +0000 Received: from BYAPR10MB2999.namprd10.prod.outlook.com ([fe80::d8d2:ddf3:e236:99ef]) by BYAPR10MB2999.namprd10.prod.outlook.com ([fe80::d8d2:ddf3:e236:99ef%4]) with mapi id 15.20.6277.031; Thu, 6 Apr 2023 17:38:06 +0000 Date: Thu, 6 Apr 2023 13:37:50 -0400 From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> To: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, nathanl@linux.ibm.com, junxiao.bi@oracle.com, joe.jin@oracle.com, Eric <eric.snowberg@oracle.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, axboe@kernel.dk Subject: Semantics of blktrace with lockdown (integrity) enabled kernel. Message-ID: <ZC8Dbux56HbJjpTy@char.us.oracle.com> Content-Type: multipart/mixed; boundary="5iavvndJv1wOMM1M" Content-Disposition: inline Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MN2PR11CA0026.namprd11.prod.outlook.com (2603:10b6:208:23b::31) To BYAPR10MB2999.namprd10.prod.outlook.com (2603:10b6:a03:85::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB2999:EE_|CH3PR10MB6882:EE_ X-MS-Office365-Filtering-Correlation-Id: e7ee6596-19cf-40be-88ab-08db36c5ae44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vIyKtOq1aQkV5hoZSvkkD29W+unbsrFxlRYObshURBb2NCyuCG36OENWx1sfiRtilruCmJNaraC+BJQwYqCvSoJcGP6b+Ld6bGI8WeblC9zbLQLHau+veT52msZWW3RIcAb2jJ1hets/PyG88E7ryblJJXG4h7WluZf5QMq1g20SLIHBCQhC8cEOcvcHy9kyJ898+sjBQhMk8WYJik15J1Xgy65xQvHLc8aAFos+yXNReQux42L+Rr7dhvYRIiAz1nFXqtnVpb0OYHPuqrBsGxXlnVKsDf3G06DWw/qdO8c0g3xYoGigbcKuJEwJ1b51NvIa001hiZQ6eBaz/SrDdVkYrisNz6L+421N5skPP9/9y3LVJo1P0l5X1chWwXeHJ7AjxwvwOPPOmdV75i9Dl40ZrT/zU6OSCTkzVGPRI0sczYnXkHlpcQPQ9ez2Im64iEwVgfuyZAQgJ94C+mLVxnUCDaYrcujVCYbIoVKUsQtRim6RwofisXljY0qi7s3VcU0gGFqSoEk6QdyenVgV8m3wI5rpnW5gmSB7Rs4a16GEp8CdU6bgGdEwt3DbJ0MHidw0el3h77KgNmOx5reyMrCuYSc6wX6F+U1sb2UrdlOeK9fY4r2IPTC2YLvL4RtIAPTzWCSz26vEu3vyqmP8dA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB2999.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(396003)(376002)(346002)(366004)(136003)(39860400002)(451199021)(38100700002)(6512007)(26005)(6506007)(33964004)(44144004)(8936002)(186003)(478600001)(110136005)(316002)(86362001)(66946007)(8676002)(66476007)(6486002)(6666004)(66556008)(2906002)(41300700001)(921005)(83380400001)(235185007)(5660300002)(2700100001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Wljn5CQZo56iInhJLesahHC/zLd3?= =?utf-8?q?SW6GxAjWLwGs/gMWQMTBbPHKDkHXnOwf1RfJ7a/8D4XkiyfZFyjf/e73MRvHXSb0m?= =?utf-8?q?KH3/nwD335FxbJo+2FvzFDcYr0eB2Obm3esQEZlZMNGAdAA1hHYgi7JaI1wnYuBm2?= =?utf-8?q?o3ILBtlQa1OknoB450YdT7/K2Dj+lxWsH0q2A9v7aBU5s0zvUSsr23X+U/dKM6d1S?= =?utf-8?q?R9zBcnN+lxtMLueQOogCQsDqFOlkBXbrjefoyZHqOU/O9aPxNoWn39a1RnUoWbkno?= =?utf-8?q?dxboHnt9zRvbrIYTQ1/O3fjwzr6E40pCHMV0nt0y0ULeYspzCQTbXQymmuWyGMY0D?= =?utf-8?q?pKvWlGoTDEvkIbVK4uBdJKM90tLkiG9pI6utUyg0TK0IgWZgnGRJ5xk0dDNH1En4t?= =?utf-8?q?HBFi24QWLc1+CU3CMzyAhh2hbhgNZPEcbsPdsgVyoZwjTaCmfpj3ZjLtu1fat+oeC?= =?utf-8?q?EPrcS+ebenpDQBTjmPsPz+rFdHpqiBT/RPm9DYQcBMTy+Iwbe/G8w87ZKjcQMuIQW?= =?utf-8?q?OgSHpN1RKKjpcKIAk9fHBLZavXS8VLmW5T6bNwPEg/F3JSBgUPefMiDK861vvoQWu?= =?utf-8?q?H5YWXFTJFpuAaIuScFs68cubrEHjjR5+0GIMxOC8XjsubacJA0V791tZiqQbN+A82?= =?utf-8?q?hsenH5PtrgRdlJ5q08AmQteswvmSU6Y8EcEx+hRVpJ1X5rGSeYm3NkTYRnej7my/M?= =?utf-8?q?llyNXZ+ckG2cOIF8cjusLz06TUUZaspc71GcFcWertEEB5ey7Xb1AJocXqVNPTB42?= =?utf-8?q?s0bExvVCEY5RCKCVlfB8q3QSjVqphMgTZwzEv0Kns91kcXi3ZGUBIyeVAefDMREO6?= =?utf-8?q?tRzMJAOlPERotdlv+ouwn2V/cZTf2b2n4w0nW07yJXEgxbIQnoNsF1eNmTmRV1HbI?= =?utf-8?q?MqsWc21PECcPKR0NSIiscGJ5XBbzPT7EQ3jm/ms5Y8xNMnqYCuwzALx+H4DdFHP9f?= =?utf-8?q?UiOd1qWyAp3eSV29FxkraY7iOoXQDxXrGT2sjUu9Ekp8EE3pAk0b42cqZzwl5Z3MS?= =?utf-8?q?mw3sPKDrXVeEB3PjLA1E/khQJQSB6FIeklK8MkXsPhn4PQcmNg0P7jupoXL9lMbLV?= =?utf-8?q?TG5Kdk8fIVIqsxuGOKF9yrn4d5AcGz/74yNG5IcLoYoMDZ+PKmK2Nr68NYMSsKFaM?= =?utf-8?q?xo9NYqu4nBKPPLnpHumru1wVfgc4peRkBai8N0DySrTnUbjtKShsI+PaD3R00HjLs?= =?utf-8?q?FG+vWTBEOgzHHN7EOCw96/yfvMpML9H7Adn+UnfcmnFjOge6LEyx2n9G0U9EmNz9/?= =?utf-8?q?rvxVe6EjuPNyUr1I+YKUKVMgU2pV3nouVgxtLygHWy7GbU5HhU6Ttz+p9xY1pUQ7E?= =?utf-8?q?i6QyY0SE/5Ozwv4IjiBNk46dQ2NpLDwR/cpJCp75RFa2XXrzjQceJc1TAmRjrNb++?= =?utf-8?q?G+hzPicNfjHENcLK8OwMdUs0UvFxNBASzy8IN9Y2AUx4xdN/vk6HS7RGYDlVrDTEn?= =?utf-8?q?xn8C/DwtzwofudQwRqjBKVBdxPenUYWhbJiIdYD11JdLLFfRsVOLiFZ7FikpA3T1F?= =?utf-8?q?qs9+JL3fPVgVMQH4QgjQaZ0y9hFwJrqZoQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xRx43EviDMqyJKu/9PEPTWyp8GUKF3/xLy3GvNVRuyEsop1wV3ILDKb57VSGB/umQDgHXRlwywT/QxRNPZ8MN3/pinXEZIL+74bnQwA+wWXG3lpakszNR1HHMf1FkgwayzHst4BvsFOgNTQL/jJ+zdep57myOIGmLll+1DMriIK1Pkf6os1ocsG2xs36mHsdbekGUZPTJW797hCGQ0o68KylaGjz481dlXuTK4yFn17AGDNHDGtHvDA1nX9IYqf/jDop3eIQg76hgyxD6/Uqxw4hQ2AEcJ8RM75gAaiDOn9ZlrlSJP+kh9RHga6VlzTZsPYjKAfJ12Aar2ffE1sqb94sKy8HzVHaoLG7OudoD8k1I3XCAaW8axyWXXRd5fjO1Jia0bNAlh9566KxvuDfaW6xWmvs8LDeQQOBxDqxXJ/SZqSAqHdNuxAcR8O9oznZm+WfgUNdZam9khMG+S62DGQ4twdgEebbH8YDcT0zH0i8i1RmizRhg4MAkpjFzh9KBFZfmUoX+zSXPJWwUNyA/lYmu2hJNTPNb0vPa0brp9aOPgVRC1wRTFH5nrcedIXlIDa6trKNZN/uEqEzyyNOe3hne6DbdLvCrnbXQlzW5py1YOpBpFkgnkjziLRsw08qP+vSK2K4lbROGyxJfVl5+sNFrcRN77DMBfmWLegPmvbStgqXaG1UMSNTt97cqiKsjkqguI+dNV7dUuQx4+LCPUiKX9IfiHIVUiWyUiAPPIbb4K9wDR18N02HXWJl3+Fu/GB4U8ogr3FNoJkGeLXcO2brzrdwIrO9Le6mdK9DMcFofrwRVQoInlQEtAhhMYFRqIhTnc8ImnDWn3EN6YtAXGjouKtRspje0HKLk+rQvuw+qsqAKy99p3aGxywpExqz13G9vJfFga2LOegXfJPEO0V6D3EtnuVmV3RuQb3QIu8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7ee6596-19cf-40be-88ab-08db36c5ae44 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2999.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2023 17:38:06.7904 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QCM+15/My87+to+npI3mSmUMm7iRw/NYNFNTY+XqmFs8D83GHMpB05c4D5Eeeoa9CXhCGXUICeNUYLiJHZjUJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB6882 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-06_10,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060155 X-Proofpoint-ORIG-GUID: 1TP6tYX6Uh9FgLgZvYpYkBSuk35_xxGf X-Proofpoint-GUID: 1TP6tYX6Uh9FgLgZvYpYkBSuk35_xxGf X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762450233750854062?= X-GMAIL-MSGID: =?utf-8?q?1762450233750854062?= |
Series |
Semantics of blktrace with lockdown (integrity) enabled kernel.
|
|
Commit Message
Konrad Rzeszutek Wilk
April 6, 2023, 5:37 p.m. UTC
Hey Jens, Paul, James, Nathan, We are trying to use blktrace with a kernel that has lockdown enabled and find that it cannot run. Specifically the issue is that we are trying to do is pretty simple: strace -f blktrace -d /dev/sda -w 60 [pid 148882] <... mprotect resumed>) = 0 [pid 148881] openat(AT_FDCWD, "/sys/kernel/debug/block/sda/trace0", O_RDONLY|O_NONBLOCK <unfinished ...> [pid 148882] sched_setaffinity(0, 8, [1]) = 0 [pid 148881] <... openat resumed>) = -1 EPERM (Operation not permitted) which fails. The analysis from Eric (CCed) is that All debugfs entries do not exist until blktrace is run. It is opening /sys/kernel/debug/block/sda/trace0 which isn’t there normally. While running the utility, to place something in it, it must have the write permission set. When exiting out of blktrace, the entry is gone, both on a machine running with secure boot enabled and one with it disabled. Which also indicates the write permission was set, otherwise the entry would still be there. The fix is simple enough (see attachment) but we are not sure about the semantics of what lockdown has in mind. Looking at the include/linux/security.h the LOCKDOWN_TRACEFS exists which would imply that it is expected that operations with tracefs *should* work with lockdown (integrity mode). But at the same point, debugfs writable attributes are a nono with lockdown. So what is the right way forward? Thank you. From 20bd7b8c91463191924ec69833bbd6e6a6231f52 Mon Sep 17 00:00:00 2001 From: Junxiao Bi <junxiao.bi@oracle.com> Date: Tue, 4 Apr 2023 19:13:21 -0700 Subject: [PATCH] debugfs: whitelisted relay file for lockdown Relay files in debugfs are used for sending data from kernel to userspace, the permission of these files are 0444, looks safe to skip lockdown. Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> --- fs/debugfs/file.c | 17 +++++++++++++++++ fs/debugfs/internal.h | 5 +++++ 2 files changed, 22 insertions(+)
Comments
On Thu, Apr 6, 2023 at 1:38 PM Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote: > > Hey Jens, Paul, James, Nathan, > > We are trying to use blktrace with a kernel that has lockdown enabled and find that it cannot run. > > Specifically the issue is that we are trying to do is pretty simple: > > strace -f blktrace -d /dev/sda -w 60 > > [pid 148882] <... mprotect resumed>) = 0 > [pid 148881] openat(AT_FDCWD, "/sys/kernel/debug/block/sda/trace0", O_RDONLY|O_NONBLOCK <unfinished ...> > [pid 148882] sched_setaffinity(0, 8, [1]) = 0 > [pid 148881] <... openat resumed>) = -1 EPERM (Operation not permitted) > > which fails. The analysis from Eric (CCed) is that > > All debugfs entries do not exist until blktrace is run. It is opening > /sys/kernel/debug/block/sda/trace0 which isn’t there normally. While running the utility, > to place something in it, it must have the write permission set. When exiting out of > blktrace, the entry is gone, both on a machine running with secure boot enabled > and one with it disabled. Which also indicates the write permission was set, > otherwise the entry would still be there. > > The fix is simple enough (see attachment) but we are not sure about the semantics of what > lockdown has in mind. > > Looking at the include/linux/security.h the LOCKDOWN_TRACEFS exists which would > imply that it is expected that operations with tracefs *should* work with lockdown (integrity mode). > > But at the same point, debugfs writable attributes are a nono with lockdown. > > So what is the right way forward? What did you use as a basis for your changes? I'm looking at the patch you sent and it appears to be making a change to a debugfs_lockdown_whitelisted() function defined in fs/debugfs/internal.h which does not exist in Linus' tree. If I search through all of the archives on lore.kernel.org the only hit I get is your email, so it seems doubtful it is in a subsystem tree which hasn't made its way to Linus yet. Before we go any further, can you please verify that your issue is reproducible on a supported, upstream tree (preferably Linus')?
On 4/6/23 11:39 AM, Paul Moore wrote: > On Thu, Apr 6, 2023 at 1:38 PM Konrad Rzeszutek Wilk > <konrad.wilk@oracle.com> wrote: >> Hey Jens, Paul, James, Nathan, >> >> We are trying to use blktrace with a kernel that has lockdown enabled and find that it cannot run. >> >> Specifically the issue is that we are trying to do is pretty simple: >> >> strace -f blktrace -d /dev/sda -w 60 >> >> [pid 148882] <... mprotect resumed>) = 0 >> [pid 148881] openat(AT_FDCWD, "/sys/kernel/debug/block/sda/trace0", O_RDONLY|O_NONBLOCK <unfinished ...> >> [pid 148882] sched_setaffinity(0, 8, [1]) = 0 >> [pid 148881] <... openat resumed>) = -1 EPERM (Operation not permitted) >> >> which fails. The analysis from Eric (CCed) is that >> >> All debugfs entries do not exist until blktrace is run. It is opening >> /sys/kernel/debug/block/sda/trace0 which isn’t there normally. While running the utility, >> to place something in it, it must have the write permission set. When exiting out of >> blktrace, the entry is gone, both on a machine running with secure boot enabled >> and one with it disabled. Which also indicates the write permission was set, >> otherwise the entry would still be there. >> >> The fix is simple enough (see attachment) but we are not sure about the semantics of what >> lockdown has in mind. >> >> Looking at the include/linux/security.h the LOCKDOWN_TRACEFS exists which would >> imply that it is expected that operations with tracefs *should* work with lockdown (integrity mode). >> >> But at the same point, debugfs writable attributes are a nono with lockdown. >> >> So what is the right way forward? > What did you use as a basis for your changes? I'm looking at the > patch you sent and it appears to be making a change to a > debugfs_lockdown_whitelisted() function defined in > fs/debugfs/internal.h which does not exist in Linus' tree. If I > search through all of the archives on lore.kernel.org the only hit I > get is your email, so it seems doubtful it is in a subsystem tree > which hasn't made its way to Linus yet. > > Before we go any further, can you please verify that your issue is > reproducible on a supported, upstream tree (preferably Linus')? The patch attached is applied to oracle kernel which is just used to demo the idea of a possible fix. Upstream will have the same issue because blktrace uses relay files from debugfs to transfer trace information from kernel to userspace. Those relay files are having permission 0400 which are good, but they support mmap (struct file_operations relay_file_operations), which are against the rule of lock down. Is there any security concern to whitelist these files in lockdown mode? Any idea how to fix this for upstream? static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { if ((inode->i_mode & 07777 & ~0444) == 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && !real_fops->mmap) return 0; if (security_locked_down(LOCKDOWN_DEBUGFS)) return -EPERM; return 0; } Thanks, Junxiao. >
On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: > On Thu, Apr 6, 2023 at 1:38 PM Konrad Rzeszutek Wilk > <konrad.wilk@oracle.com> wrote: > > > > Hey Jens, Paul, James, Nathan, > > > > We are trying to use blktrace with a kernel that has lockdown enabled and find that it cannot run. > > > > Specifically the issue is that we are trying to do is pretty simple: > > > > strace -f blktrace -d /dev/sda -w 60 > > > > [pid 148882] <... mprotect resumed>) = 0 > > [pid 148881] openat(AT_FDCWD, "/sys/kernel/debug/block/sda/trace0", O_RDONLY|O_NONBLOCK <unfinished ...> > > [pid 148882] sched_setaffinity(0, 8, [1]) = 0 > > [pid 148881] <... openat resumed>) = -1 EPERM (Operation not permitted) > > > > which fails. The analysis from Eric (CCed) is that > > > > All debugfs entries do not exist until blktrace is run. It is opening > > /sys/kernel/debug/block/sda/trace0 which isn’t there normally. While running the utility, > > to place something in it, it must have the write permission set. When exiting out of > > blktrace, the entry is gone, both on a machine running with secure boot enabled > > and one with it disabled. Which also indicates the write permission was set, > > otherwise the entry would still be there. > > > > The fix is simple enough (see attachment) but we are not sure about the semantics of what > > lockdown has in mind. > > > > Looking at the include/linux/security.h the LOCKDOWN_TRACEFS exists which would > > imply that it is expected that operations with tracefs *should* work with lockdown (integrity mode). > > > > But at the same point, debugfs writable attributes are a nono with lockdown. > > > > So what is the right way forward? > > What did you use as a basis for your changes? I'm looking at the > patch you sent and it appears to be making a change to a > debugfs_lockdown_whitelisted() function defined in > fs/debugfs/internal.h which does not exist in Linus' tree. If I > search through all of the archives on lore.kernel.org the only hit I > get is your email, so it seems doubtful it is in a subsystem tree > which hasn't made its way to Linus yet. My apologies. We had to add some extra code for flipping IBRS on/off at some point and that is why see this 'whitelisted' one. A more upstream appropiate patch not be based on this. > > Before we go any further, can you please verify that your issue is > reproducible on a supported, upstream tree (preferably Linus')? Yes. Very much so. Thank you.
On Thu, Apr 6, 2023 at 3:30 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > On 4/6/23 11:39 AM, Paul Moore wrote: > > On Thu, Apr 6, 2023 at 1:38 PM Konrad Rzeszutek Wilk > > <konrad.wilk@oracle.com> wrote: > >> Hey Jens, Paul, James, Nathan, > >> > >> We are trying to use blktrace with a kernel that has lockdown enabled and find that it cannot run. > >> > >> Specifically the issue is that we are trying to do is pretty simple: > >> > >> strace -f blktrace -d /dev/sda -w 60 > >> > >> [pid 148882] <... mprotect resumed>) = 0 > >> [pid 148881] openat(AT_FDCWD, "/sys/kernel/debug/block/sda/trace0", O_RDONLY|O_NONBLOCK <unfinished ...> > >> [pid 148882] sched_setaffinity(0, 8, [1]) = 0 > >> [pid 148881] <... openat resumed>) = -1 EPERM (Operation not permitted) > >> > >> which fails. The analysis from Eric (CCed) is that > >> > >> All debugfs entries do not exist until blktrace is run. It is opening > >> /sys/kernel/debug/block/sda/trace0 which isn’t there normally. While running the utility, > >> to place something in it, it must have the write permission set. When exiting out of > >> blktrace, the entry is gone, both on a machine running with secure boot enabled > >> and one with it disabled. Which also indicates the write permission was set, > >> otherwise the entry would still be there. > >> > >> The fix is simple enough (see attachment) but we are not sure about the semantics of what > >> lockdown has in mind. > >> > >> Looking at the include/linux/security.h the LOCKDOWN_TRACEFS exists which would > >> imply that it is expected that operations with tracefs *should* work with lockdown (integrity mode). > >> > >> But at the same point, debugfs writable attributes are a nono with lockdown. > >> > >> So what is the right way forward? > > What did you use as a basis for your changes? I'm looking at the > > patch you sent and it appears to be making a change to a > > debugfs_lockdown_whitelisted() function defined in > > fs/debugfs/internal.h which does not exist in Linus' tree. If I > > search through all of the archives on lore.kernel.org the only hit I > > get is your email, so it seems doubtful it is in a subsystem tree > > which hasn't made its way to Linus yet. > > > > Before we go any further, can you please verify that your issue is > > reproducible on a supported, upstream tree (preferably Linus')? > > The patch attached is applied to oracle kernel which is just used to > demo the idea of a possible fix. > > Upstream will have the same issue because blktrace uses relay files from > debugfs to transfer trace information from kernel to userspace ... For future reference, the problem with sending patches that aren't based on an upstream tree is that it both wastes reviewer time trying to figure out where the basis of the patch, and it makes one question if the issue is present in an upstream kernel or if there is some out-of-tree patch in the unknown kernel which is the root cause. Maybe you've tested everything and know it is a problem with the upstream code, but when we see a patch that doesn't match up with anything, how are we supposed to know?
On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote: > On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: ... > > Before we go any further, can you please verify that your issue is > > reproducible on a supported, upstream tree (preferably Linus')? > > Yes. Very much so. Okay, in that case I suspect the issue is due to the somewhat limited granularity in the lockdown LSM. While there are a number of different lockdown "levels", the reality is that the admin has to choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without digging to deep into the code path that you would be hitting, we can see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option that would allow DEBUGFS is NONE. Without knowing too much about blktrace beyond the manpage, it looks like it has the ability to trace/snoop on the block device operations so I don't think this is something we would want to allow in a "locked" system. Sorry.
On 4/6/23 2:43 PM, Paul Moore wrote: > On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk > <konrad.wilk@oracle.com> wrote: >> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: > ... > >>> Before we go any further, can you please verify that your issue is >>> reproducible on a supported, upstream tree (preferably Linus')? >> Yes. Very much so. > Okay, in that case I suspect the issue is due to the somewhat limited > granularity in the lockdown LSM. While there are a number of > different lockdown "levels", the reality is that the admin has to > choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without > digging to deep into the code path that you would be hitting, we can > see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore > INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY > setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option > that would allow DEBUGFS is NONE. > > Without knowing too much about blktrace beyond the manpage, it looks > like it has the ability to trace/snoop on the block device operations > so I don't think this is something we would want to allow in a > "locked" system. blktrace depends on tracepoint in block layer to trace io events of block devices, through the test with mainline, those tracepoints were not blocked by lockdown. If snoop block devices operations is a security concern in lock down, these tracepoints should be disabled? [root@jubi-ol8 tracecmd]# uname -a Linux jubi-ol8 6.3.0-rc6.master.20230410.ol8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Apr 10 03:33:56 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux [root@jubi-ol8 tracecmd]# cat /sys/kernel/security/lockdown none [integrity] confidentiality [root@jubi-ol8 tracecmd]# trace-cmd record -e block:block_rq_issue -e block:block_rq_complete Hit Ctrl^C to stop recording ^CCPU0 data recorded at offset=0x9fa000 4096 bytes in size CPU1 data recorded at offset=0x9fb000 4096 bytes in size CPU2 data recorded at offset=0x9fc000 53248 bytes in size CPU3 data recorded at offset=0xa09000 12288 bytes in size Thanks, Junxiao. > > Sorry. >
On Mon, Apr 10, 2023 at 3:20 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > On 4/6/23 2:43 PM, Paul Moore wrote: > > On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk > > <konrad.wilk@oracle.com> wrote: > >> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: > > ... > > > >>> Before we go any further, can you please verify that your issue is > >>> reproducible on a supported, upstream tree (preferably Linus')? > >> Yes. Very much so. > > Okay, in that case I suspect the issue is due to the somewhat limited > > granularity in the lockdown LSM. While there are a number of > > different lockdown "levels", the reality is that the admin has to > > choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without > > digging to deep into the code path that you would be hitting, we can > > see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore > > INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY > > setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option > > that would allow DEBUGFS is NONE. > > > > Without knowing too much about blktrace beyond the manpage, it looks > > like it has the ability to trace/snoop on the block device operations > > so I don't think this is something we would want to allow in a > > "locked" system. > > blktrace depends on tracepoint in block layer to trace io events of > block devices, > > through the test with mainline, those tracepoints were not blocked by > lockdown. > > If snoop block devices operations is a security concern in lock down, these > > tracepoints should be disabled? Possibly, however, as I said earlier I'm not very familiar with blktrace and the associated tracepoints. If it is possible to snoop on kernel/user data using blktrace then it probably should be protected by a lockdown control point. Is this something you could verify and potentially submit a patch to resolve?
On 4/10/23 1:22 PM, Paul Moore wrote: > On Mon, Apr 10, 2023 at 3:20 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: >> On 4/6/23 2:43 PM, Paul Moore wrote: >>> On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk >>> <konrad.wilk@oracle.com> wrote: >>>> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: >>> ... >>> >>>>> Before we go any further, can you please verify that your issue is >>>>> reproducible on a supported, upstream tree (preferably Linus')? >>>> Yes. Very much so. >>> Okay, in that case I suspect the issue is due to the somewhat limited >>> granularity in the lockdown LSM. While there are a number of >>> different lockdown "levels", the reality is that the admin has to >>> choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without >>> digging to deep into the code path that you would be hitting, we can >>> see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore >>> INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY >>> setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option >>> that would allow DEBUGFS is NONE. >>> >>> Without knowing too much about blktrace beyond the manpage, it looks >>> like it has the ability to trace/snoop on the block device operations >>> so I don't think this is something we would want to allow in a >>> "locked" system. >> blktrace depends on tracepoint in block layer to trace io events of >> block devices, >> >> through the test with mainline, those tracepoints were not blocked by >> lockdown. >> >> If snoop block devices operations is a security concern in lock down, these >> >> tracepoints should be disabled? > Possibly, however, as I said earlier I'm not very familiar with > blktrace and the associated tracepoints. If it is possible to snoop > on kernel/user data using blktrace then it probably should be > protected by a lockdown control point. > > Is this something you could verify and potentially submit a patch to resolve? blktrace can not snoop kernel/user data. The information it got from kernel is kind of "io metadata", basically include which process from which cpu, at what time, triggered what kind of IO events(issue, queue, complete etc.), to which disk, from which sector offset and how long. blktrace has no way to know what's inside that io. I am kind of think this is safe for lockdown mode. The following is sample of blktrace output. 252,0 1 1 0.000000000 2570 Q W 45779288 + 48 [nstat] 252,0 1 1 0.000000000 2570 Q W 45779288 + 48 [nstat] 252,0 1 1 0.000000000 2570 Q W 45779288 + 48 [nstat] 252,0 1 1 0.000000000 2570 Q W 45779288 + 48 [nstat] 252,0 3 1 0.001038626 2572 C W 45779288 + 48 [0] 252,0 3 1 0.001038626 2572 C W 45779288 + 48 [0] 252,0 3 1 0.001038626 2572 C W 45779288 + 48 [0] 252,0 3 1 0.001038626 2572 C W 45779288 + 48 [0] 252,0 1 2 1.764157693 1384 Q WS 24577112 + 8 [auditd] 252,0 1 2 1.764157693 1384 Q WS 24577112 + 8 [auditd] 252,0 1 2 1.764157693 1384 Q WS 24577112 + 8 [auditd] 252,0 1 2 1.764157693 1384 Q WS 24577112 + 8 [auditd] 252,0 1 3 1.764216845 1384 Q WS 24577120 + 16 [auditd] 252,0 1 3 1.764216845 1384 Q WS 24577120 + 16 [auditd] 252,0 1 3 1.764216845 1384 Q WS 24577120 + 16 [auditd] 252,0 1 3 1.764216845 1384 Q WS 24577120 + 16 [auditd] Thanks, Junxiao. >
On Mon, Apr 10, 2023 at 5:28 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > On 4/10/23 1:22 PM, Paul Moore wrote: > > On Mon, Apr 10, 2023 at 3:20 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > >> On 4/6/23 2:43 PM, Paul Moore wrote: > >>> On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk > >>> <konrad.wilk@oracle.com> wrote: > >>>> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: > >>> ... > >>> > >>>>> Before we go any further, can you please verify that your issue is > >>>>> reproducible on a supported, upstream tree (preferably Linus')? > >>>> Yes. Very much so. > >>> Okay, in that case I suspect the issue is due to the somewhat limited > >>> granularity in the lockdown LSM. While there are a number of > >>> different lockdown "levels", the reality is that the admin has to > >>> choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without > >>> digging to deep into the code path that you would be hitting, we can > >>> see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore > >>> INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY > >>> setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option > >>> that would allow DEBUGFS is NONE. > >>> > >>> Without knowing too much about blktrace beyond the manpage, it looks > >>> like it has the ability to trace/snoop on the block device operations > >>> so I don't think this is something we would want to allow in a > >>> "locked" system. > >> blktrace depends on tracepoint in block layer to trace io events of > >> block devices, > >> > >> through the test with mainline, those tracepoints were not blocked by > >> lockdown. > >> > >> If snoop block devices operations is a security concern in lock down, these > >> > >> tracepoints should be disabled? > > Possibly, however, as I said earlier I'm not very familiar with > > blktrace and the associated tracepoints. If it is possible to snoop > > on kernel/user data using blktrace then it probably should be > > protected by a lockdown control point. > > > > Is this something you could verify and potentially submit a patch to resolve? > > blktrace can not snoop kernel/user data. The information it got from > kernel is kind of "io metadata", basically include which process from > which cpu, at what time, triggered what kind of IO events(issue, queue, > complete etc.), to which disk, from which sector offset and how long. > blktrace has no way to know what's inside that io. I am kind of think > this is safe for lockdown mode. Well, you could always submit a patch* and we would review it like any other; that's usually a much better approach. * Yes, there was a patch submitted, but it was against a distro kernel that diverged significantly from the upstream kernel in the relevant areas.
On 4/10/23 2:44 PM, Paul Moore wrote: > On Mon, Apr 10, 2023 at 5:28 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: >> On 4/10/23 1:22 PM, Paul Moore wrote: >>> On Mon, Apr 10, 2023 at 3:20 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: >>>> On 4/6/23 2:43 PM, Paul Moore wrote: >>>>> On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk >>>>> <konrad.wilk@oracle.com> wrote: >>>>>> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: >>>>> ... >>>>> >>>>>>> Before we go any further, can you please verify that your issue is >>>>>>> reproducible on a supported, upstream tree (preferably Linus')? >>>>>> Yes. Very much so. >>>>> Okay, in that case I suspect the issue is due to the somewhat limited >>>>> granularity in the lockdown LSM. While there are a number of >>>>> different lockdown "levels", the reality is that the admin has to >>>>> choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without >>>>> digging to deep into the code path that you would be hitting, we can >>>>> see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore >>>>> INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY >>>>> setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option >>>>> that would allow DEBUGFS is NONE. >>>>> >>>>> Without knowing too much about blktrace beyond the manpage, it looks >>>>> like it has the ability to trace/snoop on the block device operations >>>>> so I don't think this is something we would want to allow in a >>>>> "locked" system. >>>> blktrace depends on tracepoint in block layer to trace io events of >>>> block devices, >>>> >>>> through the test with mainline, those tracepoints were not blocked by >>>> lockdown. >>>> >>>> If snoop block devices operations is a security concern in lock down, these >>>> >>>> tracepoints should be disabled? >>> Possibly, however, as I said earlier I'm not very familiar with >>> blktrace and the associated tracepoints. If it is possible to snoop >>> on kernel/user data using blktrace then it probably should be >>> protected by a lockdown control point. >>> >>> Is this something you could verify and potentially submit a patch to resolve? >> blktrace can not snoop kernel/user data. The information it got from >> kernel is kind of "io metadata", basically include which process from >> which cpu, at what time, triggered what kind of IO events(issue, queue, >> complete etc.), to which disk, from which sector offset and how long. >> blktrace has no way to know what's inside that io. I am kind of think >> this is safe for lockdown mode. > Well, you could always submit a patch* and we would review it like any > other; that's usually a much better approach. > > * Yes, there was a patch submitted, but it was against a distro kernel > that diverged significantly from the upstream kernel in the relevant > areas. Sure, i will submit a new one. Before that, may i ask this question? It may affect the approach of the patch. Lockdown blocked files with mmap operation even that files are read-only, may i know what's the security concern there? static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { if ((inode->i_mode & 07777 & ~0444) == 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl && !real_fops->mmap) return 0; if (security_locked_down(LOCKDOWN_DEBUGFS)) return -EPERM; return 0; } Thanks, Junxiao. >
On Mon, Apr 10, 2023 at 5:52 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > On 4/10/23 2:44 PM, Paul Moore wrote: > > On Mon, Apr 10, 2023 at 5:28 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > >> On 4/10/23 1:22 PM, Paul Moore wrote: > >>> On Mon, Apr 10, 2023 at 3:20 PM Junxiao Bi <junxiao.bi@oracle.com> wrote: > >>>> On 4/6/23 2:43 PM, Paul Moore wrote: > >>>>> On Thu, Apr 6, 2023 at 3:33 PM Konrad Rzeszutek Wilk > >>>>> <konrad.wilk@oracle.com> wrote: > >>>>>> On Thu, Apr 06, 2023 at 02:39:57PM -0400, Paul Moore wrote: > >>>>> ... > >>>>> > >>>>>>> Before we go any further, can you please verify that your issue is > >>>>>>> reproducible on a supported, upstream tree (preferably Linus')? > >>>>>> Yes. Very much so. > >>>>> Okay, in that case I suspect the issue is due to the somewhat limited > >>>>> granularity in the lockdown LSM. While there are a number of > >>>>> different lockdown "levels", the reality is that the admin has to > >>>>> choose from either NONE, INTEGRITY, or CONFIDENTIALITY. Without > >>>>> digging to deep into the code path that you would be hitting, we can > >>>>> see that TRACEFS is blocked by the CONFIDENTIALITY (and therefore > >>>>> INTEGRITY too) setting and DEBUGFS is blocked by the INTEGRITY > >>>>> setting. With DEBUGFS blocked by INTEGRITY, the only lockdown option > >>>>> that would allow DEBUGFS is NONE. > >>>>> > >>>>> Without knowing too much about blktrace beyond the manpage, it looks > >>>>> like it has the ability to trace/snoop on the block device operations > >>>>> so I don't think this is something we would want to allow in a > >>>>> "locked" system. > >>>> blktrace depends on tracepoint in block layer to trace io events of > >>>> block devices, > >>>> > >>>> through the test with mainline, those tracepoints were not blocked by > >>>> lockdown. > >>>> > >>>> If snoop block devices operations is a security concern in lock down, these > >>>> > >>>> tracepoints should be disabled? > >>> Possibly, however, as I said earlier I'm not very familiar with > >>> blktrace and the associated tracepoints. If it is possible to snoop > >>> on kernel/user data using blktrace then it probably should be > >>> protected by a lockdown control point. > >>> > >>> Is this something you could verify and potentially submit a patch to resolve? > >> blktrace can not snoop kernel/user data. The information it got from > >> kernel is kind of "io metadata", basically include which process from > >> which cpu, at what time, triggered what kind of IO events(issue, queue, > >> complete etc.), to which disk, from which sector offset and how long. > >> blktrace has no way to know what's inside that io. I am kind of think > >> this is safe for lockdown mode. > > Well, you could always submit a patch* and we would review it like any > > other; that's usually a much better approach. > > > > * Yes, there was a patch submitted, but it was against a distro kernel > > that diverged significantly from the upstream kernel in the relevant > > areas. > > Sure, i will submit a new one. > > Before that, may i ask this question? It may affect the approach of the > patch. > > Lockdown blocked files with mmap operation even that files are > read-only, may i know what's the security concern there? > > static int debugfs_locked_down(struct inode *inode, > struct file *filp, > const struct file_operations *real_fops) > { > if ((inode->i_mode & 07777 & ~0444) == 0 && > !(filp->f_mode & FMODE_WRITE) && > !real_fops->unlocked_ioctl && > !real_fops->compat_ioctl && > !real_fops->mmap) > return 0; > > if (security_locked_down(LOCKDOWN_DEBUGFS)) > return -EPERM; > > return 0; > } I think the comment block at the top of that function describes it well: /* * Only permit access to world-readable files when the kernel is locked down. * We also need to exclude any file that has ways to write or alter it as root * can bypass the permissions check. */ -- paul-moore.com
On 4/10/23 3:00 PM, Paul Moore wrote: >>> Well, you could always submit a patch* and we would review it like any >>> other; that's usually a much better approach. >>> >>> * Yes, there was a patch submitted, but it was against a distro kernel >>> that diverged significantly from the upstream kernel in the relevant >>> areas. >> Sure, i will submit a new one. >> >> Before that, may i ask this question? It may affect the approach of the >> patch. >> >> Lockdown blocked files with mmap operation even that files are >> read-only, may i know what's the security concern there? >> >> static int debugfs_locked_down(struct inode *inode, >> struct file *filp, >> const struct file_operations *real_fops) >> { >> if ((inode->i_mode & 07777 & ~0444) == 0 && >> !(filp->f_mode & FMODE_WRITE) && >> !real_fops->unlocked_ioctl && >> !real_fops->compat_ioctl && >> !real_fops->mmap) >> return 0; >> >> if (security_locked_down(LOCKDOWN_DEBUGFS)) >> return -EPERM; >> >> return 0; >> } > I think the comment block at the top of that function describes it well: > > /* > * Only permit access to world-readable files when the kernel is locked down. > * We also need to exclude any file that has ways to write or alter it as root > * can bypass the permissions check. > */ I may have some misunderstanding of commit 5496197f9b08("debugfs: Restrict debugfs when the kernel is locked down"), it mentioned chmod is disabled for debugfs file, so i thought permission of debugfs file can not be changed. Actually I just tested that, the permission can be changed! I am not sure whether this is an issue or not. Anyway i understand the security concern with mmap, thanks a lot. Thanks, Junxiao. > > -- > paul-moore.com
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index d574bda24e21..93ab719d8c7b 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -20,6 +20,7 @@ #include <linux/device.h> #include <linux/poll.h> #include <linux/security.h> +#include <linux/relay.h> #include "internal.h" @@ -137,6 +138,22 @@ void debugfs_file_put(struct dentry *dentry) } EXPORT_SYMBOL_GPL(debugfs_file_put); +bool debugfs_file_is_relay(struct dentry *dentry) +{ + struct debugfs_fsdata *fsd; + void *d_fsd; + void *fops; + + d_fsd = READ_ONCE(dentry->d_fsdata); + if (!((unsigned long)d_fsd & DEBUGFS_FSDATA_IS_REAL_FOPS_BIT)) { + fsd = d_fsd; + fops = (void *)fsd->real_fops; + } else + fops = (void *)((unsigned long)d_fsd & + ~DEBUGFS_FSDATA_IS_REAL_FOPS_BIT); + return fops == (void *)&relay_file_operations; +} + /* * Only permit access to world-readable files when the kernel is locked down. * We also need to exclude any file that has ways to write or alter it as root diff --git a/fs/debugfs/internal.h b/fs/debugfs/internal.h index 6bcedb3f90b3..392bb1972226 100644 --- a/fs/debugfs/internal.h +++ b/fs/debugfs/internal.h @@ -37,6 +37,7 @@ static const char * const arch_whitelist[] = { "mds_user_clear" }; +extern bool debugfs_file_is_relay(struct dentry *dentry); struct dentry *__attribute__((weak))get_arch_debugfs_dir(void) {return NULL; } static bool debugfs_lockdown_whitelisted(struct dentry *dentry) @@ -51,6 +52,10 @@ static bool debugfs_lockdown_whitelisted(struct dentry *dentry) } } + /* relay file is used for userspace/kernel communicate.*/ + if (debugfs_file_is_relay(dentry)) + return true; + return false; }