Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3847949yba; Tue, 7 May 2019 08:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+YXp7cNR0I3WwVyiCmRYjW7Z2sLFRnjARFZ5S+9O76RuHtoi395DFJlNgn7jMHvwqB6cp X-Received: by 2002:a63:e048:: with SMTP id n8mr40074338pgj.41.1557241314219; Tue, 07 May 2019 08:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557241314; cv=none; d=google.com; s=arc-20160816; b=KN0+eIDqW+Goqf0MrLhQhjtYFVPF3qPpVyPVuqi4+GkRfyG/le+mce4AXLDujnyJjZ QsXABEGNFjPkpRK2ZlecIJODdttA1vSPkvGDH48H17vRGMppUe2rzILhZJZxsmMGkgcp HxlcVCPSZHDhRBke9oCoz5CuYHPS9bRQm4MM3X9pov73tiQ8+tqNPpmO8yUJNBDr6516 1sbpwT92sZNx808T2/MepU5z6l0MtB/iA5gOSy8/UscqOLFY7aUPEC3Dl4QKAJ12uo7q gw86m6NVTm7qjXkqqHLlM+0l0F/eSlldXhollHTNPk30jvEuosclbmYo0ngtM680I91J ugxA== 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=HEUButXGYFVvFjpkXgb4/5PcKUQjhj5t+A6A255naXM=; b=GgpPIs6OWTKxp5mURNARlKLFYzmSddwkqv/I9t27Qf+CxMqokSJUt/pfCw2SDHTfxw i+BPYFFT9wvRa+M++SJD17Rpo3Aqkv7JacXk8QhSAcDeNEb0z0F3MWlvYp0RlnpgahFK bCE3rm0QoMcH/enO1wIW21gssQvzyG0J1itfRYguuQJdZ6pP8afA86DBbPHngafdOxN8 YTmFRRNMdNs03ZCV1nMPBOV+7P7isVsUoSObF0bQfRklT1Bz8bpsPIZ27pEUatlqHuH3 YPPaWd30HqVoYa1WFnHoAQLrB5ZfF201pkH+4lcTvIC5QoITMHYZwX3OiNf7tKWFdYze 68Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SPvalmn1; 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 v11si13821688pgi.568.2019.05.07.08.01.33; Tue, 07 May 2019 08:01:54 -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=SPvalmn1; 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 S1726557AbfEGPAY (ORCPT + 99 others); Tue, 7 May 2019 11:00:24 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:38573 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbfEGPAX (ORCPT ); Tue, 7 May 2019 11:00:23 -0400 Received: by mail-lj1-f195.google.com with SMTP id u21so5509933lja.5 for ; Tue, 07 May 2019 08:00:21 -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=HEUButXGYFVvFjpkXgb4/5PcKUQjhj5t+A6A255naXM=; b=SPvalmn1mJUtfVy8JtgZzBBvp3YDobRGwTxABByzT0PwuHwBEFzDpFBXlRo2/Adgd2 xD8bpdM9pB1NchIVVO9koZvHZYxclmqDdyWhQiim3xKQmS+Os1JAkWejbhQY8GpDqfsv Z8yC04mBtT7l9cfk29WDwsg9QinXmoRqg5hC0= 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=HEUButXGYFVvFjpkXgb4/5PcKUQjhj5t+A6A255naXM=; b=sd6FBf+w0FB0tplepmnFJSCbuojJM4abOFMf+VhB1uieVxL+3ZUD8+yUA13af8lGq/ K4Z97qbc0oVu9kFEKTMCp25eKI0aqd1P6hkkBRsy5uNiTjwTZPBLYeB8LW8gkg5sxR7r yuVd9U8+7EBiohF410I1OZuucynGiyHdxOQmPh44WHH1O2IC6Ub78hAcrWG14ei/FlW9 5G7+FF5jJICMa8p48zq4TXTim72GwvJgcHvks+4KWvbi/ZRFMhj5lBSZx5VCKQp44d/Z dzVV9uHBbBqDm0w92UsS6CRm0nUkAKjWE6bT1haF8Tlwx/8Zw2YHu1qIlaKquC5/hUAV ehWQ== X-Gm-Message-State: APjAAAVsofT1CFrEXAHu9sGcOc7k6mhNNZB1g3cnioaSaAaSELXCRK4L vAUeufpfEACuNhJbhA+SxGeZnlE4Wcg= X-Received: by 2002:a2e:89c8:: with SMTP id c8mr18158547ljk.73.1557241220228; Tue, 07 May 2019 08:00:20 -0700 (PDT) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com. [209.85.208.182]) by smtp.gmail.com with ESMTPSA id f9sm3226657ljf.69.2019.05.07.08.00.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 08:00:19 -0700 (PDT) Received: by mail-lj1-f182.google.com with SMTP id z5so9531929lji.10 for ; Tue, 07 May 2019 08:00:19 -0700 (PDT) X-Received: by 2002:a05:651c:8f:: with SMTP id 15mr16818756ljq.118.1557240910069; Tue, 07 May 2019 07:55:10 -0700 (PDT) MIME-Version: 1.0 References: <20190502181811.GY2623@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> <20190506174511.2f8b696b@gandalf.local.home> <20190506210416.2489a659@oasis.local.home> <20190506215353.14a8ef78@oasis.local.home> <20190506225819.11756974@oasis.local.home> <20190506232158.13c9123b@oasis.local.home> In-Reply-To: From: Linus Torvalds Date: Tue, 7 May 2019 07:54:53 -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 , Masami Hiramatsu Content-Type: multipart/mixed; boundary="000000000000467f4205884d67ea" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000467f4205884d67ea Content-Type: text/plain; charset="UTF-8" Duh. I woke up this morning, realizing what was wrong with my patch. On Mon, May 6, 2019 at 8:28 PM Linus Torvalds wrote: > > Yes. But I was looking at the ftrace parts because I didn't see the > bug in the low-level x86 side, so... There was nothing wrong in the *low-level* parts. There was one thing wrong with the "in3_emulate_push()" code: memmove(new, regs, SAVED_KERNEL_REGS_SIZE); which ends up calling an out-of-line function. One that is traced. One that will recursively result in 'int3'. Which will fill up the stack until you get a triple fault and reboot. Stupid stupid. Anyway, changing that to just copying things one word at a time makes everything work. The attached patch boots with the whole ftrace test thing.The only change is literally changing that memmove() into /* Inlined "memmove()" of the pt_regs */ unsigned long *p = (unsigned long *) new; int i = SAVED_KERNEL_REGS_SIZE / sizeof(unsigned long); do { *p = p[1]; p++; } while (--i); which I'm not entirely proud of, but it sure is still simple. And honestly, I absolutely despise PeterZ's patch. The notion that we should suddenly say that "oh, the i386 kernel stack is odd" after 28 years of having that standard i386 stack is just crazy. And this: arch/x86/entry/entry_32.S | 136 ++++++++++++++++++++++++++++------- ... 12 files changed, 323 insertions(+), 140 deletions(-) vs this: arch/x86/entry/entry_32.S | 7 +++- ... 6 files changed, 120 insertions(+), 13 deletions(-) is still pretty damn conclusive. Not to mention that the simple approach had a truly mindbogglingly simple solution with no actual subtle changes anywhere else. So I still claim that we should do my patch. Because it is SIMPLE. It's straightforward, and I can explain every single line in it. Even if I spent *way* too long until I realized that the "trivial" memmove() wasn't so trivial. Linus --000000000000467f4205884d67ea 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_jvdx0q7d0 IGFyY2gveDg2L2VudHJ5L2VudHJ5XzMyLlMgICAgICAgICAgICB8ICA3ICsrKy0KIGFyY2gveDg2 L2VudHJ5L2VudHJ5XzY0LlMgICAgICAgICAgICB8IDE0ICsrKysrKy0tCiBhcmNoL3g4Ni9pbmNs dWRlL2FzbS9mdHJhY2UuaCAgICAgICAgfCAgMiArLQogYXJjaC94ODYvaW5jbHVkZS9hc20vdGV4 dC1wYXRjaGluZy5oIHwgNjYgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiBh cmNoL3g4Ni9rZXJuZWwvZnRyYWNlLmMgICAgICAgICAgICAgfCAyOSArKysrKysrKysrKysrLS0t CiBhcmNoL3g4Ni9rZXJuZWwvdHJhcHMuYyAgICAgICAgICAgICAgfCAxNSArKysrKy0tLQogNiBm aWxlcyBjaGFuZ2VkLCAxMjAgaW5zZXJ0aW9ucygrKSwgMTMgZGVsZXRpb25zKC0pCgpkaWZmIC0t Z2l0IGEv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