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.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 107ADC433E1 for ; Thu, 18 Jun 2020 09:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E09CC21974 for ; Thu, 18 Jun 2020 09:28:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="TvclVztG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729082AbgFRJ2J (ORCPT ); Thu, 18 Jun 2020 05:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728819AbgFRJ2J (ORCPT ); Thu, 18 Jun 2020 05:28:09 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B61FC06174E; Thu, 18 Jun 2020 02:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KVgqDrk0BKmeJ9xRgR3wmwnH3HqRe7KzsPNLBPTSOQg=; b=TvclVztGOXGuiOBbmoSS8vyEyw /aF6hr3MFg25vrXdLlCKxQlAYHtqVAYvyHpGRIlh9HDqyI4dCpRcby+dG4Ixho7GvutyvPn3ys956 qqD3EK0sqTEthehajVY8BrYVW3gzaaf1fDw0a/5NMsNG8fsfOtP5oSvhmmV8zv3uJW3cV7gyjSgRh oA7vYDUFCxb2wAskvuR4kn9+fxc3WqxcWdTyyO/DjL37FDjoe7lExDPWWR2YCx2y9oi8U12UTmEEW 7fKjqSpIn+D3gyl04DuVsMxMxoHg64cOHoVDVYmBvyu7g2VU2T8i3R0qJfGECF7MnPOeh8Qg/lxxP V00NbElA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlqpw-0004XY-7k; Thu, 18 Jun 2020 09:27:56 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 97416307A5E; Thu, 18 Jun 2020 11:27:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5D9702059AC5C; Thu, 18 Jun 2020 11:27:54 +0200 (CEST) Date: Thu, 18 Jun 2020 11:27:54 +0200 From: Peter Zijlstra To: Christoph Hellwig Cc: Andrew Morton , Dexuan Cui , Vitaly Kuznetsov , 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: <20200618092754.GF576905@hirez.programming.kicks-ass.net> References: <20200618064307.32739-1-hch@lst.de> <20200618064307.32739-3-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200618064307.32739-3-hch@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 18, 2020 at 08:43:06AM +0200, Christoph Hellwig wrote: > Use PAGE_KERNEL_ROX directly instead of allocating RWX and setting the > page read-only just after the allocation. > > Signed-off-by: Christoph Hellwig > --- > arch/arm64/kernel/probes/kprobes.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c > index d1c95dcf1d7833..cbe49cd117cfec 100644 > --- 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__); > } I think this has the exact same range issue as the x86 user. But it might be less fatal if their PLT magic can cover the full range.