From patchwork Wed Nov 7 10:36:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10672139 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 E4FCB13A4 for ; Wed, 7 Nov 2018 10:36:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D27B62B7BC for ; Wed, 7 Nov 2018 10:36:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C557F2B7CE; Wed, 7 Nov 2018 10:36:52 +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.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 725222B7BC for ; Wed, 7 Nov 2018 10:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mAPUI5eROebRioSDie689M25ocoVq9rXicmm3HPnc24=; b=D3hxDmUnmCxG48 5mTpevk1gfPgbIXTG4XUe6nHoeV5RrTzcoEHrG/MrkJAXLWRYvpiAZoHAfoaRi3e8ZpJKf+w51RWI QZlQhXwCOI0YJSUb7iGdnHI+Hw6FrQ9zZBf/4dx6AIad9YjLjR26Wl4+nNQ/Up2VLXeOHw8tciEnL NYlcbx9Nk5Rc9GQyjR/NeQ14PVkewTxkb/ZZgKjWpiwOi+N5Aw1pXzAetLgacTuEy9nFIlXBaH3s+ wumqw9s9zWXE119VAk7wRPZP/STgbtGFHnf+G2wPb3GU6wsLv9AMcxn9AUn64okeKRMMO3mItjdy/ WFxo/RLpjCO/TRhwVHeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKLCT-00070o-R2; Wed, 07 Nov 2018 10:36:41 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKLCQ-0006zt-Ba for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2018 10:36:39 +0000 Received: by mail-wm1-x343.google.com with SMTP id f10-v6so1347645wme.3 for ; Wed, 07 Nov 2018 02:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5yMuaNsWNvNo0BzUto/BzcL65hu4KIJHKHILfJZm5Ug=; b=h91ha07jDV+Tt09SxyrXJAU1OdRA0OU6sSeVJd945Ns+mYOEPm2kVF8K/Rt2C/pb2M hDv9uwZgYH1nHim4V9WsVTacOylvRnWO5X6E9Jj01EsW8wuxDuyahpxosF29YkjWIlEC d21dn3plNsTlJrhzxrbYGogDb098Z5UtfK+mY= 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:mime-version :content-transfer-encoding; bh=5yMuaNsWNvNo0BzUto/BzcL65hu4KIJHKHILfJZm5Ug=; b=bRVdC/lzjzFjVT5ieMIdOhj/zcsdAtsmlzxSUU9YShLEt0arRIv/wuBB4Er7ubNV7b vDsjjgoceU0jNespYCk9UEt5YdFUrCM7TS1MtHQAcsjjNQf6uk7VaEvkJndbxJh6an7Q 8NZp4DKMTBisl4W/DQ9Qo1/bjOm3OzYFCs20iMyf5vzvj0KehqV9D7RNeZVFIqKlFw4T V4ObsrajQTNKSnWND1iSOXYEAH1OuV5AYW/Wo6uExn2MjUbEgjXzpNwhgJ7riDzly0ZE xdAn15qGgM2Vk+m0bJVb8SMdk/DxKHZBui4fesfmVIy2/S5jejwhCk/8hGorsy86o2Jb ujrA== X-Gm-Message-State: AGRZ1gJySRqdh+xvKG1cF2d3KscACT8hwWNrIFIuIwYuQWcshQ/T1hn8 GfUomZ/M+tyvYQMVNWX/oAm+fXwxilo= X-Google-Smtp-Source: AJdET5e5N7dTx87l7sb8MXuGq+31D5WnvP4lW0hLdmLIWIOGDyF9u46a34rUtpm8faqs90MR2wKuVA== X-Received: by 2002:a1c:e004:: with SMTP id x4-v6mr1480045wmg.71.1541586986178; Wed, 07 Nov 2018 02:36:26 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id o9-v6sm346648wra.42.2018.11.07.02.36.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 02:36:25 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 0/2] get rid of writable linear aliases of read-only vmalloc mappings Date: Wed, 7 Nov 2018 11:36:18 +0100 Message-Id: <20181107103620.16054-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_023638_405287_17BB2F8C X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Ard Biesheuvel , keescook@chromium.org, jannh@google.com, catalin.marinas@arm.com, kernel-hardening@lists.openwall.com, will.deacon@arm.com, james.morse@arm.com, labbott@redhat.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This is a followup to my patch 'arm64/mm: unmap the linear alias of module allocations'. (v1-v2) This version changes the approach to match what x86 does, i.e., to deal with the linear alias at a more fundamental level, in the set_memory_ro/rw routines. Changes since v3: - drop boolean function parameter and infer whether to remap the alias from set_mask/clear_mask - overload rodata= instead of adding yet another kernel cmdline arg - fix typos Ard Biesheuvel (2): arm64: mm: purge lazily unmapped vm regions before changing permissions arm64: mm: apply r/o permissions of VM areas to its linear alias as well arch/arm64/Kconfig | 14 +++++++++++++ arch/arm64/include/asm/mmu_context.h | 2 ++ arch/arm64/mm/mmu.c | 16 +++++++++++++-- arch/arm64/mm/pageattr.c | 21 ++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-)