Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1891293ybh; Thu, 23 Jul 2020 22:07:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8lDLnV2ypC6ed1AU/0iOYGzQepgXGdTJnrr/jJqjV/9NiY5rxWiTCLaKe8G9R67c16ND6 X-Received: by 2002:a17:906:1187:: with SMTP id n7mr7292822eja.161.1595567251464; Thu, 23 Jul 2020 22:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595567251; cv=none; d=google.com; s=arc-20160816; b=l9zWUtOLmQ2RPA7TBGWUc4L0RIKaM9tRzSK3OC6cFkc0zPlRT37hPAAKvSWjk30qv7 NQ4mjJjbyLauw46gJP87MM0qEo8KLcMWCDofwz9dlcKNU1YcWhf+x0IPxny4pNFHtVkJ wi4ZGJwMBdpovIT6xnZngS9U89reZRZHr6vWic9R222vhrDKIJjduz0rzwz1RsT/M3oe 7Wu5dPb+p4iZ+eDNI+S5p0eoCpoKi2UkJVjKnOePyviON8XQu3P0/Ey0T/MylXbG46oG q5HRkk9WYiFSASXc1s1jvR1jvdFSJqAtnU02ChtVU4tPQh4sdPmJj/031rC9hKPE/F7s Qfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=SNftQxWRmUvh5GKfPcvDtkfyIqr9OVXtWezu9vgfHV4=; b=Biq2u3AVw9o2ExqwbvSuGtjgnmChQ9lrlt/cHkDIYel10OwSuw33MsktPzWBHKEy/Z LfkmZdH+9E2HR4Rg8r7NlwOr+VoN1ottZnutazUTjaouGoop0QFzxKxLH91v1rUEVjT8 tJfccWS7ktsTB10+ZCKaftnJh6n3ed885yTOiagIo9gjsskfejwe5F76Kt6IbUPGlLSn wzv84wO6BfWeS0dycpl2Vymj3m2loT6fLm34qFPYR0S2sH0FLkRtFGBskDjnH+CVhAsw 0EhCwBgc0KBLsbxeMHzdSG5/pne8WfV6VASQs/uD8S2lkx/nO1dbG9iyAUtHJQoM7MMl tyjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si3937818ejc.417.2020.07.23.22.07.09; Thu, 23 Jul 2020 22:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbgGXFGK (ORCPT + 99 others); Fri, 24 Jul 2020 01:06:10 -0400 Received: from mga11.intel.com ([192.55.52.93]:31507 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgGXFGK (ORCPT ); Fri, 24 Jul 2020 01:06:10 -0400 IronPort-SDR: Emy5Vzi3rtI7JzrijeW5qOgBSrQHg1WJXEZtwS7UTIVVgco4qUOJPwJ7onZaXSQpHdRCAH4I8l 18JQ8mMaV/1w== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="148578016" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="148578016" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:06:10 -0700 IronPort-SDR: d4ms3xYCS47v748dTz8/hUkyD8ft8SyA2gI/KqU1nQ7NJMZNfTmvRlE4ns0yuPSbBWE/XDs919 NjVEtUrPPhZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="288879310" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by orsmga006.jf.intel.com with ESMTP; 23 Jul 2020 22:06:07 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , Andrew Morton Subject: [PATCH v5 2/6] vmalloc: Add text_alloc() and text_free() Date: Fri, 24 Jul 2020 08:05:49 +0300 Message-Id: <20200724050553.1724168-3-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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce functions for allocating memory for dynamic trampolines, such as kprobes. An arch can promote the availability of these functions with CONFIG_ARCH_HAS_TEXT_ALLOC. Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Suggested-by: Peter Zijlstra Signed-off-by: Jarkko Sakkinen --- include/linux/vmalloc.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 0221f852a7e1..6c151a0ac02a 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -249,4 +249,21 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) int register_vmap_purge_notifier(struct notifier_block *nb); int unregister_vmap_purge_notifier(struct notifier_block *nb); +/* + * These functions can be optionally implemented by an arch in order to + * provide specialized functions for allocating trampoline code. + */ + +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC +/* + * Allocate memory to be used for trampoline code. + */ +void *text_alloc(unsigned long size); + +/* + * Free memory returned from text_alloc(). + */ +void text_free(void *region); +#endif /* CONFIG_ARCH_HAS_TEXT_ALLOC */ + #endif /* _LINUX_VMALLOC_H */ -- 2.25.1