Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp11106811imu; Thu, 6 Dec 2018 11:39:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+uN4Fzkf5UYnZTdhmU8wK/n4kwijYEwYC47Ow7T7gw3kMn7KFppjUnURdUSuF79VigDtf X-Received: by 2002:a62:fc52:: with SMTP id e79mr30106097pfh.8.1544125141204; Thu, 06 Dec 2018 11:39:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544125141; cv=none; d=google.com; s=arc-20160816; b=hQ5BBZTLVWTLXiBl/9vOyAyV72gHXdMvsSoOSrWCs+5Tg2RjUiaT+ehA53SWNpqZVw B2U/QA5zQTDIN1L0AXP4ljSlb6kan/ELxW6uLDhVL6cPii7yqnrqWYAGq+dKhVfmWdwh OZJlrsxMi8pSSFt5mRye8jkaGo8T7iTigU8bMAOsfeIb0j/lTaVwDpz/gUEoRVMzP2tk y5HOiunI75M8JFvXTX0oFvNgwNlPF7L9EtAkYEnU9MjkMw2kWXwa8EO+LhcwJFXTiKr3 R7BT981hdr80kEydaToQH3McXtgXoJu998+GTiNamhUDCyvNce6udYB6BSqpMa0ZhryD nMPQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1+TJbYA25R4+OFlYDVkshbeK/dem3I9OyORouedZy84=; b=Xaxc04S5pWjuQ6pc2HjuytL6ZJ49jE413jyKXggDp8L2kHyfIVOxlQuF5Y9xDVQvCK 2Pg7NKBnZmJ0duJLLG4JvhSbH0ijJaifFHPm/BLIC4KQ5Gz77DE4+EXsu8LqpluYqKFB +PwsgeSMND8lonX8YD7uCATnXV1XMoTu61Ai4tu0E8RuUS50CzB5Z6Hjxb1QEFmvafrd x1GAhw+E5BRosSYcZl565RWFCD/ad3705Fds+m9V9jClK6G1KeSeRE9GLp2cp1IFjwHT d+drhtxwxEHQphi6/PzVUpmvnM+1eLdxtVH/KCUjYKstSSupXzAgVLP6jvoDhoGa2T44 NQEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CdVU1IP7; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39si876791pld.434.2018.12.06.11.38.45; Thu, 06 Dec 2018 11:39:01 -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=@linaro.org header.s=google header.b=CdVU1IP7; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726018AbeLFTgo (ORCPT + 99 others); Thu, 6 Dec 2018 14:36:44 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:36510 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725927AbeLFTgm (ORCPT ); Thu, 6 Dec 2018 14:36:42 -0500 Received: by mail-it1-f194.google.com with SMTP id c9so3384593itj.1 for ; Thu, 06 Dec 2018 11:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1+TJbYA25R4+OFlYDVkshbeK/dem3I9OyORouedZy84=; b=CdVU1IP7myqvZPU/i/feoQ4iU/vLsS39I1qoZuvKscLBMgqKRwMLgTj5pqCQwqBp0B dOXn3YlIMisVkQ7H04X3o8qaqhGHk43hkH+9NSX/IRCA0+Un8UlfCtCxiABQYkQxMDMW NteoxkvQdo6gtlAGSQ8/eEJkbkbDfZeh9LBXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1+TJbYA25R4+OFlYDVkshbeK/dem3I9OyORouedZy84=; b=UnYSqohtULhdGB+12viCI5CvaHMpZZ0O6CJGHHtDVm1QXuY1ubDuLAIwG3EQCZpace FuWLgnwQIxitZdRsOYDAc3S2Naf+09J69WUvv58HnQE/znkkjBqjPDUO+P9r5I3j67GM QLDM0kd1J0Pk7fKzM09YL+GtuksBqsol1ljlmcn5ptmZvp2GW5e/1Ws8s09wFZ9b3okE gL4+FWpsN85zt7gxi2DemJCaofpKlUAjIS300Nc8UqDDP430IrtRevpkSwAOJa0Ahk3b bH4W0Mwi4uVVrP2Pd2mzbmVdQ6mZ7VWugFQwjk0r2AiVcL30jN2rxK4XOiDzf44B86nu HWjA== X-Gm-Message-State: AA+aEWbU0200Z7gF58LIKt99gcHWSWQP4Yuc2TxQ/CKyj5XQo1TpTKEb QFnsVsO54W5eoQTyY62Qrx5HchRDXCz9+rowZ/TgVQ== X-Received: by 2002:a24:710:: with SMTP id f16mr17962971itf.121.1544125000637; Thu, 06 Dec 2018 11:36:40 -0800 (PST) MIME-Version: 1.0 References: <20181204160304.GB7195@arm.com> <51281e69a3722014f718a6840f43b2e6773eed90.camel@intel.com> <20181205114148.GA15160@arm.com> <20181206193108.GA21002@arm.com> In-Reply-To: <20181206193108.GA21002@arm.com> From: Ard Biesheuvel Date: Thu, 6 Dec 2018 20:36:28 +0100 Message-ID: Subject: Re: [PATCH 1/2] vmalloc: New flag for flush before releasing pages To: Will Deacon Cc: Andy Lutomirski , Rick Edgecombe , Nadav Amit , Linux Kernel Mailing List , Daniel Borkmann , Jessica Yu , Steven Rostedt , Alexei Starovoitov , Linux-MM , Jann Horn , "Dock, Deneen T" , Peter Zijlstra , kristen@linux.intel.com, Andrew Morton , Ingo Molnar , anil.s.keshavamurthy@intel.com, Kernel Hardening , Masami Hiramatsu , naveen.n.rao@linux.vnet.ibm.com, "David S. Miller" , "" , Dave Hansen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Dec 2018 at 20:30, Will Deacon wrote: > > On Thu, Dec 06, 2018 at 08:23:20PM +0100, Ard Biesheuvel wrote: > > On Thu, 6 Dec 2018 at 20:21, Andy Lutomirski wrote: > > > > > > On Thu, Dec 6, 2018 at 11:04 AM Ard Biesheuvel > > > wrote: > > > > > > > > On Thu, 6 Dec 2018 at 19:54, Andy Lutomirski wrot= e: > > > > > > > > > > > > > That=E2=80=99s not totally nuts. Do we ever have code that expect= s __va() to > > > > > work on module data? Perhaps crypto code trying to encrypt stati= c > > > > > data because our APIs don=E2=80=99t understand virtual addresses.= I guess if > > > > > highmem is ever used for modules, then we should be fine. > > > > > > > > > > > > > The crypto code shouldn't care, but I think it will probably break = hibernate :-( > > > > > > How so? Hibernate works (or at least should work) on x86 PAE, where > > > __va doesn't work on module data, and, on x86, the direct map has som= e > > > RO parts with where the module is, so hibernate can't be writing to > > > the memory through the direct map with its final permissions. > > > > On arm64 at least, hibernate reads the contents of memory via the > > linear mapping. Not sure about other arches. > > Can we handle this like the DEBUG_PAGEALLOC case, and extract the pfn fro= m > the pte when we see that it's PROT_NONE? > As long as we can easily figure out whether a certain linear address is mapped or not, having a special case like that for these mappings doesn't sound unreasonable.