Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp572079imm; Thu, 31 May 2018 05:51:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIAerCnO+2dwGrf6/vnWvV+Ldu/qkHPd4R0PHCu+LaL7udrdzyLcg8RRhbPrdEwaRp91wGl X-Received: by 2002:a63:7d51:: with SMTP id m17-v6mr5428167pgn.245.1527771094385; Thu, 31 May 2018 05:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527771094; cv=none; d=google.com; s=arc-20160816; b=aoIhyPnaPI60Ggbk/lRGO0tWjACU/8dAm+s7pNx1BEE3XFYXPKg+SPkFL4Yok9T8HM dbCs7YItmZO/Icl/Q74pqEFERzobTXQT1XWmg3qbLpjgxsAmFsXGJ8ef2cFZFOscHHn8 pyN7nl+CieZ8DKPevKPKONp1dkYSclMTKAL6QEIGCkyqAhaLicByJBEgkqScVAOcbmpN id++dEHmnPmVZMr+wgeUQ3BeoTNpSJD9ydEZHoWx6st/ZFZPCwOHmF9ODpW9RY4Z4EWo 951Wmv8XL38ecRP/lVcy5EYPOpCUXybCRZeJwUpMpZHB3D7oMEpj5VRINyLbiU0HpRCc Oqvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:ironport-phdr :arc-authentication-results; bh=bJpYAUb51/eLPtLfIW5BZFDqoV4OQBCzmhFpP+88Jyw=; b=U+JP53Iim047/NA8wCVI8CkrQOL124K11UwaCODNnH2OzNckvOktrOazhcTByH+rbE LzfDLKtVSrn06c6kZGsmY1P62Xa6P3xML3VMx9veP1AooP/FYBnnj4C8QpJ8djFSVTIP v5gDEf/msPoU3uvMoiRJN32jcOKfCsy4mwPq16MRbMwGI3+P/mg1yKoxsaEuu/1qWfc8 6/eUYOg0vx9hdE1moYnum9WX1CGZktJ+P5S3h7XZ/HDqA1nZ5aZb5E2JP8MsalEh1Kdb o4wnB8no3FnWgB3XSXl3am+VMQDx9DGObu2pLphHtrYRMmFdeH26BqPT8qj7FqikC1lj +JfQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5-v6si35614181pln.562.2018.05.31.05.51.19; Thu, 31 May 2018 05:51:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754981AbeEaMuz (ORCPT + 99 others); Thu, 31 May 2018 08:50:55 -0400 Received: from upbd19pa08.eemsg.mail.mil ([214.24.27.83]:47315 "EHLO upbd19pa08.eemsg.mail.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754733AbeEaMuw (ORCPT ); Thu, 31 May 2018 08:50:52 -0400 X-Greylist: delayed 600 seconds by postgrey-1.27 at vger.kernel.org; Thu, 31 May 2018 08:50:51 EDT Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.2]) by upbd19pa08.eemsg.mail.mil with ESMTP/TLS/AES256-SHA; 31 May 2018 12:40:49 +0000 X-IronPort-AV: E=Sophos;i="5.49,463,1520899200"; d="scan'208";a="12333147" IronPort-PHdr: =?us-ascii?q?9a23=3AxVU5vBXBgngMGZ8Ya0AKxaEEIC/V8LGtZVwlr6?= =?us-ascii?q?E/grcLSJyIuqrYZROEtKdThVPEFb/W9+hDw7KP9fy4BCpYud6oizMrSNR0TR?= =?us-ascii?q?gLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ?= =?us-ascii?q?/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9uLBi6txndutULioZ+N6g9zQ?= =?us-ascii?q?fErGFVcOpM32NoIlyTnxf45siu+ZNo7jpdtfE8+cNeSKv2Z6s3Q6BWAzQgKG?= =?us-ascii?q?A1+dbktQLfQguV53sTSXsZnxxVCAXY9h76X5Pxsizntuph3SSRIMP7QawoVT?= =?us-ascii?q?mk8qxmUwHjhjsZODEl8WHXks1wg7xdoBK9vBx03orYbJiIOPZiYq/ReNUXSm?= =?us-ascii?q?RbXsZVSidPHIWyYYUSBOYFJOpUsZXxq14IoBCjBwejGfnvxydViHHo06000+?= =?us-ascii?q?cvHw/I0wMvHd0BrHvaoc7pNKoRS+250LXEwDvBYv5QxDzz6JLIchckofyUQL?= =?us-ascii?q?xwbdTeyVEvFwzbiFWbtJHrPzaP2eQJt2iU8ephXv+ohm48tg5xuSOixtssi4?= =?us-ascii?q?bVhoIVzUrI9SNiwIkvP9G4R0l7YcC9HZZWqiqUNJN2T9s/T2xntys20L0LtY?= =?us-ascii?q?OhcCQUx5kr2QTTZ+GBfoOV+BzsTvyRLi19hH99fbK/gAu9/la4x+3nU8m0zE?= =?us-ascii?q?5Kri1YktnQrnwN1wLc6syASvZl4keuwyyP1wHO6uFfO0w0iaraJIIhwr43jJ?= =?us-ascii?q?YTt1jMHjTql0nsia+Wd0Ek9vCp6+ThfLrmuoeRO5J7hwzxKKgjmtGzDf4mPg?= =?us-ascii?q?UBQWSX4/mw2KXm/ULjQbVKivM2krPesJDfPckbvbO2AxRO34Y/6xewEzem0N?= =?us-ascii?q?MCkXkBN1JKYgiLj4fuO1HQOPz4F+uwg0ywkDd3wPDLJqXhDYvRLnfdirftZ6?= =?us-ascii?q?hy60hBxwUt19BQ/JVUCqsOIP/oQU/xs9rYDx8jPwOoxObnDc131pkCVmKXHq?= =?us-ascii?q?+ZLKTSvE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-ascii?q?VQdIMGEi+LJNetx84205zkXnNDslrlAlQcws6yUR2IZlf50Etb0kFB5TSLkC?= =?us-ascii?q?25wjg8sSwzoaeZx2Saz+3kdRcDOEZOSW1mhFHrMc6/iNVMGACEaBUm3D+o6U?= =?us-ascii?q?j93aQT8Kh7ImXdRl1EVzL7I2FrTu27sb/UJ4ZU5ZcptzhHePitalCdDLjmql?= =?us-ascii?q?0V1D2nV29fwi0rMiqnsYjjngBrzWeaIGt3oVLHdsxqgxTS/trRQbhWxDVCDC?= =?us-ascii?q?15jyTHQ1uxJd+k+f2KmJrZ9OOzTWSsUttUayavhcm7uTG06CVHSVv3v/m3ns?= =?us-ascii?q?zhW0BuyiLh2NRCVSzMqAf6JILs0vL+eahfd1RsTHK0rYJfEaJzlI09ldtYjW?= =?us-ascii?q?ATm5GQ9nkvlWb1LMUdx6TzcDwMTztNyNnQtlvLwkpme0mVypr5W3PV+c5oY9?= =?us-ascii?q?23cytCwS4mx9xbA6eTqrpflG16pUTu/lGZWuR0gjpIkahm03Udmexc/VN3li?= =?us-ascii?q?g=3D?= X-IPAS-Result: =?us-ascii?q?A2AMAwD/6w9b/wHyM5BcGgEBAQEBAgEBAQEIAQEBAYMZK?= =?us-ascii?q?2J/hB+UZkUBAQEBAQEGfwghgQ+TUIFkNgGEQAKCBCE4FAECAQEBAQEBAgFrK?= =?us-ascii?q?II1JAGCTwEFIw8BVgsYAgImAgJXBgEMCAEBgl5AAoFyDaZzghyDeAEBXoNsg?= =?us-ascii?q?WiBCoc1gQyBB4EPJAyCXYQ3gzyCVAKYaAmOWgaBPIZXhH8rhy6LFCGBUisIA?= =?us-ascii?q?hgIIQ+Cf4IfF41hAVEjgSoBAYxGKoIdAQE?= Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 31 May 2018 12:40:48 +0000 Received: from moss-pluto.infosec.tycho.ncsc.mil (moss-pluto.infosec.tycho.ncsc.mil [192.168.25.131]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w4VCefYD024585; Thu, 31 May 2018 08:40:41 -0400 Subject: Re: [PATCH V3 0/5] selinux:Significant reduce of preempt_disable holds To: peter enderborg , Paul Moore , Eric Paris , James Morris , Daniel Jurgens , Doug Ledford , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, "Serge E . Hallyn" , "Paul E . McKenney" References: <20180530141104.28569-1-peter.enderborg@sony.com> <8bbb095e-31c3-0062-d17c-662e4832cc17@tycho.nsa.gov> <1cf240b9-57ee-eee3-228f-5ad4a3a39e57@sony.com> From: Stephen Smalley Message-ID: <9332801c-6102-2486-ab60-b48bb38ae207@tycho.nsa.gov> Date: Thu, 31 May 2018 08:42:06 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1cf240b9-57ee-eee3-228f-5ad4a3a39e57@sony.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31/2018 05:04 AM, peter enderborg wrote: > On 05/30/2018 10:34 PM, Stephen Smalley wrote: >> On 05/30/2018 10:10 AM, Peter Enderborg wrote: >>> The boolean change becomes a lot more heavy with this patch, >>> but it is a very rare usage in compare with read only operations. >>> The lock held during a policydb_copy is about 1ms on a XEON. >> This has a very substantial performance impact on setsebool, e.g. time setsebool httpd_can_sendmail=1. >> That's because you are doing a full vmalloc();policydb_write();policydb_read();vfree() sequence on it. >> In comparison, KaiGai's old attempt to replace the policy rwlock with RCU only duplicated the conditional policydb state (via a cond_policydb_dup) that he introduced. Is there a reason you couldn't use that approach? > That one did not make it, so I went for a other path. Make it simple, using the same serialisation that exist. That also make it easier to maintain. > We do not  use the booleans in android since they are not allowed so im not aware of any use case where this administrative function are > used in such frequent manner that it would have an impact. And it must be some other large overhead with interprocess communication and > a multiple writes to sysfs during a boolean settings?  However my concern is/was memory pressure, setting booleans will generate pressure > with lot of atomic allocation and large vmallocs. Yes, that is also a concern. I would prefer to only duplicate the conditional policydb state as in KaiGai's patch. Keeping temporary setting of booleans lightweight is desirable for other use cases than Android. I'm also concerned by the implications of switching all of the allocations to atomic. KaiGai's patch did not take that approach either, and it obviously could make policy reload more prone to transient failures. But my goal is the fast path for real time critical functions such as audio, and it will be a cost for > administrative tasks. On the xeon it takes about ~98 ms to run the security_set_bools compared to about ~8 ms without the overhead > of copying the policydb.  About ~6 ms is rcu sync and ~8 ms is the same as the original update of selinux statuses, and about ~25 ms > is policydb_destroy() of the old copy. >>