Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp437557ybt; Fri, 10 Jul 2020 03:53:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl9LipdBNU9U7Bwqs9b+REgFoYRjIjZP7MsRgsPH6AJqbQ/Ja6rx84Lmj6an8lFGQpcT/w X-Received: by 2002:a50:ee8a:: with SMTP id f10mr56770333edr.383.1594378395312; Fri, 10 Jul 2020 03:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594378395; cv=none; d=google.com; s=arc-20160816; b=q1S5PxAqxi7aexj1o/5kbBjCsBLd320YWkpTxfmCIdVnZBVXtI8AoGag+DltWJmrLb JeFqJJZcdLYxh9QBk1lbxz0Htclh/JzK6nhpn/ZvRQkfv1WAhSdh+mLhfiOpVGTF32kO Ss4DM+/nVFgXGD6Qw9IAMtbcW5b5MS2yLfv2EYSU6ZfxIfIYEwUV6k3l2Cgd7wr+zBo/ JmeOWeMjBRCKGNamy9CkmFgZdb7oj2YfQwK+i6kMam4Q+VHjCuifo4/9ENp+SB5kKHEX uiY388qU+O5FPpF20rVWxRatbytMjmqz/NZ/8f6lry+OBYJaTAXyoiJE8Zeef+Z+HsSH LIlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AxVVCQeeOzIrbDpXQzQLviQKPDCJ2J00omBMDFGGswA=; b=Yi4lA+Sba8Ei8HBwl0jSz3PjkgyncGDQTa6+VlPXdW6KaUY1cbq/Y0bpF/SDQR/qvX 7sqJmTGzrsjwMqHV2gmChDf/+gYGCnwnF+6ydJ0nWLumRKHxzR23+K1YTKuIM4/qAogr NX/0qKvhomqoBK0nJBcgOLytNvgIQJ1+avehiH9jip6M4fpAnUCmRl7pNDaR+X8umBZs B2S3b5EZEnkDafO3jtJp9im31qDxabTswcKrTfx8649K3tGtWS+ETly5O+Dax5rmG0N/ eBgaDZhuE8nnlySBFqpBg4h3qR+eg+64hsdfvG/LlepGfNNu/oJR9/ETkIYHhWVyvGzt dLAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=nScvOLV2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq3si4024357edb.486.2020.07.10.03.52.51; Fri, 10 Jul 2020 03:53:15 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=nScvOLV2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726880AbgGJKtn (ORCPT + 99 others); Fri, 10 Jul 2020 06:49:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgGJKtm (ORCPT ); Fri, 10 Jul 2020 06:49:42 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88FBEC08C5CE for ; Fri, 10 Jul 2020 03:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AxVVCQeeOzIrbDpXQzQLviQKPDCJ2J00omBMDFGGswA=; b=nScvOLV2wKB/e07W1eR8zN31B+ sIw1iq3WWW2WdZmC6cnHsjTYL8yYk7Jc5yg9xqiG3XF8axzK+SjlXhcZsMIt16vdpeYbYJ472IPNq jTbZmbZe6K2iNxrwb4CpkZ/lFddq3HqhexM11q1O6meST/E2YlduPJBFaP3AuBePqzAyYcluSASNo yBMMao1Uh/UiNpPsP9V03KxIgzu98Ki2ETwV127tvN7KO/+wrVr/NtO3FtAulAtTE/UUngqGPHh/P x9ACcuip1oCfrPOvisqY5vxLxxixqWMlbRa7SToliZPQ9NYZLJQqgyIIYVsvG3to3N2MSSkhDj3dq mcQRqXyg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtqae-0001YG-P0; Fri, 10 Jul 2020 10:49:12 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id C4FAA3059C6; Fri, 10 Jul 2020 12:49:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AAA8820A2955A; Fri, 10 Jul 2020 12:49:10 +0200 (CEST) Date: Fri, 10 Jul 2020 12:49:10 +0200 From: Peter Zijlstra To: Jarkko Sakkinen Cc: 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" , Masami Hiramatsu , Steven Rostedt , Andrew Morton , "Aneesh Kumar K.V" , Will Deacon , Kees Cook , 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: <20200710104910.GG4800@hirez.programming.kicks-ass.net> References: <20200709234521.194005-1-jarkko.sakkinen@linux.intel.com> <20200710090344.GX4800@hirez.programming.kicks-ass.net> <20200710103638.GA2614@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200710103638.GA2614@linux.intel.com> 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 01:36:38PM +0300, Jarkko Sakkinen wrote: > Just so that I know (and learn), what did exactly disable optprobes? So regular, old-skool style kprobe is: - copy original instruction out - replace instruction with breakpoint (int3 on x86) - have exception handler return to the copied instruction with single-step on - have single step exception handler return to the original instruction stream which is 2 exceptions. optprobes avoid the single-step by not only writing a single instruction, but additionally placing a JMP instruction behind it such that it will automagically continue in the original instruction stream. This brings the requirement that the copied instruction is placed within the JMP displacement of the regular kernel text (s32 on x86). module_alloc() ensures the memory provided is within that range.