From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A08C282E3 for ; Thu, 25 Apr 2019 12:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8CC92081C for ; Thu, 25 Apr 2019 12:30:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="b31aDRzb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731171AbfDYMay (ORCPT ); Thu, 25 Apr 2019 08:30:54 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48666 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726402AbfDYMax (ORCPT ); Thu, 25 Apr 2019 08:30:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Inf2qACcqPy97pfp+Sm859gMSIWx2DI40CRDFzl9SmU=; b=b31aDRzb0lYUxD8Fc77E2v6IL gqaeZvshn9TjFfBrAxWEqHokbRrlrNxlS6+z5oUzy+uvmpAJSrnenAIACV+OE+NI9z7IEfHLhc2oN Tleu79NaKaolQlKWutmW0yNmoPK+sbKVqLymdd++0DBOR+rdQaWg21MinQyb82Y7IC0w+OZYYDEpB TYTWzhKXdjCMgW2VbJVxJLkszX91gIoXyKPjpECX5MCobHWZidW73lbsgZ9NMOPxgH1ZZsva50N6f WfgAKoXBAuEKAynAWitfqFTawARuG7G8VZwqaOcT+kWH2PnkRdLf8PLIp0yAJ8JZj7o1VXSrQXExg EMlw5N40w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJdWZ-0003JG-7j; Thu, 25 Apr 2019 12:30:47 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AE6E229C42EF0; Thu, 25 Apr 2019 14:30:45 +0200 (CEST) Date: Thu, 25 Apr 2019 14:30:45 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: Thomas Gleixner , LKML , x86@kernel.org, Juergen Gross , Andi Kleen Subject: Re: x86/paravirt: Detect over-sized patching bugs in paravirt_patch_call() Message-ID: <20190425123045.GD14281@hirez.programming.kicks-ass.net> References: <20190424134223.690835713@linutronix.de> <20190425065209.GA89582@gmail.com> <20190425081012.GA115378@gmail.com> <20190425091717.GA72229@gmail.com> <20190425092131.GL4038@hirez.programming.kicks-ass.net> <20190425095039.GC115378@gmail.com> <20190425102210.GM4038@hirez.programming.kicks-ass.net> <20190425105745.GA29840@gmail.com> <20190425114004.GN4038@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190425114004.GN4038@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 25, 2019 at 01:40:04PM +0200, Peter Zijlstra wrote: > So this then fails to patch the immediate; but the compiler emitted: > > 175: ff 25 00 00 00 00 jmpq *0x0(%rip) # 17b > 177: R_X86_64_PC32 pv_ops+0xfc > > and pv_ops+0xfc is (+4 because of reloc magic): > > void (*usergs_sysret64)(void); /* 0x100 0x8 */ > > which defaults to: > > arch/x86/kernel/paravirt.c: .cpu.usergs_sysret64 = native_usergs_sysret64, > > which in turn reads like: > > 0000000000000000 : > 0: 0f 01 f8 swapgs > 3: 48 0f 07 sysretq > > So I _really_ don't understand how: > > > Which with the vanilla kernel crashes on boot much, much later: > > > > [ 2.478026] PANIC: double fault, error_code: 0x0 > > happens. Just spoke to Juergen on IRC; the most likely explanation is that (because of PTI) the pv_ops table isn't mapped in the user page-tables and therefore the indirect jump comes unstuck.