Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2215848imu; Sat, 22 Dec 2018 15:37:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN7S29LbEsLvGF6q7srmSpBpd1jyxTt9p8imBnLXVAxJVAofkpV7l7gE0GyUph452lf/0YkA X-Received: by 2002:a63:83c1:: with SMTP id h184mr7508072pge.437.1545521863643; Sat, 22 Dec 2018 15:37:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545521863; cv=none; d=google.com; s=arc-20160816; b=WeBzTp9pKvEvSf4NbO/77CWf3A6X4U8Dh96/r9Qt+SVvPdHLawVFg30b1JDGs0+Fok QUrRGmylQk6vTLPcwwXBmKJNdP6EEfM14HVkIU3Cpz5NXq5Pu75Q3/QN1seYM4JJTuE7 IBzSyCGofF6C/iusJ0jRqSYAJS65qSAmSe1viCnRAUBd9I319xW3HlU7uufzUkOQMHUp zgczQX4b5y4AOw4S4+nfyMf7ByRD8E7aBQ1FNYMKqs8Ue2iU2xm8yj+BGroofjHD++f7 vB4c1b2NtXpuC0dEa/qqTe5Y3iyf9Kv69OaDP1u1jJDSWul9sr+2Qe3V0h7P09vYaTc3 iEzQ== 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:mime-version :reply-to:references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y4zotDQYnZoXB9lfg1fC2W7czb+qE54ZRjKDYZQbGrM=; b=My+OfFhfNnOgoTdZjmGvwb8IN7LSojOCvXFmDjK+PTqOh2fKNxP6D6p9Fd3cpsEGOh BI6Md2XXoDUBH4zPwy3siX0TMQJKapOy5nK8JsqIFuWUvUn4TSOjCYIcU5N3KP+RhMBW 2wLIYz9OwtCEG8T18GUcKDiNCUxaG+iF3BZdY9AoS/8RmWi7ogIbxH6Ed3Tl2uh0+JI0 QyBJyFmY5v2E+6mYwnl2AsipXCgzA4IEQ3MWrpYUKVvvkDACBuZtHLNHq9XPOpupu89n tWtoi7JpDdQEd9/qy50m8NMrnrhAxviEAjQIXhkF4q5xXH3GRSkFxV+7WP15pqRerfly 12bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SvsaISUs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t63si5015632pgd.78.2018.12.22.15.36.57; Sat, 22 Dec 2018 15:37:43 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SvsaISUs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404359AbeLUSPB (ORCPT + 99 others); Fri, 21 Dec 2018 13:15:01 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34090 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbeLUSO7 (ORCPT ); Fri, 21 Dec 2018 13:14:59 -0500 Received: by mail-lf1-f66.google.com with SMTP id p6so4553838lfc.1; Fri, 21 Dec 2018 10:14:57 -0800 (PST) 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=y4zotDQYnZoXB9lfg1fC2W7czb+qE54ZRjKDYZQbGrM=; b=SvsaISUsENLTRerxTlrw5WngUCL6xcuf+y6j/r5ybSpTEfxaevKrsab709fKKhBFHj bDwmZRFgmlGlLH6FjZIZscR0mARSzL5Yc1Hymyod01ulZ++YoZYQqgmNdt5hGgCy/c1w dOBT1TON7MOsOs6Xw7MVbfxdS7EHIQYmGSXAmKQBDdENjV/u+AOBJ2y2A59gz4QamBCP UTifq3MQpLnaFdW5Xk4MLjGbO5nBEo9pGRwBG+W6PIBX76n7iZh9k2R9oNkzAxmSHaKA Z19GApJN2rFbLKVpY9/VsZ+zfN78gSapfg+d5LN8SNYSOESPzDlqQaFJ+a0L0WMvu1B/ svYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=y4zotDQYnZoXB9lfg1fC2W7czb+qE54ZRjKDYZQbGrM=; b=XuUAVsViAxDrasnVE8bzww9MbO27+Og5AaPTrtNF2wvgLFbaQVezjD/TIOLgd5KmRa BHecUnqXDOk7AIGlm9Yb3iZdiPRKbPRVfoNNofT0dJMWpxz4h+HPHZaggANgMzU6A7E4 JNWxZb82c/f9gkc6SurnMxgr3dVcC/LVjfgECDmLlzd+7YwEB/kk0zZD/6b5loT5vPWN 0zjv3nbkLTR6UQrJ5aAonHBelo3Fwsi3K80J3WKnbjGRtm3qpthvk0UDoQ9B62Va0WYc t6K78rekFlXfBsd4TwJB5A/bcHYlBN0SiIMMrV379tAgtHcZeN4zhTeEX7KEWZSWazTd fXxg== X-Gm-Message-State: AA+aEWbYg+yx/n4lICc8TpqwUImv0RX3S/9KmTJL6JsB3GyVEwdYU2SA Eu7fChO/HZii3RR7+tsNhDU= X-Received: by 2002:a19:a60c:: with SMTP id p12mr2115400lfe.63.1545416096496; Fri, 21 Dec 2018 10:14:56 -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 m63-v6sm5444564lje.81.2018.12.21.10.14.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 10:14:55 -0800 (PST) From: Igor Stoppa X-Google-Original-From: Igor Stoppa To: Andy Lutomirski , Matthew Wilcox , Peter Zijlstra , Dave Hansen , Mimi Zohar , Thiago Jung Bauermann Cc: igor.stoppa@huawei.com, Nadav Amit , Kees Cook , Ahmed Soliman , 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: Fri, 21 Dec 2018 20:14:17 +0200 Message-Id: <20181221181423.20455-7-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221181423.20455-1-igor.stoppa@huawei.com> References: <20181221181423.20455-1-igor.stoppa@huawei.com> Reply-To: Igor Stoppa MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Thiago Jung Bauermann CC: Ahmed Soliman 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.19.1