Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2646809yba; Mon, 6 May 2019 09:19:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYOASgRc8BAI9wdmoVZCdVLKu5kATg/hQ1m/Jo2bb/Lep4xW7RMRzfrBf0qZPo1qMmwaGk X-Received: by 2002:a63:7:: with SMTP id 7mr33727536pga.108.1557159548952; Mon, 06 May 2019 09:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557159548; cv=none; d=google.com; s=arc-20160816; b=hk1c2zTYtL5xfb3FZBSLIrLyPI23WfsUFVqQEozU2gTGys7PKRjaXCX2aj1T4x+AXZ aa3q4IAOlHlW11GDaTksOv8KzhLalNKXt9M3b4PCgUl2LQ1VelSIau+D49JDkNcsOJG0 J2KnGI6qnmWv9qtYEzqBC67nfWAVrTdyfCOA8sWmaNNAMEXGjTq5/JU4VPnir8bqaaeK qFT0Jxkq5VjYBpqyjKv16jWM5sJ6i6JxFOssNWRs/O6xnUSArSrSRAsSlKlI2Rh6RR2r tivcsNBG2LR8C/ZSHcO8lPGMZVxrDIpLDjlVO4t6vPKe7uFurafHqm6vDtu8r6XGM1kO /CoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gdKWMzG0jTPJKQefPY2Ldaf6Ms3KDojiEWREzp6GY/0=; b=owHk6OmhtAqRvyRPucwHQuBWm5F4t01MWt3CO0AmBgZm5Pc04vJiSn6RA54SVaa1PU 71BNNG//eD7YW+lB91Wf6Z+zikwxOt+aDZVl+J/G84Q98tLltgKiH59dKLi9eiNs+QpT Gurg/KRhUZ5yFSfip2YQ/r+NdYbuoDBa5hw8jFCA0TMo7rE7qD3G/bBlfhnNcaSECbP7 Tdnxlxbd5rTleQqzxD6iskGTeFaQcY93bgGu2GGfuTCeXGDBfc459HF318NUz9pl+5ZM rXIo4KdGcAEO1gbNrMhqEcw2MxocWP5PFGqMBVvTRVEMD0K5c4lAtjJrdQfpUtMO7m8x K3kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="acUkx/Sy"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si15360942pgs.37.2019.05.06.09.18.52; Mon, 06 May 2019 09:19:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="acUkx/Sy"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbfEFQRk (ORCPT + 99 others); Mon, 6 May 2019 12:17:40 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:35519 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbfEFQRj (ORCPT ); Mon, 6 May 2019 12:17:39 -0400 Received: by mail-lf1-f68.google.com with SMTP id j20so9603424lfh.2 for ; Mon, 06 May 2019 09:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gdKWMzG0jTPJKQefPY2Ldaf6Ms3KDojiEWREzp6GY/0=; b=acUkx/SyXE0iTsaLBqBApazjPIDAcpKLa6eanB/pwg3/nd2wX7zX61gfnOb7YkZ3Ll QSKrbp97fW9PaMvvakbU30HZC6d9E8ZxMJWyn8rtqBZLvZSLIjhpYOKX3sVWKA+T51pr jCo9GXVhBGPddoOghrCGtgtxD8b+3ePfN7F28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gdKWMzG0jTPJKQefPY2Ldaf6Ms3KDojiEWREzp6GY/0=; b=GTNrUUJnTi3H3RA0k4Lj6/degxMQ/TRZ3WB47CvWVMWMV83ZLj6+RuspiSDuHNRyFV M16WtjC83CHVY25PLgqCStcCbru7tg+rqK4XaYe7lz6tNRDm9GMN2GvVc9ZhbKuVkOV5 05U9LRtBssciGiz7C9WAdIREqPURwsrXgAUs07hyFQ7qgZwqqGNeTCQQgG5G17yHoGzH AIoDHD+XHv7Ij8RfgIPkNwYdEI+95gXzY8AXVppNuEozFYL0jhLW7/US/ATKLQFy/FKs uHRMU6RfALVBPQ1zEaTHt9QR9bZiMDc4QbMdt5F/hal1+nsrgJjmRgZ3yimuEdovXNWW kDXw== X-Gm-Message-State: APjAAAVNb8SMwLmQ/OkFK/2bSnPT0CixPrUXKNO/u9ePme5RaWXXSUj/ kWkHOjAVrcGLjhgHpP4XbcrddTC1Iuo= X-Received: by 2002:a19:96:: with SMTP id 144mr11189347lfa.29.1557159457137; Mon, 06 May 2019 09:17:37 -0700 (PDT) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id n9sm2552533lfl.35.2019.05.06.09.17.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 09:17:36 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id j20so9603366lfh.2 for ; Mon, 06 May 2019 09:17:35 -0700 (PDT) X-Received: by 2002:a19:ec07:: with SMTP id b7mr7420419lfa.62.1557159455483; Mon, 06 May 2019 09:17:35 -0700 (PDT) MIME-Version: 1.0 References: <20190502181811.GY2623@hirez.programming.kicks-ass.net> <20190502202146.GZ2623@hirez.programming.kicks-ass.net> <20190502185225.0cdfc8bc@gandalf.local.home> <20190502193129.664c5b2e@gandalf.local.home> <20190502195052.0af473cf@gandalf.local.home> <20190503092959.GB2623@hirez.programming.kicks-ass.net> <20190503092247.20cc1ff0@gandalf.local.home> <2045370D-38D8-406C-9E94-C1D483E232C9@amacapital.net> <20190506081951.GJ2606@hirez.programming.kicks-ass.net> <20190506095631.6f71ad7c@gandalf.local.home> In-Reply-To: <20190506095631.6f71ad7c@gandalf.local.home> From: Linus Torvalds Date: Mon, 6 May 2019 09:17:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH 1/2] x86: Allow breakpoints to emulate call functions To: Steven Rostedt Cc: Peter Zijlstra , Andy Lutomirski , Linux List Kernel Mailing , Ingo Molnar , Andrew Morton , Andy Lutomirski , Nicolai Stange , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Joerg Roedel , "open list:KERNEL SELFTEST FRAMEWORK" , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 6, 2019 at 6:56 AM Steven Rostedt wrote: > > I can test this too. I was hoping to get this in by this merge window. > I spent 3 hours yesterday trying to get Linus's version working on > i386 with no success. Not sure how much time Linus will have to look at > this, as he just opened the merge window. I acvtually just tested it in qemu, and it worked fine. Ok, so my test was admittedly really simple and stupid, in that al I did was printk("Before int3\n"); asm("int3; nop; nop; nop; nop" : : :"ax","dx","cx"); printk("After int3\n"); and then I hacked up do_kernel_int3() to just unconditionally do return int3_emulate_call(regs, (unsigned long)test_int3); with a stupid test-function: void test_int3(void) { printk("In int3 handler"); } instead fo anything fancy. But it did exactly the expected thing, and resulted in Before int3 In int3 handler After int3 on the screen. So what is it that doesn't actually work? I've looked at the patch even more, and I can't for the life of me see how it wouldn't work. Of course, I didn't test any of the actual ftrace parts, since I short-circuited them intentionally with the above test function hack. I have no idea what the semantics for those ftrace_location(ip)/is_ftrace_caller(ip) cases are supposed to be, I only tested that yes, the infrastructure clearly emulates a call instruction. Linus