Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6436214yba; Wed, 1 May 2019 12:14:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJyK6JKWnhEf0w+XupDBhjqXc42hoM/428bFyFkSHmdhwBeDqHykM9WJRN9+k9lkoID8Nc X-Received: by 2002:a63:5012:: with SMTP id e18mr74326938pgb.383.1556738098599; Wed, 01 May 2019 12:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556738098; cv=none; d=google.com; s=arc-20160816; b=U73Nxj/Sj9SS9o5NYdsjv0DNqjMHwRM2V6ZoEeoabQ4qb/J9aTvOHu6JqFDHQ0Crs9 1KVFEalK3n2+5PpI0kHhSKLAWuvN9DTqAYita065/Jns60YgR5dbdP5O7ukebduq4pns cZGsHKrGV7yGLtddCca3rFMNLZe3hixm5iDJr/6oMRBMRk/U5VJanQxVRLpXUypRoZmV TplM7ylpE0dN98OQDoJC0QKcIy5l22U+w+Piw7ymqGKTXJ/Swi0MUvihLBmeMttAXVBT JfdD65LFd7zHGZ4u5JzBgD9Ot3NECCsXJzD/yzUtpSjpGoXHhKlbuuxh7LifVYso7mYo ATEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=CVdr+CbL6OoHgFUrxpLZSMNbJq/fVTyw9y0bLGBM+XU=; b=IYYJVEfZod7U6PFgjSrSxqMZ1vG+0pphNyd18XPxOASH6LoHuHsWDF/4AxNf9kSfYq 5Jj4n+/S6Yp6WFTKSztyZh7a6AveV5ZZ2CwZqT5JF4d2xnyekSIYQq4y/fKSMsZsLjwS /Ikv5YORt80PWhgmcUjEOu6myg3H+OoUdaSGiA2ny469HGNd6nLGe7FCyXlSNZ8tN/R4 a6l3cHLHhsh0WYpsOou2m860kpZanFDU5BjmZ1ZWO7IlQkl2lZjpznr9Kv/kHxrUUaGg Du+7ictKFilwYrBAau+RgR46f39IAq7fOBI79U4QvSukhjWx1rsIHyO46oNZ0zY6GU8E 7tRA== ARC-Authentication-Results: i=1; mx.google.com; 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 j9si39363951plk.125.2019.05.01.12.14.43; Wed, 01 May 2019 12:14:58 -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; 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 S1726276AbfEATNf (ORCPT + 99 others); Wed, 1 May 2019 15:13:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:38830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbfEATNe (ORCPT ); Wed, 1 May 2019 15:13:34 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A6FD2081C; Wed, 1 May 2019 19:13:31 +0000 (UTC) Date: Wed, 1 May 2019 15:13:30 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Peter Zijlstra , 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 , Linux List Kernel Mailing , live-patching@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler Message-ID: <20190501151330.023cc620@gandalf.local.home> In-Reply-To: References: <20190430135602.GD2589@hirez.programming.kicks-ass.net> <20190430130359.330e895b@gandalf.local.home> <20190430132024.0f03f5b8@gandalf.local.home> <20190430134913.4e29ce72@gandalf.local.home> <20190501131117.GW2623@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 May 2019 12:03:52 -0700 Linus Torvalds wrote: > On Wed, May 1, 2019 at 6:11 AM Peter Zijlstra wrote: > > > > Here goes, compile tested only... > > Ugh, two different threads. This has the same bug (same source) as the > one Steven posted: > > > --- a/arch/x86/entry/entry_32.S > > +++ b/arch/x86/entry/entry_32.S > > @@ -1479,6 +1479,13 @@ ENTRY(int3) > > ASM_CLAC > > pushl $-1 # mark this as an int > > > > + testl $SEGMENT_RPL_MASK, PT_CS(%esp) > > + jnz .Lfrom_usermode_no_gap > > + .rept 6 > > + pushl 5*4(%esp) > > + .endr > > +.Lfrom_usermode_no_gap: > > This will corrupt things horribly if you still use vm86 mode. Checking > CS RPL is simply not correct. I never tested the 32 bit version of this. And we could just not implement it (I don't think there's live kernel patching for it either). But this doesn't make it any worse than my version, because under the full testing of my patch with the trampolines, I would easily crash the 32 bit version. That was one reason I made my last patch only support 64 bit. Under light load, 32 bit works, but when I stress it (running perf and ftrace together) it blows up. Could be an NMI issue. -- Steve