From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UbHNqkRu" Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D58419A2; Fri, 8 Dec 2023 09:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=V28FqpOL+oZWPnnuXFJFyawoJ5nIS3QYSrjANXac/eI=; b=UbHNqkRus+VeXqxGP09vb359cH 2Q/ZEqAjQU4IsYvHCMQxbyYEYrxhTuo3gNlyMc13ZpTy7FurwxlfYnyeyVDkDjthklMDFdHv1pk2O iWXktzpJ3MHht6J+8CJzFNs4XhJWPpe7r1gsueyYfHT+aGpqaquovUgnsujDTcrKtmsVXQZhAkhX3 MSmklMcr0V/IrT3Kb9WlygDyHLhiA9akWeqV9GmCO7S6JlbTqOHzZSk9q8AEFWqokE4RFo3ShjLBN Wc6sCSMhme6ocjs7BtVEOFRgo4Ltt1gOhE8YN6Q1c3Mrfepb5uEV/MLWuqzaQ0TRqBEzEgKeY6qtL tiKWKUbQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1rBeXw-0069mX-TN; Fri, 08 Dec 2023 17:21:53 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 89F2A3003F0; Fri, 8 Dec 2023 18:21:52 +0100 (CET) Date: Fri, 8 Dec 2023 18:21:52 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Jiri Olsa , Song Liu , Song Liu , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , "David S. Miller" , David Ahern , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Arnd Bergmann , Sami Tolvanen , Kees Cook , Nathan Chancellor , Nick Desaulniers , linux-riscv , LKML , Network Development , bpf , linux-arch , clang-built-linux , Josh Poimboeuf , Joao Moreira , Mark Rutland Subject: Re: [PATCH v2 2/2] x86/cfi,bpf: Fix BPF JIT call Message-ID: <20231208172152.GD36716@noisy.programming.kicks-ass.net> References: <20231204181614.GA7299@noisy.programming.kicks-ass.net> <20231204183354.GC7299@noisy.programming.kicks-ass.net> <20231206163814.GB36423@noisy.programming.kicks-ass.net> <20231206183713.GA35897@noisy.programming.kicks-ass.net> <20231207093105.GA28727@noisy.programming.kicks-ass.net> <20231208102940.GB28727@noisy.programming.kicks-ass.net> <20231208134041.GD28727@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208134041.GD28727@noisy.programming.kicks-ass.net> On Fri, Dec 08, 2023 at 02:40:41PM +0100, Peter Zijlstra wrote: > On Fri, Dec 08, 2023 at 11:29:40AM +0100, Peter Zijlstra wrote: > > The only problem I now have is the one XXX, I'm not entirely sure what > > signature to use there. > > > @@ -119,6 +119,7 @@ int bpf_struct_ops_test_run(struct bpf_p > > op_idx = prog->expected_attach_type; > > err = bpf_struct_ops_prepare_trampoline(tlinks, link, > > &st_ops->func_models[op_idx], > > + /* XXX */ NULL, > > image, image + PAGE_SIZE); > > if (err < 0) > > goto out; > > Duh, that should ofcourse be something of dummy_ops_test_ret_fn type. > Let me go fix that. Next one.. bpf_obj_free_fields: field->kptr.dtor(xchg_field); The one that trips is bpf_cgroup_release(). objtool doesn't think the address of that function 'escapes' and 'helpfully' seals that function, and then BPF thinks it does escape and manages the above indirect call and *boom*. How can I tell which functions escape according to BPF such that I might teach objtool this?