Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp738646ybh; Sun, 12 Jul 2020 22:57:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIOXRmGPKvYNYzCGtWOUGXV6RVxVk7JU/0RPr2rTP7d+MeTJkQRxI7wg1TqQXl+D/pyCI4 X-Received: by 2002:a17:906:c002:: with SMTP id e2mr69467995ejz.244.1594619860854; Sun, 12 Jul 2020 22:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594619860; cv=none; d=google.com; s=arc-20160816; b=IiVTI3ORkYkjitqshQoZIR4v2V1rrxk0jFYZXX3wBoXDHC8mEJ+9HCVvJh40+yTRIP 9xxLdEBjjOZY+kim74quItvwOtuuug++T7d++pUSepsvP1FdV7AZqQYiH3MysFMmEWL/ zv/h1sg+TidvBM+owsY4MduOWcx3DP4fSyw3ee4YUVd5/+z8Fgw5DKqMzvqcBcW4YDmF G+VTbVhNX+lweO9MFuJRcKUJ1azRMXmWKIvyjriDttyMo7/LWpJgc1DfqfLR5E+aDYD1 K8CEFKIi2l4MFM9VH5eZzRpsYZdPlooRaMJ1FfDbyVJ5KhQK0z87utUjmMRNHydS0T7T HtxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=8daIHyWNNTzp5BRLShnGbbsodGAAQJagIsXvoG5aZdI=; b=wqdADSSfIfidrsiuG+7quSfAhQziqjafCAN8WBtu8IUb8w4HY86UL0IVNtrfKwT9mE 8cNWXywKMY3Q5IIrStq5bpIqVeN318O33AM8QQofK7uVNW/r0UZTAgilEwdknK8Rb6lo ENtKYyGeW9IGsWQmM3sdADU1ltopK9lgpZxEgdevWvAzefXpOkALlhI7m+7nMgjbjkBC z4bB96RyxcvCK6rBRQsZ3bLXJcvOi+T0vCQ1NwqhWCv+0atORh4rZMrvN0iqMc+DRE9S 0B48I5eAHMKaWCSO1YSuWh8yuxpZ00+FZWS7PKg5A+BYBGJD2jiwyWC15WBuD7ruk22I K03w== 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 d19si8821114edz.443.2020.07.12.22.57.16; Sun, 12 Jul 2020 22:57:40 -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 S1729020AbgGMF43 (ORCPT + 99 others); Mon, 13 Jul 2020 01:56:29 -0400 Received: from mga12.intel.com ([192.55.52.136]:14263 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgGMF43 (ORCPT ); Mon, 13 Jul 2020 01:56:29 -0400 IronPort-SDR: JAj2NYA/3t+Z0XuYd/cpbPdGGSIzJeaq6j/0CyjR7wa6+/QT+mmXAevyNiLPFJx8CjlqYmvovc 0fV7WOfBLDjA== X-IronPort-AV: E=McAfee;i="6000,8403,9680"; a="128136612" X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="128136612" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 22:56:29 -0700 IronPort-SDR: XlPxoJ0oZgltWaoHwtoARhIrR24Ub0qKWskkUrQJy/RfCSWb0ZhPw72wwPFS8l1I1QQqK6tHyv zyE3zbjU/j3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,346,1589266800"; d="scan'208";a="285279608" Received: from lgrunert-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.52.195]) by orsmga006.jf.intel.com with ESMTP; 12 Jul 2020 22:56:16 -0700 Date: Mon, 13 Jul 2020 08:56:14 +0300 From: Jarkko Sakkinen To: Kees Cook Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Steven Rostedt , Andrew Morton , Peter Zijlstra , "Aneesh Kumar K.V" , Will Deacon , Arnd Bergmann , Alexandre Ghiti , Masahiro Yamada , Sami Tolvanen , Peter Collingbourne , Krzysztof Kozlowski , Frederic Weisbecker , Stephen Boyd , Alexei Starovoitov , Mike Rapoport , Sean Christopherson , Jiri Olsa Subject: Re: [PATCH RFC] kprobes: Remove MODULES dependency Message-ID: <20200713055614.GF956284@linux.intel.com> References: <20200709234521.194005-1-jarkko.sakkinen@linux.intel.com> <20200710193257.4eeb19e9cd042d99cbca7f9a@kernel.org> <202007100849.9FA1E414A@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007100849.9FA1E414A@keescook> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 10, 2020 at 08:51:56AM -0700, Kees Cook wrote: > On Fri, Jul 10, 2020 at 07:32:57PM +0900, Masami Hiramatsu wrote: > > On Fri, 10 Jul 2020 02:45:19 +0300 > > Jarkko Sakkinen wrote: > > > +#ifdef CONFIG_MODULES > > > /* Lock modules while optimizing kprobes */ > > > mutex_lock(&module_mutex); > > > +#endif > > > > Hmm, can you reduce these "#ifdef CONFIG_MODULE"s ? > > > > e.g. > > > > #ifdef CONFIG_MODULES > > static void lock_modules(void) > > { > > mutex_lock(&module_mutex); > > } > > ... > > #else > > #define lock_modules() do { } while (0) > > ... > > #endif > > I prefer using "static inline" for no-op functions just because they > will maintain argument type validation by the compiler regardless of the > CONFIG state (though it doesn't really matter here since it's void). > > #else > static inline lock_modules(void) { } > #endif > > -- > Kees Cook Thanks Kees, good remark. /Jarkko