Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp850546yba; Sat, 4 May 2019 14:38:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqoBkq2sfha4eLMnjq23QSt+DIInKLYhE5bKxGfkgOqOSD5qvxcSxajUxLG9EmzJICBH43 X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr21812544plz.128.1557005916259; Sat, 04 May 2019 14:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557005916; cv=none; d=google.com; s=arc-20160816; b=VrCD4PsaWNjatOYO7J/LVxWbmZKAxwbdl7Ith9YIzuCENhmxvyZ4Ma3tgF8CtN7Ll8 iwWGtXc1cSvLMrE8TApUjriSBtOW3ZhkjfH4MS1lA+A7JDCgRAHnnu9jWJrMt7gac+H1 sd+6B67Vz6r+xUq6P/vdklCzwVdP52NJ63+oraFBORZmcU1tdFVxr7e7uOJqsMVWXXOj Vm/e6SZ0Y8VQd+8kIJaElsPFAlpuhbDyg2yJKtWPt3lAFvszBDZBxJaXhZ46EYqLNWAM ddgwzFf9DT90SkeVRIdXu2EJWoq8rfBaaSZHrR/d6o2Di+XYSzjDB/sXdul0d0VGjb8Z zubw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=NCMi/IJcY48aFW4si21DdOI0x27Xmxnd2GdXSGtj0KE=; b=sZvDF1S9QxWS30JHZqZR3KsFojW6M7phaGPTIC6CKamDtzW8elofJ+C2TS3P3oSoRo 2elp3U48dkhcO9XdAWg2JIzWtNbik3CPOckSYWtk6yw8MiAOyJgt88nPKiBPzZSYuY4T soNs22djqbd13sRdn+AJLgJAF77Y4n0NgzLCdOBrOW+8RPVAmuDARK5g/oW44sH8W7pT 13AfUBxndC0E47A4/M02t2I2E0mmZkYBdxCjUUKcqEHQ0KnLgZWQKRIpVh+XrHOqZfF9 KANjSQ4pR3CkGlArrg/5u+X/mWIoLsAr8Fe1k3XIFWtCL3XiN7OpTEfSomdNZ/oy5gk0 NBNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QuR1yzxQ; 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 74si8183175pgb.203.2019.05.04.14.37.41; Sat, 04 May 2019 14:38:36 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=QuR1yzxQ; 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 S1727259AbfEDUMN (ORCPT + 99 others); Sat, 4 May 2019 16:12:13 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44126 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbfEDUMM (ORCPT ); Sat, 4 May 2019 16:12:12 -0400 Received: by mail-pl1-f195.google.com with SMTP id d3so345691plj.11 for ; Sat, 04 May 2019 13:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NCMi/IJcY48aFW4si21DdOI0x27Xmxnd2GdXSGtj0KE=; b=QuR1yzxQKn7DFRWWMR7fSBvuGvXauTjs+QWjPOOSysETTl7I7IUQZRZYJGQZEWrzXC aXLuopskBKG1lhvC6mZrbZ19GZQbAXZxbgrHcEY7Ne2rv2yRv1+wyy9Aed2EFweFh6sT MgUpM2KgnYL4er2RhJuziduNFgdJtQUuNY+rxGB6YYm4L5wZ1h2YrICNBMRWST/sIk1d x9FS2IhTzzNlLOEXa4KJ5A+G6yffez6cK9ONx3kgBDi79QMtaQN7mE+Ead5KYOCSP/ew B8BvOEnVYxCJoBIzbJDeiLf8mBt3Ri3eWcg7XWeNKx9f/9jOlgXQYd9q1O//WCtIlh13 V6Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=NCMi/IJcY48aFW4si21DdOI0x27Xmxnd2GdXSGtj0KE=; b=S4Vl+VtW7aY8/KPZgtp/P+6868Ew+W6u6oMtltoT7vvj3pdhh32xVxZx84gkRYOpF/ BfQWTHFaGqCK7v1UaP/PvY/NtyvuPHWFcMjBoZAuy+V91kyer49m+JYHsQyCicofMOsM kiMqs+HdZIfJAq0zjFYweee3oAOMwfCL3jkFezHNV1xsDVvzrZTJAdjceUmsbqqWr+rs ndjJXaV4RMgwGSN0OtVSUXD6vqotCl5Tlbo7Jlw7hhW6yBulq8Tjn1jMdf86lKqmFStb 8R+YwHIjl88zUtJVq2/dUn3PCrwsYog5+w1lE1VflT34EQeH6eDVgpCbpzmNrFIJ/5OG id0Q== X-Gm-Message-State: APjAAAUYzVd3NqEcFXZaRga2Lve7foz11jTdf9PSufe2c05t6+TIzBPy PtvaenihsK6/kNMLCkFxKfyZ9A== X-Received: by 2002:a17:902:e293:: with SMTP id cf19mr21832986plb.151.1557000731668; Sat, 04 May 2019 13:12:11 -0700 (PDT) Received: from ?IPv6:2600:1010:b01f:7d2b:6939:d09e:b43f:2a80? ([2600:1010:b01f:7d2b:6939:d09e:b43f:2a80]) by smtp.gmail.com with ESMTPSA id c137sm8834253pfb.154.2019.05.04.13.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 May 2019 13:12:10 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [RFC][PATCH 1/2] x86: Allow breakpoints to emulate call functions From: Andy Lutomirski X-Mailer: iPhone Mail (16E227) In-Reply-To: Date: Sat, 4 May 2019 13:12:09 -0700 Cc: Steven Rostedt , 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-Transfer-Encoding: quoted-printable Message-Id: <2BF1AE4B-8105-49F0-8B6A-AA3B11FD66FD@amacapital.net> 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> To: Linus Torvalds Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 4, 2019, at 11:59 AM, Linus Torvalds wrote: >=20 > On Fri, May 3, 2019 at 10:08 PM Linus Torvalds > wrote: >>=20 >> I'll look at it tomorrow, but I think this actually makes unnecessary cha= nges. >>=20 >> In particular, I think we could keep the existing entry code almost uncha= nged with this whole approach. >=20 > 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 >=20 > int3_emulate_call(regs, (unsigned long)&int3_magic); >=20 > 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. >=20 > 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. I hate register_die_notifier(), so I consider this a plus. I=E2=80=99ve occa= sionally considered removing the ability for the notifiers to skip normal pr= ocessing, because, as it stands, figuring out what actually happens in the t= rap handlers is almost impossible. It generally looks sane to me. As an aside, is it even *possible* to get #BP from v8086 mode? On a quick S= DM read, the INT3 instruction causes #GP if VM=3D1 and IOPL<3. And, if we a= llow vm86() to have IOPL=3D3, we should just remove that ability. It=E2=80=99= s nuts. (We should maybe consider a config option for iopl() that defaults off. We=E2= =80=99ve supported ioperm() for a long, long time.)=