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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EA45C4332F for ; Tue, 18 Oct 2022 14:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbiJRO0h (ORCPT ); Tue, 18 Oct 2022 10:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbiJRO0e (ORCPT ); Tue, 18 Oct 2022 10:26:34 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59A4BC0981 for ; Tue, 18 Oct 2022 07:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=lRhdHgCWUjXjv0masOFjK8upoM6QJK70D7oNOPh9QAI=; b=TvLOM0OA6hngiwG1n2tO/7kvkS 9fok2BOQXpzBCgenV5aH6IjXJWQEMV5dCFtqGHrIKve5rjIvDByHH+sKFDpY6K6Eo9UwSxsFyfS1E WYgKZrdDVoiZfnQf7OOH4HhW87UiFfjrLBtF/2GbEDjCcusYtBE2vmRlZFNyO9GN4dKUqMNKDTgno p3NH/zk2ePy2EG9vLC7IcDQtnU9ge5eK6gcubz/GV+VW5/hWvdIVJQeYzc8zy0z9Nc6HHfaeF3HD0 Qc+0rl6MT0XCeoedM2GkjIZUmA7OblJ0v/bxkaDARrAUu8XstJAQhhTAqQpH+L+PNi6Xtr4bch1wP 9k7yYuRA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oknXq-004VNx-Cs; Tue, 18 Oct 2022 14:26:14 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E70D1300202; Tue, 18 Oct 2022 16:26:12 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D051C2129C235; Tue, 18 Oct 2022 16:26:12 +0200 (CEST) Date: Tue, 18 Oct 2022 16:26:12 +0200 From: Peter Zijlstra To: Jiri Olsa Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo Subject: Re: [PATCH bpf] bpf: Fix dispatcher patchable function entry to 5 bytes nop Message-ID: References: <20221018075934.574415-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221018075934.574415-1-jolsa@kernel.org> Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Oct 18, 2022 at 09:59:34AM +0200, Jiri Olsa wrote: > The patchable_function_entry(5) might output 5 single nop > instructions (depends on toolchain), which will clash with > bpf_arch_text_poke check for 5 bytes nop instruction. > > Adding early init call for dispatcher that checks and change > the patchable entry into expected 5 nop instruction if needed. > > There's no need to take text_mutex, because we are using it > in early init call which is called at pre-smp time. > > Fixes: ceea991a019c ("bpf: Move bpf_dispatcher function out of ftrace locations") > Signed-off-by: Jiri Olsa Acked-by: Peter Zijlstra (Intel)