Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1891000ybh; Thu, 23 Jul 2020 22:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzybTOK3BCANao9gVkdOD8CLBgupYKvp9xvFd4sOCzhVe2D/uP3baRoH+GIeipiRpiMl/r X-Received: by 2002:a50:e8c8:: with SMTP id l8mr7611868edn.386.1595567219627; Thu, 23 Jul 2020 22:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595567219; cv=none; d=google.com; s=arc-20160816; b=BOWpFA491Mo19I1jCsVMs433wrqB/gzbDJ/r+5t1gu1jUEv+uTjgmHwx9kWpOm8MhF 1LKNBHdWY0Htrt9Fmp6zx0QnaX2yb9iHA2jX/bLt7RwOcgFnEPr0j8pcddHOrTIaVa7p OfjqmQ8cfZknFG7Z/+0filqwXdD/aE572cEbhH9jWUGXPDmaYp9Aj1buhgWygHwVjcCi 63akM1m0nfX5RGqdhGg/hPtGChUct4RC0C8YDPFHMQk8B7dCdaTIvgnDZF6SFbb4QXFw OrLhsCq6GneEYeRo+uztz48nY1P02bUFcG/G4rs0NQ0HfpC33oRYp8FUUSHpFrBXBxP3 DGKw== 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 :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=fploXIef/AQRES7ynH5nTF/G7AoEct0i0IiTWdgij6M=; b=GZ86LyB48HdbDGUnkVW7I1n3oZRg6hlJqOBiU6DDzzHdtuIngJD4p5Ybq8JmEPNB0q /is3Ey/gKFTyR8cmHYdoKwZUx7s3qAU+Ld0s0fW3g1mgr1n3bGlFGDHHoAWhLXoHW4ak T2faQqoIrSVhzuHiaRki0yJr49DLuLa5X7SKWj4VqLQjVqwkGqpjS0wE99KC9c7Yv0HT ZNgJX1hOUspil4suEt2MHwIYcDXDiw9DB20PQHPfhHbBfZ6ZreXV0OY5b5q+IS6WDwPF y7nlymqvv2F5Q43jRFuOiimyv4A/Gv/aVHwMr4Dq9+rAiAYnOSYGv3QfpmL2Fnv0tK/L pUIQ== 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 w10si3695373ejv.259.2020.07.23.22.06.37; Thu, 23 Jul 2020 22:06:59 -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 S1726719AbgGXFF6 (ORCPT + 99 others); Fri, 24 Jul 2020 01:05:58 -0400 Received: from mga14.intel.com ([192.55.52.115]:1886 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgGXFF6 (ORCPT ); Fri, 24 Jul 2020 01:05:58 -0400 IronPort-SDR: 5O5THgPvS3uERbwRkiLXXLn28Hug3q8kQsYCKcmDqnzVZZ/rlXypPb2llv1v8ZCQBy2zTrLrzr +t5pnkfd2GwA== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="149850586" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="149850586" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:05:57 -0700 IronPort-SDR: ZBWC5rV1mTr/ZUnRTae3bWgA+q6XNfXQSs2SASPa/4e9DqadwPwI9ePGMQI9LbKbG9RxjNI2IV NIWFG1lBH0rg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="302553377" 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:55 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra Subject: [PATCH v5 0/6] arch/x86: kprobes: Remove MODULES dependency Date: Fri, 24 Jul 2020 08:05:47 +0300 Message-Id: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 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 Remove MODULES dependency by migrating from module_alloc() to the new text_alloc() API. Essentially these changes provide preliminaries for allowing to compile a static kernel with a proper tracing support. The same API can be used later on in other sites that allocate space for trampolines, and trivially scaled to other arch's. An arch can inform with CONFIG_ARCH_HAS_TEXT_ALLOC that it's providing implementation for text_alloc(). Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Cc: Peter Zijlstra v4: * Squash lock_modules() patches into one. * Remove fallback versions of text_alloc() and text_free(). Instead, use ARCH_HAS_TEXT_ALLOC at site when required. * Use lockdep_assert_irqs_enabled() in text_free() instead of WARN_ON(in_interrupt()). v3: * Make text_alloc() API disjoint. * Remove all the possible extra clutter not absolutely required and split into more logical pieces. Jarkko Sakkinen (6): kprobes: Remove dependency to the module_mutex vmalloc: Add text_alloc() and text_free() arch/x86: Implement text_alloc() and text_free() arch/x86: kprobes: Use text_alloc() and text_free() kprobes: Use text_alloc() and text_free() kprobes: Remove CONFIG_MODULES dependency arch/Kconfig | 2 +- arch/x86/Kconfig | 3 ++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/kprobes/core.c | 4 +-- arch/x86/kernel/text_alloc.c | 41 +++++++++++++++++++++++ include/linux/module.h | 32 ++++++++++++++---- include/linux/vmalloc.h | 17 ++++++++++ kernel/kprobes.c | 61 +++++++++++++++++++++++----------- kernel/trace/trace_kprobe.c | 20 ++++++++--- 9 files changed, 147 insertions(+), 34 deletions(-) create mode 100644 arch/x86/kernel/text_alloc.c -- 2.25.1