From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 026FAC56201 for ; Sun, 22 Nov 2020 04:10:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61B4420789 for ; Sun, 22 Nov 2020 04:10:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="UTKsWK7e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61B4420789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7C44E6B0068; Sat, 21 Nov 2020 23:10:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74B8C6B006C; Sat, 21 Nov 2020 23:10:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EBD66B006E; Sat, 21 Nov 2020 23:10:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id 281DC6B0068 for ; Sat, 21 Nov 2020 23:10:36 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C1972180AD802 for ; Sun, 22 Nov 2020 04:10:35 +0000 (UTC) X-FDA: 77510727630.06.watch59_20114ac27359 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id A3DB110057D59 for ; Sun, 22 Nov 2020 04:10:35 +0000 (UTC) X-HE-Tag: watch59_20114ac27359 X-Filterd-Recvd-Size: 3669 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Sun, 22 Nov 2020 04:10:34 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C840A20789 for ; Sun, 22 Nov 2020 04:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606018234; bh=aIUERRo+D3LJ1e3a38WHT/KcLgeR55ggVW4a+W2H/ac=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UTKsWK7ethrWz7p0NHZy89h4gnmhgVI2C90fJNI0jdlbjs5z3qajIvn6aiKnXsrJc lnBI/f7hVxaiTdGRpdHKjcrhQGDwruka4Izo0iV4TsJ1d1v6T7aNGtqQ087nqJEz4n oSkozLL22iz8ovbkfihb/19OmioGteZ57smJ0w1Y= Received: by mail-wm1-f44.google.com with SMTP id h21so14110912wmb.2 for ; Sat, 21 Nov 2020 20:10:33 -0800 (PST) X-Gm-Message-State: AOAM533Ksq1N4N9bPae6rDLmCAK8eungZ/Rmd1Nh0d9tGUPRmcHJzXQi VZ8JvV803MgXBstYoFyOirmEgvyriecmBPcEFQzV3Q== X-Google-Smtp-Source: ABdhPJxlpOwzJoFxMqFLKTm7fhwah9wqGhXLGX+C0bhrFGpecaO68yaNmHMgKiHI+MdXGy44VW9EWOMmwf6PnTdgv+w= X-Received: by 2002:a1c:2781:: with SMTP id n123mr427726wmn.49.1606018232467; Sat, 21 Nov 2020 20:10:32 -0800 (PST) MIME-Version: 1.0 References: <20201120202426.18009-1-rick.p.edgecombe@intel.com> <20201120202426.18009-2-rick.p.edgecombe@intel.com> In-Reply-To: <20201120202426.18009-2-rick.p.edgecombe@intel.com> From: Andy Lutomirski Date: Sat, 21 Nov 2020 20:10:16 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation To: Rick Edgecombe Cc: Andrew Morton , Jessica Yu , bpf , Alexei Starovoitov , Daniel Borkmann , Andrew Lutomirski , Dave Hansen , Peter Zijlstra , X86 ML , Mike Rapoport , Linux-MM , LKML , Dan Williams , Elena Reshetova , Weiny Ira Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe wrote: > > In order to allow for future arch specific optimizations for vmalloc > permissions, first add an implementation of a new interface that will > work cross arch by using the existing set_memory_() functions. > > When allocating some memory that will be RO, for example it should be used > like: > > /* Reserve va */ > struct perm_allocation *alloc = perm_alloc(vstart, vend, page_cnt, PERM_R); I'm sure I could reverse-engineer this from the code, but: Where do vstart and vend come from? Does perm_alloc() allocate memory or just virtual addresses? Is the caller expected to call vmalloc()? How does one free this thing? > unsigned long ro = (unsigned long)perm_alloc_address(alloc); > > /* Write to writable address */ > strcpy((char *)perm_writable_addr(alloc, ro), "Some data to be RO"); > /* Signal that writing is done and mapping should be live */ > perm_writable_finish(alloc); > /* Print from RO address */ > printk("Read only data is: %s\n", (char *)ro); >