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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 683C5C433E1 for ; Tue, 23 Jun 2020 09:05:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 373E92072E for ; Tue, 23 Jun 2020 09:05:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 373E92072E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CBF356B0002; Tue, 23 Jun 2020 05:05:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6E636B0005; Tue, 23 Jun 2020 05:05:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5D4B6B0006; Tue, 23 Jun 2020 05:05:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 9F3016B0002 for ; Tue, 23 Jun 2020 05:05:09 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6208F9411 for ; Tue, 23 Jun 2020 09:05:09 +0000 (UTC) X-FDA: 76959892338.22.shelf11_3e07cde26e3a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 322D218038E60 for ; Tue, 23 Jun 2020 09:05:09 +0000 (UTC) X-HE-Tag: shelf11_3e07cde26e3a X-Filterd-Recvd-Size: 2391 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Tue, 23 Jun 2020 09:05:08 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 3048568AEF; Tue, 23 Jun 2020 11:05:05 +0200 (CEST) Date: Tue, 23 Jun 2020 11:05:05 +0200 From: Christoph Hellwig To: Andrew Morton Cc: Christoph Hellwig , Dexuan Cui , Vitaly Kuznetsov , Peter Zijlstra , Catalin Marinas , Will Deacon , Jessica Yu , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/3] arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page Message-ID: <20200623090505.GA7518@lst.de> References: <20200618064307.32739-1-hch@lst.de> <20200618064307.32739-3-hch@lst.de> <20200620191616.bae356186ba3329ade67bbf7@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200620191616.bae356186ba3329ade67bbf7@linux-foundation.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 322D218038E60 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 Sat, Jun 20, 2020 at 07:16:16PM -0700, Andrew Morton wrote: > On Thu, 18 Jun 2020 08:43:06 +0200 Christoph Hellwig wrote: > > > Use PAGE_KERNEL_ROX directly instead of allocating RWX and setting the > > page read-only just after the allocation. > > > > --- a/arch/arm64/kernel/probes/kprobes.c > > +++ b/arch/arm64/kernel/probes/kprobes.c > > @@ -120,15 +120,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) > > > > void *alloc_insn_page(void) > > { > > - void *page; > > - > > - page = vmalloc_exec(PAGE_SIZE); > > - if (page) { > > - set_memory_ro((unsigned long)page, 1); > > - set_vm_flush_reset_perms(page); > > - } > > - > > - return page; > > + return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, > > + GFP_KERNEL, PAGE_KERNEL_ROX, VM_FLUSH_RESET_PERMS, > > + NUMA_NO_NODE, __func__); > > } > > > > /* arm kprobe: install breakpoint in text */ > > But why. I think this is just a cleanup, doesn't address any runtime issue? It doesn't "fix" an issue - it just simplifies and speeds up the code.