Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp9010006ybi; Fri, 7 Jun 2019 01:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSM3fEf5JMqXw+FZMJCFwNcRTTOg5iZSwUTEexewz9OIdIcDobITOh4Fzt/Z/3Xsl6dWMm X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr15133841plb.76.1559897684315; Fri, 07 Jun 2019 01:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559897684; cv=none; d=google.com; s=arc-20160816; b=FpTvtI835uMlEgm4QeWvwUr3yzOB5UnFDkROM4z8IVry6kic44gIWyQIR9fT2uVtvt 9dX67WyhKOawU9fDfleHi1VIR4S28u/aBkOsQdwmOXLd8+YLtnta5H+N0Dp9lTHDX6c0 TSXXCb+CCa0sR2Rg7GZJ349k+uUNnPZtaCdvg105wzEcgdSoSp+FcymFsQQT1i4YWDPJ 9NMffQ+C5H4YuQXd7canNFryGLoHXZeXhdeqACLHrEzYqqnh3EiZjwcB5bCKeJU5EB0v 8bipss8F6I0djY2IDYOJ4aCHILjP5pRqnnnSINvXXwUkuuvxiEQkGyPhvU844a/wX8IM ajJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dpgiQqMVvs9D/eI6PPziIib81Q3EzMAtTY461lA7EiA=; b=V6JSuKUKtbguvEwvPADYAOHS3Nj2ZFR0KaIYpfYX7vwCAGpqNed8V8EH8olOSWlsCT HUXRSIAu4TQ6bfdGDnFPgXpjiXELFOT2UDFyDphqbMUAgy6W3SGJKowvjN1tvuQa+VGI jVJeeiIU8YWNeZND3Z+1Zwz14KZk6Czi8gJem793BfGRINRQwwkwPl7gOYIO4au48PGy fKwlkmTXWt5DYzZtttrpo9TMBciA3ztdeGxMyZyPBJszI0nAaAMd/z/ybEKaBpBB57te MgWeECXMbUtOfmVe77WGACDXcPFltyGp8mkLpLqhVbmTo//bJhylZChiY8ERXA9/Tara Et4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nXxuPfRe; 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 32si1336164plb.86.2019.06.07.01.54.28; Fri, 07 Jun 2019 01:54:44 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nXxuPfRe; 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 S1727340AbfFGIxZ (ORCPT + 99 others); Fri, 7 Jun 2019 04:53:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59898 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfFGIxZ (ORCPT ); Fri, 7 Jun 2019 04:53:25 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=dpgiQqMVvs9D/eI6PPziIib81Q3EzMAtTY461lA7EiA=; b=nXxuPfReyIjZ4ooTUQe4tgWMv0 Ctidl6TUphbY03WZzKhSyuK4nd1g2FJPaqz7G6lqsRUm4Zk03/piv1ua242lMM38GUUxbrOlh0k9S gVGjUZUPA7xMzvVw4JR6OpGSdrTJJ4gvvJRWEE1SirzZEybZKR8lPbRyh/CjjoPe9EG1gmH0fVZBc XIeB1xZ6NtnaAwqS4DiVWGCkm+hSPl37O36Cd55xcrTTQWTjQdkKLBAzkAjPxPpbBzY07gwt8MchH 8YQ0l1BsQhL3Xd1rU2O/juP5i8G2jFS+zOKXhBWiH3H3Ny73iwIJFJlyTFyXXLbA3/PS/sKmdORti g1D7MQEw==; 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.92 #3 (Red Hat Linux)) id 1hZAcP-0001Tf-Gy; Fri, 07 Jun 2019 08:53:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DDB1E20216EF2; Fri, 7 Jun 2019 10:52:59 +0200 (CEST) Date: Fri, 7 Jun 2019 10:52:59 +0200 From: Peter Zijlstra To: Nadav Amit Cc: the arch/x86 maintainers , LKML , Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira , Josh Poimboeuf Subject: Re: [PATCH 12/15] x86/static_call: Add out-of-line static call implementation Message-ID: <20190607085259.GE3463@hirez.programming.kicks-ass.net> References: <20190605130753.327195108@infradead.org> <20190605131945.254721704@infradead.org> <37C2FB32-3437-48CB-954D-05F683B7D80B@vmware.com> <20190607083846.GX3419@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190607083846.GX3419@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 Fri, Jun 07, 2019 at 10:38:46AM +0200, Peter Zijlstra wrote: > On Fri, Jun 07, 2019 at 06:13:58AM +0000, Nadav Amit wrote: > > > On Jun 5, 2019, at 6:08 AM, Peter Zijlstra wrote: > > > > +void arch_static_call_transform(void *site, void *tramp, void *func) > > > +{ > > > + unsigned char opcodes[CALL_INSN_SIZE]; > > > + unsigned char insn_opcode; > > > + unsigned long insn; > > > + s32 dest_relative; > > > + > > > + mutex_lock(&text_mutex); > > > + > > > + insn = (unsigned long)tramp; > > > + > > > + insn_opcode = *(unsigned char *)insn; > > > + if (insn_opcode != 0xE9) { > > > + WARN_ONCE(1, "unexpected static call insn opcode 0x%x at %pS", > > > + insn_opcode, (void *)insn); > > > + goto unlock; > > > > This might happen if a kprobe is installed on the call, no? > > > > I don’t know if you want to be more gentle handling of this case (or perhaps > > modify can_probe() to prevent such a case). > > > > yuck.. yes, that's something that needs consideration. For jump_label this is avoided by jump_label_text_reserved(), I'm thinking static_call should do the same.