From patchwork Wed Dec 19 21:33:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Stoppa X-Patchwork-Id: 10738167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98CC76C5 for ; Wed, 19 Dec 2018 21:34:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 864FF286B2 for ; Wed, 19 Dec 2018 21:34:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A6E9286B4; Wed, 19 Dec 2018 21:34:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66CD7286B2 for ; Wed, 19 Dec 2018 21:34:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4562A8E001C; Wed, 19 Dec 2018 16:34:18 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 404DC8E0001; Wed, 19 Dec 2018 16:34:18 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A6ED8E001C; Wed, 19 Dec 2018 16:34:18 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by kanga.kvack.org (Postfix) with ESMTP id AC6278E0001 for ; Wed, 19 Dec 2018 16:34:17 -0500 (EST) Received: by mail-lj1-f199.google.com with SMTP id g12-v6so5964165lji.3 for ; Wed, 19 Dec 2018 13:34:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:reply-to:mime-version :content-transfer-encoding; bh=xeUBKKu9pM2Fl/EWnsAPb2mBNLFsikzJ4KNY/hC/k1s=; b=quWJBUhGqChDTvBUzcE0IcVG7oWeoLi3o3SDFJ6DxCr77qGQ43KyRiBD+HaBCjAcYN V7bArZ87HfaklYBxtLxCZmO3xxGUgf3maDEGXaZQqktlg7HMNjDM7YTqyIw8dVFJE6bI H23Dv7vtbUxl4rfg383Rvk/dD/HbXgCRGG1vDWLgs4ux3XEtGf0Pqq5ygKa0pYwr9Iru gPDV3oOEmFQJHljaywubT7LR6JvKjB4WisY0GtL2mYunzfXQKDNJ2IT7AgvtyJ2pZXoU XYR2XhBrg6bR9PiaciucP+MDNNY4W3bKHukckrGLWtdLzlRoDYPfV/IQcZQ5iB0/hmZ7 u4zw== X-Gm-Message-State: AA+aEWbnLVSdlHa6jL7t4vJBGy695s8Xxw9zwyhIihMwjlWnTgpdXZGh vb80QMQL4oW7Mb08jW2zVNv4abGQS1ya40rE/PIUUoVfpoMiPGXdmBrsaEkEamQxde7S1hGl2n0 YFSENszKTKRjor6yAepYzUi38Ec52lpTlb/TOy2XYXAtjnv7gbtbWxJhOZeS331A2uFmVAWUQla /7LuyeYmiNk4oqT0Y6XVrOOV7LwIdnVXaJEkBUXO6CcqRgBb7qmQn5tYEh2a2FdptgaTZk0EuwY 5x9Y4A1cgDWdzf2hT9lOx3xML7AwKisUyYRSPFNMRQXMLmlqEgj/xRFKK4qH+aNq6fjpr34fzop OkWC5FlCkSOv8+PCwzSdjAoEefRo8aN0NH3LtIzue1mNGY/rl6g9Aqr+Dt3+l3vHKId3J69E2Xq h X-Received: by 2002:a2e:8945:: with SMTP id b5-v6mr7345208ljk.55.1545255257072; Wed, 19 Dec 2018 13:34:17 -0800 (PST) X-Received: by 2002:a2e:8945:: with SMTP id b5-v6mr7345176ljk.55.1545255255756; Wed, 19 Dec 2018 13:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545255255; cv=none; d=google.com; s=arc-20160816; b=bdA0hEjzCRK5z7KWNPJD/PF0vCUj8lYtHVcw1AvLgqo0WFrf8EEuY6KanxS/WK71Hx ucFX9Zl+xMLXfjZrwXAnz/veyj9H/te2IiI5SkjwhUkFThHY3/u5HaoDvLG9C8JgwOMw DOiIzYvHTIk7rCrVNLa/5tVCBdqcBE9J6MifRDvvUGKBbWNz6dQ23WEKAWfgoqFHH1in +acGcOxYIsdVnJfY3JpSvekCuUq1zaaXlOlryFlCATlx68UDTFEPDypnW/aJjGPelUDj IXaYzxqwpTtESHfd2PWQS6ssJyqTpBA2RLeCMI4dqZdAb1+KxamNtK0WKFpou6eXToaq IAgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=xeUBKKu9pM2Fl/EWnsAPb2mBNLFsikzJ4KNY/hC/k1s=; b=ccZcjF43wjcHOrVy8AiHyTm2gM75Th31gRoWQgulvXZubqolCIBHh/57ztD3p2nVOP LAiyF1iKze4l7Dmj7LqJPXPNoZ368OM8oBdAY24vQ6L72NKosj55Gscjypat/HHlwZlV mzh3qs50/sUTIwejMtYtsk1Kd8LMUWdRo8GitU4lofnwHniny0sqLF6tBpMlQNZlXWH5 Esv/Sws1I+/qoHgTyuyYLsn+45IfTuHGDp0iSEgcU16mZxeYg4klZeBv8dUDC1T9zouU 5zHN43GGuhnpBNyDQTgnlkBO6K3CJ/ua2sdMuSg47iv1cWhcVXmjt9zl016qxI0Xgyfv E6vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TZIKF4B0; spf=pass (google.com: domain of igor.stoppa@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=igor.stoppa@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h10-v6sor12552733ljf.39.2018.12.19.13.34.15 for (Google Transport Security); Wed, 19 Dec 2018 13:34:15 -0800 (PST) Received-SPF: pass (google.com: domain of igor.stoppa@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TZIKF4B0; spf=pass (google.com: domain of igor.stoppa@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=igor.stoppa@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=xeUBKKu9pM2Fl/EWnsAPb2mBNLFsikzJ4KNY/hC/k1s=; b=TZIKF4B0i3koI0BW8axIrrGf4qCRSgVc8vuBMQJuNZ1qpAqlmGEW+bOBxwCcDK/JY3 mNOXn/Lytz0LlgdZK6s3JlI7atnuH7qez7sfQofkmzbIV2f2ZxskOsfp9NEhU5NaQTvN tFggyM8mgzKvz7s8hU9qqgBsaUM8BAmUcWFYR5zWO8a3RW+FvppFPc9fZecShjwJLJh/ lBOqekityzb82UV0NrQDkyhgmPQox8nu6C1HKMReNtzcl/z9UGLkONLrC6fFakRwXStK q/7/hXtBDqCHpIXqfHQ2ugAPMEwgUpSvY+la3Uaoflk84Jo7xJduNGkOWP+FAq0r1yMl V6EQ== X-Google-Smtp-Source: AFSGD/VdVCH5iML0R9nPvIbiMPCBw0CGtT0CPJuGwuUVLfPeSRuvFLi8jSpphGe6vqzW2o8lG9K3Jw== X-Received: by 2002:a2e:890b:: with SMTP id d11-v6mr4048231lji.113.1545255255391; Wed, 19 Dec 2018 13:34:15 -0800 (PST) Received: from localhost.localdomain (dmhwpt3bffxn8z3-j6k-4.rev.dnainternet.fi. [2001:14bb:51:a4c8:5c24:24d7:ca5f:e7d2]) by smtp.gmail.com with ESMTPSA id v64sm3996867lfa.48.2018.12.19.13.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 13:34:14 -0800 (PST) From: Igor Stoppa X-Google-Original-From: Igor Stoppa To: Andy Lutomirski , Matthew Wilcox , Peter Zijlstra , Dave Hansen , Mimi Zohar Cc: igor.stoppa@huawei.com, Nadav Amit , Kees Cook , linux-integrity@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/12] __wr_after_init: Documentation: self-protection Date: Wed, 19 Dec 2018 23:33:32 +0200 Message-Id: <20181219213338.26619-7-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181219213338.26619-1-igor.stoppa@huawei.com> References: <20181219213338.26619-1-igor.stoppa@huawei.com> Reply-To: Igor Stoppa MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Update the self-protection documentation, to mention also the use of the __wr_after_init attribute. Signed-off-by: Igor Stoppa CC: Andy Lutomirski CC: Nadav Amit CC: Matthew Wilcox CC: Peter Zijlstra CC: Kees Cook CC: Dave Hansen CC: Mimi Zohar CC: linux-integrity@vger.kernel.org CC: kernel-hardening@lists.openwall.com CC: linux-mm@kvack.org CC: linux-kernel@vger.kernel.org --- Documentation/security/self-protection.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Documentation/security/self-protection.rst b/Documentation/security/self-protection.rst index f584fb74b4ff..df2614bc25b9 100644 --- a/Documentation/security/self-protection.rst +++ b/Documentation/security/self-protection.rst @@ -84,12 +84,14 @@ For variables that are initialized once at ``__init`` time, these can be marked with the (new and under development) ``__ro_after_init`` attribute. -What remains are variables that are updated rarely (e.g. GDT). These -will need another infrastructure (similar to the temporary exceptions -made to kernel code mentioned above) that allow them to spend the rest -of their lifetime read-only. (For example, when being updated, only the -CPU thread performing the update would be given uninterruptible write -access to the memory.) +Others, which are statically allocated, but still need to be updated +rarely, can be marked with the ``__wr_after_init`` attribute. + +The update mechanism must avoid exposing the data to rogue alterations +during the update. For example, only the CPU thread performing the update +would be given uninterruptible write access to the memory. + +Currently there is no protection available for data allocated dynamically. Segregation of kernel memory from userspace memory ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~