Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2978184yba; Sun, 28 Apr 2019 13:57:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAztOQr+R+ko+ZjGFJdGBgBPUXEgaLa6K3W/0Cd+j8HvRR6jrnN4HqeTWklLfQLuxbCS+p X-Received: by 2002:a17:902:505:: with SMTP id 5mr45487360plf.323.1556485063637; Sun, 28 Apr 2019 13:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556485063; cv=none; d=google.com; s=arc-20160816; b=WzpWoJ+J2D+uEkf6jvIh/xOKNexYNOMSpkjk/ikEiiVwiqZomnVZKByKolpyMqmWrX rat97Tp6ZXRFgJhugvEHqPxj2dR1liNkAaGag4yYdQwCYFD8jFm7ZqOjEBAkYXn8aOYq sjH6EHtd8YGJ6sI8R0S0fQN9H1p6Vak33PSZH1y0sq3Ec98830jzgp1KiDgtujaOMKwq UOswACSlKZhKjB/r4UczLLZ2PF1ycET0fcAyefhy8jqzENKW7Mg2dr6PDcRBG4xv7Mds puR9GcXHl85xlQRwOBEVRF4nMS8kLPu23q3gpYbtIXsgZVpEoAq1QXrKa2iYzm6ybPZJ 5Lpw== 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=PMSrmlfvNPSDiUeJDXR9q1eCVxoxW5mdLWF/ia7lsmo=; b=wZO1Zjc7oCvmmIQdfgBEL6lVELWqiTlAJG6HxxB+eCFuitn12VKdxwbITBCtad6jn/ 7C3YeRzCNnbE2enH7x+rO2ed5ZKPuhUNX8y3UXbVYEuTwlEj81FB/gHvN7rqbqmINC2C 0beChhmYJzEdu6KqFdNRVKjjC8wu04Bx5Za2XTxG8cNDrZENswsH8M5krhRd3JhrHRr3 RKC0tbhEw7vGl93+JSgUcfprAz7CrEkRClRZJcPwfK9suruR+0mHfH94o8kWrR9HOy/L bporYMuHLaTIxipe4M9RJ6Fen/4LyXUDe4GwS2+PJ0d1T1YfWPzHeuDXstVxqbEt4Bqi 4zeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=bX8NzEIt; 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 u22si31517812plq.193.2019.04.28.13.57.26; Sun, 28 Apr 2019 13:57:43 -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=bX8NzEIt; 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 S1726463AbfD1U4e (ORCPT + 99 others); Sun, 28 Apr 2019 16:56:34 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:46956 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbfD1U4e (ORCPT ); Sun, 28 Apr 2019 16:56:34 -0400 Received: by mail-pl1-f193.google.com with SMTP id o7so4080336pll.13 for ; Sun, 28 Apr 2019 13:56:34 -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=PMSrmlfvNPSDiUeJDXR9q1eCVxoxW5mdLWF/ia7lsmo=; b=bX8NzEItRUJcNX4IEaO92aGZxzA30k0Cjey8QZMwYTNntpn6Jlk4zVsKp3WP/MmkYU K0khKZ4h23Y3mEWI18gykXFuiPYWX6wRxAxbi5rNuYiXHWvvFjk0Ee+uIDYXGdgY24u1 uu0Je+tuLRIzW8l5DQHM3lL6bZivg7c7W0KZhWFhI/X08fzTGmc0KCGFkPf9K5EvEWYA fNgyNIY7G78xr6JAW8M+w6H2WcqfaH4S9OPmyPUQD9mJRg4HuxfEFS94KcbIrRNyzMQ9 QS3wI7CPueMd5ksDLDX1Z+4Xb2HPRyT1KyVB517WedzUUGNGLkovD0ujdr5JGgzmtBa7 0WjA== 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=PMSrmlfvNPSDiUeJDXR9q1eCVxoxW5mdLWF/ia7lsmo=; b=EU4h5KrxiC/dBwcFhHXZo8GOaP8dnSOnW7dUHgFR30ILJuEMxbzqyPt7Dr07AeBpVm yT9ibsvyducozgcofoFIiJzIu4A4ngizcGlShJ/cp6E49qvY/FNGxxDtjr+GVxO9VbVG JAIfRltSYHf0LRuXcC40Y+Ewbu6z8XaoL0GGFq1z8dh9N2zHFBe0rvrsNLro2gklAs6B chjJ7LiXjT8xQr3JNRY7YeyKecQQUnI6c+Dm74u/IE6hALNGNahRzUhC5IfBzPIMo8Sg 3FWbMqz0h4hGPi8ImKi4/iPdS+s7BgjJJaOGx8pMz0Fry0RAf9l6mCWYPs0XCcB1uxzD bF1A== X-Gm-Message-State: APjAAAXLBNsMmwiQYqsWu70pfNB0oLsjraDu8AOw7dap7rEnKla/6w23 buUYy8jHr48Xb/lOLJLY1NvKEA== X-Received: by 2002:a17:902:4a0c:: with SMTP id w12mr41852080pld.52.1556484993871; Sun, 28 Apr 2019 13:56:33 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:68a6:ac0c:7713:add7? ([2601:646:c200:1ef2:68a6:ac0c:7713:add7]) by smtp.gmail.com with ESMTPSA id r138sm13730618pfr.2.2019.04.28.13.56.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 13:56:32 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 1/4] x86/thread_info: introduce ->ftrace_int3_stack member From: Andy Lutomirski X-Mailer: iPhone Mail (16E227) In-Reply-To: <20190428154345.789635b3@oasis.local.home> Date: Sun, 28 Apr 2019 13:56:31 -0700 Cc: Nicolai Stange , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, 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 , Andy Lutomirski , Joerg Roedel , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <249CA966-9EFF-4687-8BC9-9364EDD51388@amacapital.net> References: <20190427100639.15074-1-nstange@suse.de> <20190427100639.15074-2-nstange@suse.de> <20190428135143.09d35bb6@oasis.local.home> <20190428154345.789635b3@oasis.local.home> To: Steven Rostedt Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Apr 28, 2019, at 12:43 PM, Steven Rostedt wrote: >=20 > On Sun, 28 Apr 2019 11:08:34 -0700 > Andy Lutomirski wrote: >=20 >>>=20 >>> Perhaps adding another slot into pt_regs that gets used by int3 to >>> store a slot to emulate a call on return? >>>=20 >>>=20 >>=20 >> That=E2=80=99s not totally nuts, although finding pt_regs isn=E2=80=99t e= ntirely trivial. >=20 > I meant on the int3 handler (which stores the pt_regs). But that=E2=80=99s below the stub=E2=80=99s RSP, so it=E2=80=99s toast if an= other interrupt happens. Or am I misunderstanding you? >=20 >>=20 >> I still think I prefer an approach where we just emulate the call directl= y. >=20 > Then, on the return of int3, if there's anything in that slot, then we > could possibly shift the exception handler frame (that was added by the > hardware), insert the slot data into the top of the stack, and then > call iret (which the int3 handler, would add the return ip to be the > function being called), which would in essence emulate the call directly. Oh, I get it. I liked Josh=E2=80=99s old proposal of unconditionally shifting the #BP fram= e 8 bytes better. It will be interesting when kernel shadow stacks are throw= n in the mix, but that=E2=80=99s a problem for another day.