Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2860318yba; Sun, 28 Apr 2019 10:42:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBuINPpHwzHvolnCbfJSNk1CXrevz6NuZoq+/5JOJEqhNnq+2UPuUg096aIAT2zVqwstt0 X-Received: by 2002:a17:902:720a:: with SMTP id ba10mr4645945plb.192.1556473373062; Sun, 28 Apr 2019 10:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556473373; cv=none; d=google.com; s=arc-20160816; b=df1olBaLpvz4nzGtZRrjn1HXpL4KC9RHIK/kDi2oC67EwPEeqrqSTvMhS4pmSxr7gV h1U+u/n++mX8PJR/MrBnGpPqhhzZtkT2pTwOt5YnmP6nUMtOSzfmOUSIqId+ol5fFAI3 /fA+cFmjP7GQUWq7C0or8fBU6BQfxRpa6hls65ebJ0LTKCUXVE7x5trqma2gPQtaOaUx MlnV+plRfzplRoftvZzf4udh7dqnnTq3NSrjfsV7F+M0VUivExH6WjBr6bQViC8mqAR5 6na0FvGJVZsdftIAQcobJLOSvQXgJGB+DK9e1wCo/v9PvN4QU1Lu3jNci4MekN7V+ghx yE4Q== 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=UB/V2OMSTCgHtH1m9OSlkcyNv221wepPJzWI5BJPRJw=; b=a5paFPQX0bOqLh3VDN0YMpfPdjht1GYoLL51TKpVwXAOP8SXfqH8c7L/LNtBFEAORa 6NAjL/x1RXS7+xPJbdU0Una2egrm3ujjRhEUdZVMBHgtNhngliuv3fTiyS/2F7nHtRQ0 +uA7SxzAf82IX6xjl4cUpVtF2RujJKNEeKyif0a8CUHm1URcHnleEjSlnCgGa+elLLSl 1IpAXiHitucLFIZBzKNI5uPm8h59xOL/XsCE37H49DZHqvl8NIM5DlCn4E3CNYa8+rdc iUl6VJ1ySv6+dczCc4xDUT/8+uzshtXyX1R4GJvjpejbjUl7bRI3QXi6ErlZN3oxy9t6 4ATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ldr0EOm6; 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 b14si501130pgh.266.2019.04.28.10.42.37; Sun, 28 Apr 2019 10:42:53 -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=ldr0EOm6; 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 S1727099AbfD1RlS (ORCPT + 99 others); Sun, 28 Apr 2019 13:41:18 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36608 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726299AbfD1RlR (ORCPT ); Sun, 28 Apr 2019 13:41:17 -0400 Received: by mail-pg1-f194.google.com with SMTP id 85so4058941pgc.3 for ; Sun, 28 Apr 2019 10:41:17 -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=UB/V2OMSTCgHtH1m9OSlkcyNv221wepPJzWI5BJPRJw=; b=ldr0EOm6vI6MZ2PQE8kgh6H9SNKmJxqFt1Pi9tEqAWpMKdjkfb/fk8Tmn+EegiVc+Z ITJkAnYeXrzl1AKkx1ML42wsj/gQ0YCDG0syaHMZiC1MjALeA20vdg1rQKLamrzJikzW 6N2Kwd4De7fdxQhkWhy+TJ9bBgeKg83kRjrdnaqnVgtB3hLy3djf03D+fY++FwvaIzAZ 4z/YgsQzbz7qm14+93uHKRlpwZqH4Aj9Xn5u9V/mHhEy+SX01Y30X9VZqQnefOBSubi9 CkX8UEBLQmWeMA8E4OjE4bdUAPTNMVTMGxLi5sofNV7JPWN/wu3HhXQv3HxNGwYGrgcI i1hA== 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=UB/V2OMSTCgHtH1m9OSlkcyNv221wepPJzWI5BJPRJw=; b=BaUQoSt56a3D6pdRK6IYXpcVpo8g/XYigXNJPxmpgGwoeA0j0kqxyCtGnqLugUvSTp ScB0x1TnMCyPR2HHLZUeqyM0xmhpl9TZklCbSzq5Nrj61VXmngB/U05Qby/MQCpiipqc FJapOiYXwvtmslLdP8Nj0W+aeMsM0+a1Bd2Yq1B/L2C0jJ+9OzlExtTCbVZzMo0hbYl6 9DeZ7Ktr8cLWEpM/aO8KaYgxoho3i7MUf6uXr4JiRtD7WKjpc5B10fUMyNKooX+m9/Xy XVpljOf6eOCq4H0a82Q7qv8tvyYfEHzbohMl1k0C3t/S3uED1gRTrpYI3ETGAF7j8tsf d7RA== X-Gm-Message-State: APjAAAVWrmcho8QuJI2weNErZnwMVo65l/2OSe7qk25iXvASvtecrnPV u8Fb8eggCrIQNzqK9gjeaK333A== X-Received: by 2002:a63:7c6:: with SMTP id 189mr4103362pgh.247.1556473273986; Sun, 28 Apr 2019 10:41:13 -0700 (PDT) Received: from ?IPv6:2600:1010:b144:c2ea:2812:6533:d7:28e? ([2600:1010:b144:c2ea:2812:6533:d7:28e]) by smtp.gmail.com with ESMTPSA id s9sm41284713pfe.183.2019.04.28.10.41.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 10:41:12 -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: <20190427100639.15074-2-nstange@suse.de> Date: Sun, 28 Apr 2019 10:41:10 -0700 Cc: Steven Rostedt , 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: References: <20190427100639.15074-1-nstange@suse.de> <20190427100639.15074-2-nstange@suse.de> To: Nicolai Stange Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Apr 27, 2019, at 3:06 AM, Nicolai Stange wrote: >=20 > Before actually rewriting an insn, x86' DYNAMIC_FTRACE implementation > places an int3 breakpoint on it. Currently, ftrace_int3_handler() simply > treats the insn in question as nop and advances %rip past it. How does this not crash all the time? > An upcoming > patch will improve this by making the int3 trap handler emulate the call > insn. To this end, ftrace_int3_handler() will be made to change its iret > frame's ->ip to some stub which will then mimic the function call in the > original context. >=20 > Somehow the trapping ->ip address will have to get communicated from > ftrace_int3_handler() to these stubs though. Cute. But this should get =E2=80=9Cftrace=E2=80=9D removed from the name, s= ince it=E2=80=99s potentially more generally useful. Josh wanted something l= ike this for static_call. > Note that at any given point > in time, there can be at most four such call insn emulations pending: > namely at most one per "process", "irq", "softirq" and "nmi" context. >=20 That=E2=80=99s quite an assumption. I think your list should also contain ex= ception, exceptions nested inside that exception, and machine check, at the v= ery least. I=E2=80=99m also wondering why irq and softirq are treated separ= ately. All this makes me think that one of the other solutions we came up with last= time we discussed this might be better.