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=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 58D24C4361B for ; Tue, 8 Dec 2020 10:37:47 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEBED221F7 for ; Tue, 8 Dec 2020 10:37:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEBED221F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gmx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1kmaMr-0002bu-EN; Tue, 08 Dec 2020 05:37:13 -0500 Received: from mout.gmx.net ([212.227.15.15]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kmaMQ-0002TR-B7 for kernelnewbies@kernelnewbies.org; Tue, 08 Dec 2020 05:36:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607423803; bh=exSHuRfQAqQSxSMLpJg2+idGEcSZo//06YEPv6HiCDs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=NWRiuHCJC06fXPC9ZXLznsAMXS5N9Lo0eDdZyvs1fGeLL1c6jmtRkY8I7QmKShG/u ig6wYE9eyN/qz58fIpRyFR/qUJRd5uTn1jpdzlo78J50UujQWpKRxKuqdLrqnzVmpD AKcBgyVWdyZlIQayylXNrua7T46HEkErBN7mXnUQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.231.213]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MIdiZ-1kyQBT3sxh-00Ecbn; Tue, 08 Dec 2020 11:36:43 +0100 From: John Wood To: kernelnewbies@kernelnewbies.org Subject: [RFC PATCH 0/2] Locking protection for the stats pointer Date: Tue, 8 Dec 2020 11:35:55 +0100 Message-Id: <20201208103557.6471-1-john.wood@gmx.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:HyeyFAZKUq2Qzb8ohwMWkLjP1lOgcIFlkSpB2AdKgpCalT0taDs bGKLARwVYm7Ref7CZgI5ZyRZqMMto9YEGNu09jyZbGE9iNjcLqKwW695lmbHg12gx/wgNwX 93kjb1JdjhqBA3qVJBbTM7aHA2Hj6sanIWQAa/uebDuW3oSb69M1GUEEUFIKylFT3DTzcpd uOee5vavc3gbB/PNd8stQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:BEAr85zo4U8=:CXLQ77LIQS6/rLpn7+xh0y +d5/V6n10msOsAunfKC/R+Vzt40LWmoxXrezv5haq1iol5aH4UkOIlZNuXDhROOdnhudjMQGJ fd4vLGO2HaSsJvy0dr5ULfxuTT0gbnm3OD+C1KHe+V2SVml+cEVB6jI6LFjzDQPxqZ/EZ5NA3 /wbCsQzDaisBgL7Xfvczs5NFMd4U2GXr4BsxnMSc50DqsEeGwJi2HK/Pt8k7ToxxTOWpRsxB0 4eBrUbJtnz4Yz3IgYd7LdBVqmwZuU42ayh+Oa+hdl5V9foHCfvh2l9HszP2O50HTttGVjibwC TwFq2PhlbFLB+dka5IGh8Kb8AClWmKrTaOgKB3RnxGQgu2om85O1bd/5sjyU8PcgADGz71QBY jy3kqHOUVc3aRWPV3OVJOWbDddgWVwXZeYAzlNqgEdLl6NNrnyLEBeTNXWhb1oAaK5MV8QHaZ x4S2FqVzvpw5nwosJaxoG0cjyJNPevTaK9MYjrv2aGZaTytIhgiSnrrKhF1by4GucSb0Xt+oD vi4N9PHYeBkKjBxuWNPhkC2TBh3kkBR63hpzYLqp58rtP3G0IymP6bhTpXx7tDHbMOyT2G969 4Q+MYnqGbTci2x6+mlgyf7F8WtYW47aWZITxvCQAMgpd6jTuibAdfrv3DM/CrFqKw5WR+4OsX ZMF1QujFJWJyyeCsAr0yki/IfejGVhReTZZPhRa5AHy5hwP1AE2TEXft9S0an3ejQ6sVygSol JlMI9AKbLH5hApDecAAjtjf6/6ARZef6jMUBb/+Xr2okWJyzZ+9m7LhhCIDawWtO1ud37iOsr cePT/v4d9d1yj1CD5Of0qL8PiUfJgPK8dolVgT4jlHQt+4cf/qszBWCXKjSW47/ZI4gB+jqhX 0rlScpHCunI4zqg7yPFA== Cc: John Wood , keescook@chromium.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hi, I'm working in the v3 version of the "fork brute force attack mitigation" feature (KSPP task). I'm a kernel developer newbie and I think that now a locking paranoid :) My post in this mailing list is to get feedback about my locking system. I'm very afraid about locking. I think that the protection of the stats structure's internal data about concurrency is correct. But the protection of a shared pointer among processes is not clear to me. I divided this post in two patches. The first shows the "brute" LSM code with the explanation of the main idea behind. The second patch shows what I think is the correct method to protect the stats pointer shared among processes. The code in every patch not represent the changes that will be done in the version presented to review. I split this changes in this manner to make easier to comment and clarify my doubts. Also, this RFC tell about a task_fatal_signal hook that are not shown. I think that narrow the code will be better, so this part is not sent. All my questions are presented in the second patch. I would like to know your comments and opinions. This way I will be able to choose the correct path about locking avoiding basic errors. The questions are related to locking not the functionality of the "brute" LSM. But any constructive comments are always welcome. The previous versions can be found in: RFC https://lore.kernel.org/kernel-hardening/20200910202107.3799376-1-keescook@chromium.org/ v2 https://lore.kernel.org/kernel-hardening/20201025134540.3770-1-john.wood@gmx.com/ Thanks in advance. John Wood (2): security/brute: Brute LSM security/brute.c: Protect the stats pointer security/brute/brute.c | 381 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 381 insertions(+) create mode 100644 security/brute/brute.c -- 2.25.1 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies