Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp778414yba; Sat, 4 May 2019 12:38:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzd2FQ4LMZqB0UDrzICSCk7uhSIDTmPDASi+K2iW3ZCkV85NSAqqW/n2reicayQQHhApGx9 X-Received: by 2002:a63:cc0a:: with SMTP id x10mr20931462pgf.179.1556998683764; Sat, 04 May 2019 12:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556998683; cv=none; d=google.com; s=arc-20160816; b=Qc1/Wrue72Vhp3evGSzal1V2fYIO6Zj9CcBX7KTw1J4DQSuKMflAg3oZcOdXYaiED5 Ki+zXOvnE4nTVaA6zohhrg+5H5ZDRzJ28M16zXBv42DBt58tAz0K+ZUoTg/EjZj2VMh4 gdEAZZt3y8JiBtEGXDf3Ho4M1Z+v8IlR028l6r86j+2PsND6lCxllMYIooMEdYICI+9q aXqR7ExErxiiGtqOZZDoBHbElFuPbw2iWiRT+1sT0nyOT+aG9vOy/Tw+C/3JVh+Jx49v WNLNqJ64V5A7MbeNvBO5EUvEWEvd+jN0FKCqmP0UBO0chaniYhiupI/ZHUXXs8izGJtN UxBw== 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=UPXn/suOTC4KtkcdUL+Y23TPj9fvnn464w7bphB09yc=; b=T2N6IotccmUWLfx2J5Tt3nchc5HcgWiaDPHkg1rXozLogBkUtzgGHu6ipZ/Ry8Ec8X ASgbeoN1qbKcJ5O/JXqzjknmPQKBh3AKvFnt94KsBrLOO7j/0RR1QUz3x9zznDwjxpQG QSXeb6Ib+JLPsCmkdJfO5qfbBADiTLFAzWhfGVoZiHh9j1AjAFB/Akjxiwzvq0jH8pdW TdQwFk6SJV6ZkkFEiOM03EPd4DKW1xogJWmhQg2YbBV75M2bdCJ2mVL0PEtkWczTdoT5 7LkMdBgTsib5eibcrponb3ytE6yHIjaINtrkXOY57iwkQ3b6M3Dkf1kIYLtwWA4ONp0T 1d1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=BGm1JgIv; 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 b8si8207514pfd.55.2019.05.04.12.37.47; Sat, 04 May 2019 12:38:03 -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=BGm1JgIv; 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 S1727254AbfEDTAF (ORCPT + 99 others); Sat, 4 May 2019 15:00:05 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44585 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbfEDTAF (ORCPT ); Sat, 4 May 2019 15:00:05 -0400 Received: by mail-lf1-f68.google.com with SMTP id n134so4716445lfn.11 for ; Sat, 04 May 2019 12:00:03 -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=UPXn/suOTC4KtkcdUL+Y23TPj9fvnn464w7bphB09yc=; b=BGm1JgIvnO4XjmvpkE5zlrsXU0oaY9ixUidNFsf4EYolQ1p0zn1hNJrlziX2N0nsOR B38UDlHgMyzVeEBsrOKhLaspPY/ucJmctT6kYtDXOsUpvos75jtWaAA3Q6Ybjr217dM8 0aD7sAeIC+OooQUiWMb7P7Iz3mIs9w+GyypC4= 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=UPXn/suOTC4KtkcdUL+Y23TPj9fvnn464w7bphB09yc=; b=L9kSZnHWddPWyImLcWGbcSxxpzFSeSCeFa8gJDJnuSvU451BdGr2gkyF9vY/yLYfph lY+nGbLFSlEAADS2q2cImfUjn03pVUgZfg/HdLaLQMjWwNsK6KFHe7myM7H2f2cQ4e1L S/xEvgPWvwouNoBze7z+kuF0edDu3uAjSvUdStzQjQdtbgri5YE4I8muBpknQZ608HWI MlgjPaec4LYq+G36Ljkb/3Uc7V+PR6Xrl1MnQeJaj+y+Xqobt2+c6xjdi3tLmtxgA1WS +mXsl5xgyV0SYwMvo/WwuLAaU97O8veRwDSwhu2c4lLseAhhB+OLfzQluzSU4Q1KBwu0 io5w== X-Gm-Message-State: APjAAAVwz3xCV6TOaVY4zUpCvlbsxth4VurYNrDrByKuBOSBrjYNBVY5 LtCSwmG3zj04AS4gM3fFVsjQHuJrIOM= X-Received: by 2002:a19:4acf:: with SMTP id x198mr8533137lfa.7.1556996402208; Sat, 04 May 2019 12:00:02 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id v22sm1033552lje.44.2019.05.04.11.59.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 May 2019 11:59:58 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id h126so6538870lfh.4 for ; Sat, 04 May 2019 11:59:58 -0700 (PDT) X-Received: by 2002:ac2:547a:: with SMTP id e26mr8464749lfn.148.1556996397689; Sat, 04 May 2019 11:59:57 -0700 (PDT) MIME-Version: 1.0 References: <20190501202830.347656894@goodmis.org> <20190501203152.397154664@goodmis.org> <20190501232412.1196ef18@oasis.local.home> <20190502162133.GX2623@hirez.programming.kicks-ass.net> <20190502181811.GY2623@hirez.programming.kicks-ass.net> <20190502202146.GZ2623@hirez.programming.kicks-ass.net> <20190503152405.2d741af8@gandalf.local.home> <20190503184919.2b7ef242@gandalf.local.home> <20190504001756.17fad840@oasis.local.home> In-Reply-To: From: Linus Torvalds Date: Sat, 4 May 2019 11:59:41 -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 , 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: multipart/mixed; boundary="00000000000033a78605881479d1" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000033a78605881479d1 Content-Type: text/plain; charset="UTF-8" On Fri, May 3, 2019 at 10:08 PM Linus Torvalds wrote: > > I'll look at it tomorrow, but I think this actually makes unnecessary changes. > > In particular, I think we could keep the existing entry code almost unchanged with this whole approach. So here's what I *think* should work. Note that I also removed your test-case code, because it really didn't have a chance in hell of working. Doing that int3_emulate_call(regs, (unsigned long)&int3_magic); inside of int3_exception_notify() could not possibly be valid, since int3_emulate_call() returns the new pt_regs that need to be used, and throwing it away is clearly wrong. So you can't use a register_die_notifier() to try to intercept the 'int3' error and then do it manually, it needs to be done by the ftrace_int3_handler() code that actually returns the new regs, and where do_kernel_int3() will then return it to the low-level handler. End result: I haven't actually tested this code, but I've looked through the patch something like ten times without finding any new errors. I've also tried *very* hard to make the patch minimal, with the exception of the comments, which I tried to make extensive for any of the subtle cases. But without testing, it's probably still buggy. I have to say, I finally like the end result here. Maybe it's because I got to make my mark and pee in the snow, but I will say that (a) the actual entry code modifications really are minimal now (b) the instruction emulation really is very simple and straightforward (c) yes, we play some stack tricks (and yes, we play them differently on x86-64 and x86-32), but the tricks are again at least straightforward, and we never really change the layout of any stack. So on the whole, I think this is about as good as it gets. Did I get all the details actually right, and it _works_? I guess we'll see. Linus --00000000000033a78605881479d1 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jv9vfsff0 IGFyY2gveDg2L2VudHJ5L2VudHJ5XzMyLlMgICAgICAgICAgICB8ICA3ICsrKy0KIGFyY2gveDg2 L2VudHJ5L2VudHJ5XzY0LlMgICAgICAgICAgICB8IDE0ICsrKysrKy0tCiBhcmNoL3g4Ni9pbmNs dWRlL2FzbS9mdHJhY2UuaCAgICAgICAgfCAgMiArLQogYXJjaC94ODYvaW5jbHVkZS9hc20vdGV4 dC1wYXRjaGluZy5oIHwgNjIgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiBh cmNoL3g4Ni9rZXJuZWwvZnRyYWNlLmMgICAgICAgICAgICAgfCAyOSArKysrKysrKysrKysrKy0t LQogYXJjaC94ODYva2VybmVsL3RyYXBzLmMgICAgICAgICAgICAgIHwgMTUgKysrKysrLS0tCiA2 IGZpbGVzIGNoYW5nZWQsIDExNiBpbnNlcnRpb25zKCspLCAxMyBkZWxldGlvbnMoLSkKCmRpZmYg LS1naXQgYS9hcmNoL3g4Ni9lbnRyeS9lbnRyeV8zMi5TIGIvYXJjaC94ODYvZW50cnkvZW50cnlf MzIuUwppbmRleCBkMzA5ZjMwY2Y3YWYuLjEzOGFjNDMyMjIxYiAxMDA2NDQKLS0tIGEvYXJjaC94 ODYvZW50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