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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 993EEC433DF for ; Sat, 27 Jun 2020 07:34:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D57F208C7 for ; Sat, 27 Jun 2020 07:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593243297; bh=Itmuk4QOyPwIKwsALdhVa2cCBtOvlPtICWP8yExdrkQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=0sDWMpau4j4dd2oeYfiiKBuUZDhixV2IbmUTkGY7w2C5xpFbkTGqq7uwNwLOpI/BZ fj8XHkyf3rRcvM3XNkVtyOgBiV9RdZHdqDF6Wq9ouL3rAUjngK4wOkfgaWI//NvOrv 9rm7g1CGHC3SUe9yfHNH2mwbezIGCOpmwz8DGfJI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726140AbgF0Hez (ORCPT ); Sat, 27 Jun 2020 03:34:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgF0Hez (ORCPT ); Sat, 27 Jun 2020 03:34:55 -0400 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 A56A9208C7; Sat, 27 Jun 2020 07:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593243294; bh=Itmuk4QOyPwIKwsALdhVa2cCBtOvlPtICWP8yExdrkQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ytezSzQykMahou3pqLknMYHGq+8/x5+uhogNAXuiNCmvKi+ZCWECBx4qXvEXFr6Mx z8PnK82Z+4iYXLLovPvGmQvxQe541i2I74VThkMfoyx5fVus9V3LCSg05Yv2Lv0rk1 tAHHSyaG/18Tsv2tnlQ32CghSrWn3xV1pzFN2yAs= Received: by mail-ot1-f45.google.com with SMTP id 5so8758778oty.11; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) X-Gm-Message-State: AOAM530m4f2yXk4MmQl8DbNzkmPgbn3Kt6lc0Zo6bEDX75Nfo2ZTmF6K 9DRzG6SiV9pUNrYJ1fYqN/MpPn/fnVv5ggHL+nQ= X-Google-Smtp-Source: ABdhPJxo4GBgpI3CfYGRDTcSeYC19Y/AaYwBMPAP0EKLufVSK5++jOx6RFOZghHqIsVnypd++ND2Rq+oIwGgJMhTXEw= X-Received: by 2002:a9d:5a12:: with SMTP id v18mr5423029oth.90.1593243294044; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) MIME-Version: 1.0 References: <20200618064307.32739-1-hch@lst.de> <20200618064307.32739-3-hch@lst.de> In-Reply-To: <20200618064307.32739-3-hch@lst.de> From: Ard Biesheuvel Date: Sat, 27 Jun 2020 09:34:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page To: Christoph Hellwig Cc: Andrew Morton , linux-hyperv@vger.kernel.org, Peter Zijlstra , Catalin Marinas , X86 ML , Dexuan Cui , Linux Kernel Mailing List , linux-mm@kvack.org, Jessica Yu , Vitaly Kuznetsov , Will Deacon , Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Jun 2020 at 08:44, 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__); Why is this passing a string for the 'caller' argument, and not the address of the caller? > } > > /* arm kprobe: install breakpoint in text */ > -- > 2.26.2 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 A7B2DC433E1 for ; Sat, 27 Jun 2020 07:34:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 60A702088E for ; Sat, 27 Jun 2020 07:34:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ytezSzQy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60A702088E 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 DC14A6B0099; Sat, 27 Jun 2020 03:34:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4BB16B009B; Sat, 27 Jun 2020 03:34:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C12A96B009C; Sat, 27 Jun 2020 03:34:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id A50086B0099 for ; Sat, 27 Jun 2020 03:34:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 62D2A2C81 for ; Sat, 27 Jun 2020 07:34:56 +0000 (UTC) X-FDA: 76974180192.04.wire71_1b053d626e5c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 2FB798007DF7 for ; Sat, 27 Jun 2020 07:34:56 +0000 (UTC) X-HE-Tag: wire71_1b053d626e5c X-Filterd-Recvd-Size: 3944 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Sat, 27 Jun 2020 07:34:55 +0000 (UTC) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.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 A2F202081A for ; Sat, 27 Jun 2020 07:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593243294; bh=Itmuk4QOyPwIKwsALdhVa2cCBtOvlPtICWP8yExdrkQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ytezSzQykMahou3pqLknMYHGq+8/x5+uhogNAXuiNCmvKi+ZCWECBx4qXvEXFr6Mx z8PnK82Z+4iYXLLovPvGmQvxQe541i2I74VThkMfoyx5fVus9V3LCSg05Yv2Lv0rk1 tAHHSyaG/18Tsv2tnlQ32CghSrWn3xV1pzFN2yAs= Received: by mail-ot1-f44.google.com with SMTP id 64so10767389oti.5 for ; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) X-Gm-Message-State: AOAM531jwyjD6BLYRtQ/oUkaTjs8bwIEDL43YIddhyYNkwUm6BPX/BbD /sa7P7EHGY7gxCqKHL0BF2THyQZjd54ZiACoAC4= X-Google-Smtp-Source: ABdhPJxo4GBgpI3CfYGRDTcSeYC19Y/AaYwBMPAP0EKLufVSK5++jOx6RFOZghHqIsVnypd++ND2Rq+oIwGgJMhTXEw= X-Received: by 2002:a9d:5a12:: with SMTP id v18mr5423029oth.90.1593243294044; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) MIME-Version: 1.0 References: <20200618064307.32739-1-hch@lst.de> <20200618064307.32739-3-hch@lst.de> In-Reply-To: <20200618064307.32739-3-hch@lst.de> From: Ard Biesheuvel Date: Sat, 27 Jun 2020 09:34:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page To: Christoph Hellwig Cc: Andrew Morton , linux-hyperv@vger.kernel.org, Peter Zijlstra , Catalin Marinas , X86 ML , Dexuan Cui , Linux Kernel Mailing List , linux-mm@kvack.org, Jessica Yu , Vitaly Kuznetsov , Will Deacon , Linux ARM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 2FB798007DF7 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Thu, 18 Jun 2020 at 08:44, 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__); Why is this passing a string for the 'caller' argument, and not the address of the caller? > } > > /* arm kprobe: install breakpoint in text */ > -- > 2.26.2 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham 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 113DFC433DF for ; Sat, 27 Jun 2020 07:38:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D234920706 for ; Sat, 27 Jun 2020 07:38:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TkW9DBN6"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ytezSzQy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D234920706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wGUpoPcHt3WuU+zL0Wa5InfV/jMOr0/r5gAIl4JeNe8=; b=TkW9DBN6kj48NXdOzXzov/e7H UdyedieAQNWNW+VXUmjN3SCl6sHEyZ6UZvm+MyY8TpLsyDoEywDKZqI04Wi8Kn8HjOwJWQJK4JPIH BjheT4J8t4VNUsWkbgC8M1mdhdx27OQmRaTCOfTgy81dSXQOonber2XxorM2Ld/YXz8kSWkoEdJGE AiK7RsaXOgPn86EMHbrSMn9nwn/OX70Or9KAa1RGKXRVtfAwU6B7acaCn2zUgFw27iJUM1FxDx7Ks OnmVebl1pfIz4IsNRMsY8yWEeJwwF+d/45K10kHOhH2lKffIHmaDplKWw0kd89zrBSHJ8nV3J3Hx/ NpbX8Pqfg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jp5MY-0002Qi-MY; Sat, 27 Jun 2020 07:34:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jp5MV-0002Q2-MR for linux-arm-kernel@lists.infradead.org; Sat, 27 Jun 2020 07:34:56 +0000 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 B81D721473 for ; Sat, 27 Jun 2020 07:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593243294; bh=Itmuk4QOyPwIKwsALdhVa2cCBtOvlPtICWP8yExdrkQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ytezSzQykMahou3pqLknMYHGq+8/x5+uhogNAXuiNCmvKi+ZCWECBx4qXvEXFr6Mx z8PnK82Z+4iYXLLovPvGmQvxQe541i2I74VThkMfoyx5fVus9V3LCSg05Yv2Lv0rk1 tAHHSyaG/18Tsv2tnlQ32CghSrWn3xV1pzFN2yAs= Received: by mail-ot1-f52.google.com with SMTP id n6so10787594otl.0 for ; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) X-Gm-Message-State: AOAM5330orw/kg9ulXC+JC9ApAncTRoiDA/PQz998gusT7PEjKTz51Dj md7gaG3shZJpgFKJfhh9Y+rq/PhcOemg9nQWcdI= X-Google-Smtp-Source: ABdhPJxo4GBgpI3CfYGRDTcSeYC19Y/AaYwBMPAP0EKLufVSK5++jOx6RFOZghHqIsVnypd++ND2Rq+oIwGgJMhTXEw= X-Received: by 2002:a9d:5a12:: with SMTP id v18mr5423029oth.90.1593243294044; Sat, 27 Jun 2020 00:34:54 -0700 (PDT) MIME-Version: 1.0 References: <20200618064307.32739-1-hch@lst.de> <20200618064307.32739-3-hch@lst.de> In-Reply-To: <20200618064307.32739-3-hch@lst.de> From: Ard Biesheuvel Date: Sat, 27 Jun 2020 09:34:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page To: Christoph Hellwig X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hyperv@vger.kernel.org, Peter Zijlstra , Catalin Marinas , X86 ML , Dexuan Cui , Linux Kernel Mailing List , linux-mm@kvack.org, Jessica Yu , Andrew Morton , Will Deacon , Vitaly Kuznetsov , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 18 Jun 2020 at 08:44, 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__); Why is this passing a string for the 'caller' argument, and not the address of the caller? > } > > /* arm kprobe: install breakpoint in text */ > -- > 2.26.2 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel