From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED7AAC43331 for ; Tue, 2 Mar 2021 22:37:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C712264F2D for ; Tue, 2 Mar 2021 22:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2360118AbhCBWQw (ORCPT ); Tue, 2 Mar 2021 17:16:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49269 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376685AbhCBU0x (ORCPT ); Tue, 2 Mar 2021 15:26:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614716715; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AmdeilkZy5my5BaewYbWUF4KhKDlpNZDCAG43ifNAhg=; b=hPRrSBmnWa34HgpGf6PJFx8KUtOnBZY6nwkddcZkto/x+7K3EtEM7ho/PzoTzqaf4Y8ACK Bw2XQNTfO3Gz/1poptkvblwqvTmotwEYv5I0aRSnU5F87HwqCscvUWBca6nADS5O9WvOkr sKjAe2+5o53uEZjXG6xeyPXOnH9HrbE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-342-VhlCqdJ_PiOCR1Y-xeJ06A-1; Tue, 02 Mar 2021 15:25:14 -0500 X-MC-Unique: VhlCqdJ_PiOCR1Y-xeJ06A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A3C5871106; Tue, 2 Mar 2021 20:25:12 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.160]) by smtp.corp.redhat.com (Postfix) with SMTP id 466316F7EF; Tue, 2 Mar 2021 20:25:10 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 2 Mar 2021 21:25:12 +0100 (CET) Date: Tue, 2 Mar 2021 21:25:09 +0100 From: Oleg Nesterov To: Andy Lutomirski Cc: Masami Hiramatsu , Peter Zijlstra , LKML , Anil S Keshavamurthy , "David S. Miller" , X86 ML , Andrew Cooper Subject: Re: Why do kprobes and uprobes singlestep? Message-ID: <20210302202508.GA21871@redhat.com> References: <20210301165130.GA5351@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/01, Andy Lutomirski wrote: > > On Mon, Mar 1, 2021 at 8:51 AM Oleg Nesterov wrote: > > > > But I guess this has nothing to do with uprobes, they do not single-step > > in kernel mode, right? > > They single-step user code, though, and the code that makes this work > is quite ugly. Single-stepping on x86 is a mess. But this doesn't really differ from, say, gdb doing si ? OK, except uprobes have to hook DIE_DEBUG. Nevermind... > > > Uprobes seem to single-step user code for no discernable reason. > > > (They want to trap after executing an out of line instruction, AFAICT. > > > Surely INT3 or even CALL after the out-of-line insn would work as well > > > or better.) > > > > Uprobes use single-step from the very beginning, probably because this > > is the most simple and "standard" way to implement xol. > > > > And please note that CALL/JMP/etc emulation was added much later to fix the > > problems with non-canonical addresses, and this emulation it still incomplete. > > Is there something like a uprobe test suite? Afaik, no. > How maintained / Add Srikar who sent the initial implementation. I can only say that I am glad that ./scripts/get_maintainer.pl no longer mentions me ;) I did some changes (including emulation) but a) this was a long ago and b) only because I was forced^W asked to fix the numerous bugs in this code. > actively used is uprobe? I have no idea, sorry ;) Oleg.