Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1890737ybh; Thu, 23 Jul 2020 22:06:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjzFb/lQz7XxDakkbCkxhIdB5uFTKmOWTj9Pz9l4aw9jhFlAcLx+mpIi4RWFAJe+qPSDIl X-Received: by 2002:a05:6402:3138:: with SMTP id dd24mr7462372edb.118.1595567193190; Thu, 23 Jul 2020 22:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595567193; cv=none; d=google.com; s=arc-20160816; b=cEPGuu7/VTkWHEjSvCnLesZhuHUmClQmgMai9coyLiaTvbzOoAiBZRmHzU1pNB5zYu qPiWUAE4nNUXnARm+zwu3l1rjc5T30POJ/cXePiT7NXn46e+aXFaj+2r7gUNhitRXEZH PiHQVRpf0pSOJVAhocyAqffYKgb+9IC/I4fdcyL0i1I2BMiv1aw3PsNBVxnIDsjUDOOa gLQ7pa3d0VnUjs38aGvRRcWFlLqUinCGhapS+L9JalfTkfmbyQj/KQZuPV6olFrFW2yQ pr3E//rk19tLL0IWpVLOz94+fwxOagMrrXetawLxyDmf9cVunX483qxwPeH+4MYlNXsp NZSQ== 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=zydoe9CeSNnBlzpmOksi39/Awwv5AqnrVQBf9+EbDHs1TstuGEtecA/jZVeq3qHSfY 0+S5VLMvKO+1UcqiJeeqyW9oPzqF+HswxMnIqirGm8FwovBn0+/5Xtr5A1XJzc9zVLHY WaAs8GE3qGtMepBtVStYJwG8RMasf754vvaQ4/lWme4mFnWXBif+u+ES4pi4AvJeUjWl y9F9x/6IaRkS1JNgP42n+Un5ezO2zUfLalPRe+Ig71N1mo3dk9YEZ6RLZsdNvaYSv2Ir bQH3m4t4MQVS+g/scl/jaSD7Zt7HaMSTfxsftPg4BCSuYznXcJQRsqtv17Mes/QrV5ms sMRg== 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 qq21si3326332ejb.570.2020.07.23.22.06.10; Thu, 23 Jul 2020 22:06:33 -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 S1726636AbgGXFFT (ORCPT + 99 others); Fri, 24 Jul 2020 01:05:19 -0400 Received: from mga03.intel.com ([134.134.136.65]:41004 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgGXFFS (ORCPT ); Fri, 24 Jul 2020 01:05:18 -0400 IronPort-SDR: h7T7qyBMr7Vqb84TmknVje3wHUbyMgfWYn5dlZcg0XuuIGvkQiBm7puGpQYU+rzeSqar5saUFb jm7HLl2UUDNQ== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="150645714" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="150645714" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:05:18 -0700 IronPort-SDR: qY/icntTHNX8zoRFkoNoJ9PavRZVse1JH+1/o2alo5VC1HFLRyNHZrsE1xfYPp1L/E2n4a6MXl Bw89swfNwqww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="302553101" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by orsmga002.jf.intel.com with ESMTP; 23 Jul 2020 22:05:15 -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:04:56 +0300 Message-Id: <20200724050501.1723315-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200724050501.1723315-1-jarkko.sakkinen@linux.intel.com> References: <20200724050501.1723315-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