From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225zHCRHXk0aaE6MH0PSOSCfScUccuDRkNihkZev+IcBkKzSPrfBzngSWS7+12Uviqmf/bUN ARC-Seal: i=1; a=rsa-sha256; t=1517325320; cv=none; d=google.com; s=arc-20160816; b=yPiGLaaDgkHPU++Jly/iSwEIhZIYyNem9ngGdoNg5c+vefScNqfXW/GaXxv3HQb9C4 ZqZxf6ahi5uws1leUNBElMtOv7ZPlw6VaYyE0FK1npxT7drMfKmXCpIDVvPZKVGEBd36 SYy2qHq2sNcCT8C5R3TV97YfD6RgxhQ+qDtGKhd5KgB8IdtZ5LrZdnotUsEvpzW2lleO HrLV7JqICEjEboVoCUbjHnMO+9hU8R0QgNuxWGICwvzvsNuZDm+XtPj4C2l/BHXimEqJ jf/BUgV8EU7s/9cM3ieePu7EyV+nYWay3OFcB+LHmPdtUI/IxHo2zIECMA3kb5sbq8es /aNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:subject:cc:to:from:delivered-to :list-id:list-subscribe:list-unsubscribe:list-help:list-post :precedence:mailing-list:arc-authentication-results; bh=B9+Y7ClLy2bsBvNbJjeAQWQVQRF59ENhFE4zCVu6byw=; b=y2pFTwQ9ZlV9dSYpLNYgDZ+f4aAsyYnNovmy0xll50K+VbTYmBe8drMVAk2HS1E7Jz 3golQcfMZ+SJ+CRZjhqNjanHgu1WujWJbmK4U3lN8S0th3ow6KNIt+bfAKOb7p0ymgOv nVYEcZmATeNdYHP0WhoCfby41RtRcv+lTsUaxLvRUsTftPVlB2LpV5FKd1GA+ddqsZwA oZMod/UeRBHMifkpkjs68h0Qfm1IvmTgzj/zYcefICqfUttRuxa/7rlI6jY4EvynU6Mt 0DiuHlygJapHHPJP+bmAzXVWgmQ8Fmb4gd5cQ1159vo8jXJZzMgJqxcEBUiIUpT6+h87 M+8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of kernel-hardening-return-11529-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-11529-gregkh=linuxfoundation.org@lists.openwall.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of kernel-hardening-return-11529-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-11529-gregkh=linuxfoundation.org@lists.openwall.com Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: From: Igor Stoppa To: , , , , , CC: , , , , , Igor Stoppa Subject: [RFC PATCH v12 0/6] mm: security: ro protection for dynamic data Date: Tue, 30 Jan 2018 17:14:40 +0200 Message-ID: <20180130151446.24698-1-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.122.225.51] X-CFilter-Loop: Reflected X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1591030915347978958?= X-GMAIL-MSGID: =?utf-8?q?1591030915347978958?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: This patch-set introduces the possibility of protecting memory that has been allocated dynamically. The memory is managed in pools: when a memory pool is turned into R/O, all the memory that is part of it, will become R/O. A R/O pool can be destroyed, to recover its memory, but it cannot be turned back into R/W mode. This is intentional. This feature is meant for data that doesn't need further modifications after initialization. However the data might need to be released, for example as part of module unloading. To do this, the memory must first be freed, then the pool can be destroyed. An example is provided, in the form of self-testing. Changes since the v11 version: [http://www.openwall.com/lists/kernel-hardening/2018/01/24/4] - restricted access to sysfs entries created (444 -> 400) - more explicit reference to documentation - couple of typos Igor Stoppa (6): genalloc: track beginning of allocations genalloc: selftest struct page: add field for vm_struct Protectable Memory Documentation for Pmalloc Pmalloc: self-test Documentation/core-api/pmalloc.txt | 104 ++++++++ include/linux/genalloc-selftest.h | 30 +++ include/linux/genalloc.h | 5 +- include/linux/mm_types.h | 1 + include/linux/pmalloc.h | 216 ++++++++++++++++ include/linux/vmalloc.h | 1 + init/main.c | 2 + lib/Kconfig | 15 ++ lib/Makefile | 1 + lib/genalloc-selftest.c | 402 +++++++++++++++++++++++++++++ lib/genalloc.c | 444 +++++++++++++++++++++---------- mm/Kconfig | 7 + mm/Makefile | 2 + mm/pmalloc-selftest.c | 65 +++++ mm/pmalloc-selftest.h | 30 +++ mm/pmalloc.c | 516 +++++++++++++++++++++++++++++++++++++ mm/usercopy.c | 25 +- mm/vmalloc.c | 18 +- 18 files changed, 1744 insertions(+), 140 deletions(-) create mode 100644 Documentation/core-api/pmalloc.txt create mode 100644 include/linux/genalloc-selftest.h create mode 100644 include/linux/pmalloc.h create mode 100644 lib/genalloc-selftest.c create mode 100644 mm/pmalloc-selftest.c create mode 100644 mm/pmalloc-selftest.h create mode 100644 mm/pmalloc.c -- 2.9.3