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: 10672133 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 C551713A4 for ; Wed, 7 Nov 2018 10:36:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5F162B7BC for ; Wed, 7 Nov 2018 10:36:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA05F2B826; Wed, 7 Nov 2018 10:36:40 +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=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id E1A5D2B7E0 for ; Wed, 7 Nov 2018 10:36:39 +0000 (UTC) Received: (qmail 9691 invoked by uid 550); 7 Nov 2018 10:36:38 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 9669 invoked from network); 7 Nov 2018 10:36:37 -0000 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=bt6JIQ+Rc/WvGf6vAgphnC6BwK3Ua598E6B7Vs6K7r3gNewYgFTCRL+gYlgKWQcwSy uDB7EjAJ8YlVoG4hvCmqVROdhc14DRMYfURBFnyRRI0y7F6SRBQdUuTSXbozlPfo65DU DfmaR1cA8WV0jwPIWoV5crGSkD4D7Zls110PFVUlUr+KYmoCinCCXaSmAGqWnhWJdywc FoEtVOAhq5o3NDoCYmZuf1sH9Z8mpOdNOWmlHS4SlNZVz9LBMYcbk7ei9EDirKMIiY5T kU5QCjl6/+QcaYFpqAdPDrRx0gNYDCDDRMX3lYwnSoMNyvuqaQNT0tNnLhOtNgTAXW+J EY+w== X-Gm-Message-State: AGRZ1gI/yTjPboUwoNhjZG9YB10+sFIinYV0XfQsI8vCMm68SG1QnC1W aA+xBBWzzx/Q04dHbs1UE72zhQ== 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) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: kernel-hardening@lists.openwall.com, keescook@chromium.org, labbott@redhat.com, will.deacon@arm.com, jannh@google.com, mark.rutland@arm.com, james.morse@arm.com, catalin.marinas@arm.com, Ard Biesheuvel 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-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(-)