Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2921965yba; Mon, 6 May 2019 13:53:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqywFnVGAqHceGFDBT0E+M/qpb7r79K3tsH0CyLm22Q62fxDNAWKH32IRJMgY1mmYveI0/n+ X-Received: by 2002:a17:902:2827:: with SMTP id e36mr34298431plb.45.1557176013603; Mon, 06 May 2019 13:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557176013; cv=none; d=google.com; s=arc-20160816; b=HBmPZ3uMtLsUflLTLs5/b3vdndWabtLsK6zDrArBsqLqyf/omX1l0+ViL6Cj6yAgoR l0XTtYve6ieQ6dFC0u0I6gHNjuq7PNPI0hOJk/0Hgh9Oe2yPq7fNfjm7Ay5YAxruqzU+ anDMoK6+BLFUP3glaO0l4plwH0Oo/6SMV9L/PZHgyfjVpC4nJiPMPt8bqpd8/vowIyFF uqNmSzoqo8VhLt5DjMFp8aXKP2hT/LKXj8uEw46MwpeR+cmapKeuKpsbS2EG6OyGNPyK F//Sn6TB3KUMcj+ljM5hXy2y5YLyBVVNXvlLbR/JMS/ujBIGLIxILgpX/f8vxOOk/oTz bx0w== 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=7tr1nwcY+Mo7JIjJHKVLKIn3srZa+DVPkvnBKBRzf9s=; b=xKmpYU7XQYdoB/tYAI7yHYMqj8zARPuWSw4mBZ0tJ1y9IHohmAEi9skmWhpmQoepfm mGrJzgKfbwR7GMKg4JIHgRMmDKK/1LI+esr2g+e1gaBX/BRuE17r2wVh6PJ79NvxZ9xS qx/MsMaWVW8++eQy7Mb2rlN3N9eroSxhpLC5Cz3xMhkEsXyMsa/XN3p3nFWIImsI/1FD ORVY2XtJlPDk80xo2QcnrUVnmVBHXtIKLP29fW3Dpuik4S4pTsjbMXmjYZtZTiHEDYaD Q3UJSbxe/OHJPsw1JPPNPuw3OxPiqJpKfaeRPK7Gz/StveF5PwKxIvtZuBLwbL880N7f Ga9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Wx0wBv+M; 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 q142si16523810pfq.175.2019.05.06.13.53.17; Mon, 06 May 2019 13:53:33 -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=Wx0wBv+M; 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 S1726538AbfEFUvi (ORCPT + 99 others); Mon, 6 May 2019 16:51:38 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37553 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbfEFUvi (ORCPT ); Mon, 6 May 2019 16:51:38 -0400 Received: by mail-lj1-f194.google.com with SMTP id 132so4597932ljj.4 for ; Mon, 06 May 2019 13:51: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=7tr1nwcY+Mo7JIjJHKVLKIn3srZa+DVPkvnBKBRzf9s=; b=Wx0wBv+MylrKm2tMM2EjzWS61fm9xNahf5H0jqXMieHoP7JIkuDeMOtkWoWb3N/RXa zTBuN8pbi5tRyMSpWlaexirS081WZT8udlBXEwXx+fqFNsgl6F0LP8y/LHZSEjMdt26D KO9SQD+Phs5cXpErrLaOl8w3aKdvsA9v+duGc= 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=7tr1nwcY+Mo7JIjJHKVLKIn3srZa+DVPkvnBKBRzf9s=; b=ozjpt7KHIInWH5BY8MSpd0mtTHi8jk4C28PLYQ2iD4TQf22ZxcJOhYNx2QsQDUaA5C xcRkROr6SDELH0ciDEFpHsPI2aaHxT1tUMtpcJ5a4hU0NSJ7UpVplgyiA/Vj1RuXDbkL D9HO8i8IODlRuNNVS6aZi/iHBfhTpD27fylAflt5Jpcz1L8M25WdNY0W+ifcPRBrvKbd afLD81iSqCftjxOgJa8IKiVrZSZQj5pSrE+xEG0EMJGDKGFyVwlCLVDeDA6WCkNoi8Ms YYLYwjfAV6aBxV/YDPWikhpnicPbBsa5CgxQ5XZk0hBDuJhyDMSoYzGpxEK1odBUyQmY Rp9Q== X-Gm-Message-State: APjAAAXj+cZg1pQzgubcPl/WRh2T1muChaBLG9SOaiSmTEmZbPwV17pu ukqTUAfHv1DG7oRx59Qjo96vzl33TIo= X-Received: by 2002:a2e:8602:: with SMTP id a2mr7832363lji.21.1557175896244; Mon, 06 May 2019 13:51:36 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id o68sm120151lfe.86.2019.05.06.13.51.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2019 13:51:36 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id h21so12282424ljk.13 for ; Mon, 06 May 2019 13:51:35 -0700 (PDT) X-Received: by 2002:a2e:801a:: with SMTP id j26mr5517472ljg.2.1557175508545; Mon, 06 May 2019 13:45:08 -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> <20190506130643.62c35eeb@gandalf.local.home> <20190506145745.17c59596@gandalf.local.home> <20190506162915.380993f9@gandalf.local.home> In-Reply-To: From: Linus Torvalds Date: Mon, 6 May 2019 13:44:52 -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 1:42 PM Linus Torvalds wrote: > > What *can* make sense is "Oh, I'm emulating a call, but I know that > call will be rewritten, so let me emulate the call and then > short-circuit the emulation immediately". That made no sense. The end should have been "and then short-circuit the _rewriting_ immediately" of course. The "emulate a call" is just to make the "struct pt_regs" state look like it would have after the call. The "short circuit the rewriting" part is the thing that then rewrites the actual instruction based on that pt_regs state. Linus