From patchwork Fri Jul 24 05:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11682039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4325413B1 for ; Fri, 24 Jul 2020 05:07:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1086F206F0 for ; Fri, 24 Jul 2020 05:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1086F206F0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AF888D0024; Fri, 24 Jul 2020 01:07:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 55F388D0007; Fri, 24 Jul 2020 01:07:56 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 427C78D0024; Fri, 24 Jul 2020 01:07:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id 27A568D0007 for ; Fri, 24 Jul 2020 01:07:56 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DC4B7181A8DB5 for ; Fri, 24 Jul 2020 05:07:55 +0000 (UTC) X-FDA: 77071787310.20.moon35_11176bc26f44 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 2E09C1808CDDC for ; Fri, 24 Jul 2020 05:06:34 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jarkko.sakkinen@linux.intel.com,,RULES_HIT:30054,0,RBL:134.134.136.100:@linux.intel.com:.lbl8.mailshell.net-64.95.201.95 62.18.0.100;04y895swytj96cnya7xodo7en6nsoopmxp5tgfdioumfdtnxxqzn6as5u7z4brx.wjn99z4enc8n5r8syouxj81jad97df7f3aecoxana37ig58xfdyczmxqg6jrmsp.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: moon35_11176bc26f44 X-Filterd-Recvd-Size: 3130 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Jul 2020 05:06:33 +0000 (UTC) IronPort-SDR: osEU5h3pJVVMJv/Bgs3NcAU0K9PpFrMD3mtxneSx6tgFQH2Dqch4tjLYyHdMHhtducET38XaMD MpO9Hp2ePhMA== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="215249800" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="215249800" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:06:32 -0700 IronPort-SDR: gKq9JMMfAB1WTxb1B75Tr/Y0+VWnZYl7rXeqRKzkcyBP5cyyEa9WGOlGd4Xw57NlUJVfrBbHUQ TREnjshwbUrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="432970174" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by orsmga004.jf.intel.com with ESMTP; 23 Jul 2020 22:06:25 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H. Peter Anvin" , Andrew Morton , "Steven Rostedt (VMware)" , Mike Rapoport , Jiri Olsa Subject: [PATCH v5 4/6] arch/x86: kprobes: Use text_alloc() and text_free() Date: Fri, 24 Jul 2020 08:05:51 +0300 Message-Id: <20200724050553.1724168-5-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2E09C1808CDDC 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: Use text_alloc() and text_free() to implement alloc_insn_page() and free_insn_page(). Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Cc: Peter Zijlstra Signed-off-by: Jarkko Sakkinen Im --- arch/x86/kernel/kprobes/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index ada39ddbc922..9e57452b3a51 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -423,7 +423,7 @@ void *alloc_insn_page(void) { void *page; - page = module_alloc(PAGE_SIZE); + page = text_alloc(PAGE_SIZE); if (!page) return NULL; @@ -446,7 +446,7 @@ void *alloc_insn_page(void) /* Recover page to RW mode before releasing it */ void free_insn_page(void *page) { - module_memfree(page); + text_free(page); } static int arch_copy_kprobe(struct kprobe *p)