Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6434268yba; Wed, 1 May 2019 12:12:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv/lFye6HB08mIIHJc3QxefhtU+9frWnDoQRKjDZ4QHopEIQSiJrAx9MXHl8pcs/45Pv5J X-Received: by 2002:a65:60ca:: with SMTP id r10mr11118204pgv.64.1556737954425; Wed, 01 May 2019 12:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556737954; cv=none; d=google.com; s=arc-20160816; b=bbOA5355HvdKHdpZlM5xerxNT31JPD43JtXsBZhq6GLvL5hLL56gjfsPUpnb7v8IbA 4eeFV5RT0zWLsA0jaFLIu+BmD82b+TmLv1/b1KhZFADfTA2wudvcilanuinwRUeDFWn1 vCwWbZFRJz9/+9uXNsAkfLGUt2HwSiOq+fyH0E1i+cM/PKVEr3uRFFGbXK0aDaOjOpVE KQqvkS+o14yzcPx2t5xdDbnO+e+rqHplotWAI8hRn8rATKfTyTDl9bnbgaZbMSY/IYkX 5XGONXEF8XCzt96KJyzeKaZfmGE1apGEJR4NhTJuyOeI6ValytX/spqs9HqWlB8KxYm5 0mTg== 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=TiBsTWgzzAF+KdkEXxajDMuwYJJBRVV+mYkYOCtAGk0=; b=fXy6c+GF1mcd9S3pycDi2BbpVLbVM8OnW9KwET+bkhFL95klOvi6oH91NZrwYGyJbN hiR8styIXuwvf9WPd/uFi4ZtdevF8P89aL5xu3EClBng60RLS0/m/0HIOZhLz5bknrav 9kYRe9L3MnyP+Cyyp+Ik74Cs2Xx7yQooukyOr+4pQMvIFHOG+tpXW12MAe1DXhXDN1KE x1RMQjqrtflHUDhXtFU5i1CcEBWEeURF2yS2/oHJZdPZskuHHmSnRs6Qf4Uo160sBL7n z+ADb2uKTtBcdUGo1X3Pl9Y6Zyjh6n5ebz/ZE+sFNd3Y0MuR1DXgriRDqtTvVDM0eRhP FnPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=XhXhYve5; 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 o1si43836912pld.269.2019.05.01.12.12.18; Wed, 01 May 2019 12:12:34 -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=XhXhYve5; 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 S1726173AbfEATLG (ORCPT + 99 others); Wed, 1 May 2019 15:11:06 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45957 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbfEATLG (ORCPT ); Wed, 1 May 2019 15:11:06 -0400 Received: by mail-lj1-f194.google.com with SMTP id w12so4526094ljh.12 for ; Wed, 01 May 2019 12:11:04 -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=TiBsTWgzzAF+KdkEXxajDMuwYJJBRVV+mYkYOCtAGk0=; b=XhXhYve5yp/7i7ghcjSgqe8Ah4/jDyKSdA4S4qrEgBU4LVdnD257Ifh54gJv84NAiR JZoS2qQKQRUzHFnqFyLTaaVMOqgJnwidqknuDV//VcmEILwJrVqHQ7CVkyI5GbnNHtsk xTszDTRHy7x7pFIaZAu5kKKzR6BGVz7v+AD6s= 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=TiBsTWgzzAF+KdkEXxajDMuwYJJBRVV+mYkYOCtAGk0=; b=nFJmbmhBjoZA9u0pkImR/996Tl1kWYebKBEZSPM2liBVvxHI4kyX+WVIA9jxHRBvkT 3WhKUBJT7CrJwCKrr5HPo5Ejr8Xo2QNzBORY4qVRKnF1cWR/xMUB8gK8AU3bnPWSizBd 6u1kjYezRAUrCaFHYdwRcau+e6MtD09ITRAVknIE3Vtxc/b0DmONXwySUNdw7oDO/G3z glATaXtPThdebtSIXlQzJFzyrswq4ypYFQK9xz7E9ngAzeFDQHg/zOxg87k9741qiuev oXqwja+5dJQlb75Ojs0NnveJoh6XCrsQnVAjLMwRXWEQ2SNGk6MeDLvCd8vlK6bqnGqm YZ2w== X-Gm-Message-State: APjAAAXVs6JsDqyXg14DgR+ggCeXg5rmmoH1vdmqM/0/OpkQ9qY/23vx YYOnqm3Le2vHg5bd9PqII01F2FTK5rA= X-Received: by 2002:a2e:99d5:: with SMTP id l21mr8664551ljj.113.1556737863807; Wed, 01 May 2019 12:11:03 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id g5sm5626963ljk.59.2019.05.01.12.11.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 May 2019 12:11:03 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id o16so61161lfl.7 for ; Wed, 01 May 2019 12:11:03 -0700 (PDT) X-Received: by 2002:ac2:547a:: with SMTP id e26mr18587346lfn.148.1556737448492; Wed, 01 May 2019 12:04:08 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20190501131117.GW2623@hirez.programming.kicks-ass.net> From: Linus Torvalds Date: Wed, 1 May 2019 12:03:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler To: Peter Zijlstra Cc: Steven Rostedt , 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" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Linus