Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2579634rdb; Mon, 4 Dec 2023 01:14:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQmVpHKit0+tK+RlCmojql+oipwa8Hg1h2/PRrR2SyZYBdXo/ALAcyLHvAhcsExTRRruej X-Received: by 2002:a17:90a:1a03:b0:286:6dfd:2e34 with SMTP id 3-20020a17090a1a0300b002866dfd2e34mr2860959pjk.3.1701681294046; Mon, 04 Dec 2023 01:14:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701681294; cv=none; d=google.com; s=arc-20160816; b=scpchdb4dHTf1X3wReVQ/Y6wa9MSuZfgZcaFbVjY1ZNZVyCHwHoYQKnTBowLmyxd5i w67VGnXW4mbGhDiuSyvZIS/tkTyYKfwPw4tGEuGph8BxoykDqPtrbl6ZlDWEPdpQqmkr E81XIrYjSmQp6kKhdavPCUAvdN2FSziocvau2gHXO/eCwULcer3fyWrHAz4hkEG0JWNT XZ2rmHcLGxgrqXhEiIEdGTqY/c5rqeciZlCe79y162QKmJZtfrmKE7Od71Ol/eom+R9W m2tgQbDJXvGwuDl/kYtL9tf5PyFas6Fx0blVa861iJ6LF/vgGOixD8IzE/GnDo5Fjx/x vwtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=17YJ1z3ogS9ZFtbiaMgUZd7PQ1LHRkBWBWcBGoc/CJ8=; fh=jpJmDfseQLLi9201SgBoJxN/jukEaMZLkkomvjEx4SU=; b=kafvxiOpYO2S7Djsx5nPatb7OiVuX5zrY0f/wGW1GwTqucE3MSCDKo1fz193hDqtHu ikTQOloU7YLMjeupaWH3agXCPpQhhEW8lz+wW8/yc1e/1KK2Lg87uVBHrSrWjTSL7Ec3 +/L+uiWtWDIUHEn2euS5CxI5PaIZlicaf07/H4FSmaxABvhU2BMtEpzgqfGY0DPO557P swS84AJVe8AHYiyIO7TBI1r5cLoV/5EAfdfkqkh7C/3x9Lv6Z1IJzhbuHSRAnum+kifb +SzZoEpsTGp0pFY5A+XFdeZzeUGW3vrUIXlFlrmg+iVoA0sc5+xUgEwzrQIMpXHEIo9V RdGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="Oq2r/tZ4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b8-20020a17090a488800b00286b45aef08si1238715pjh.163.2023.12.04.01.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:14:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="Oq2r/tZ4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B0FA8805BCB5; Mon, 4 Dec 2023 01:14:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbjLDJO3 (ORCPT + 99 others); Mon, 4 Dec 2023 04:14:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjLDJO2 (ORCPT ); Mon, 4 Dec 2023 04:14:28 -0500 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 B4E3CCD; Mon, 4 Dec 2023 01:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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; bh=17YJ1z3ogS9ZFtbiaMgUZd7PQ1LHRkBWBWcBGoc/CJ8=; b=Oq2r/tZ4GMYvXmULCX+LD6Qfz7 HO9OVNz8XCXQMgxz/LWfORxgl/H3LTq81ngFJsgHC93qrKcMcjpBQX8v5qQhdci74NGvXZAJ/yVju sK9gFvSFKKjG+KTta5qWhde5JaQQriDgSlX54kLf3MXV6oHLk1PYPA8HeGphIfHdNTawm8bbTLJrU NgcMlwn6/lrZmRXbfPHQFRxpn4ftLCB5eM9fnRnJvlMZpH3BmDJrGqa4dnsA7VRIdxnJbQVajyNOi Bn006jXGBXzTqb9dfS3GtKtm0DDTPpLydkfwONe+R1/uAJi3EvwQfUiJ18EbM5lGDJHCoVpl5xoSe 3fM7hPwA==; 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.96 #2 (Red Hat Linux)) id 1rA51D-004JwZ-2M; Mon, 04 Dec 2023 09:13:35 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 4D01F300472; Mon, 4 Dec 2023 10:13:34 +0100 (CET) Date: Mon, 4 Dec 2023 10:13:34 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: 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 , Jiri Olsa , 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: <20231204091334.GM3818@noisy.programming.kicks-ass.net> References: <20231130133630.192490507@infradead.org> <20231130134204.136058029@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 01:14:52 -0800 (PST) On Sun, Dec 03, 2023 at 02:56:34PM -0800, Alexei Starovoitov wrote: > On Thu, Nov 30, 2023 at 5:43 AM Peter Zijlstra wrote: > > > > > > void bpf_prog_kallsyms_del(struct bpf_prog *fp) > > @@ -691,6 +708,9 @@ void bpf_prog_kallsyms_del(struct bpf_pr > > return; > > > > bpf_ksym_del(&fp->aux->ksym); > > +#ifdef CONFIG_FINEIBT > > + bpf_ksym_del(&fp->aux->ksym_prefix); > > +#endif > > } > > Thank you for addressing all comments, but it panics during boot with: > > [ 3.109474] RIP: 0010:bpf_prog_kallsyms_del+0x10f/0x140 > [ 3.109867] Code: 26 e0 00 ff 05 32 dd dd 01 48 8d bb 80 03 00 00 > 48 c7 c6 b8 b3 00 83 e8 ef 25 e0 00 48 8b 83 58 03 00 00 48 8b 8b 60 > 03 00 00 <48> 89 48 08 48 89 01 4c 89 b3 60 03 00 00 48 c7 c7 10 0b 7b > 83 5b > [ 3.111282] RSP: 0000:ffffc90000013e08 EFLAGS: 00010246 > [ 3.116968] Call Trace: > [ 3.117163] > [ 3.117328] ? __die_body+0x68/0xb0 > [ 3.117599] ? page_fault_oops+0x317/0x390 > [ 3.117909] ? debug_objects_fill_pool+0x19/0x440 > [ 3.118283] ? debug_objects_fill_pool+0x19/0x440 > [ 3.118715] ? do_user_addr_fault+0x4cd/0x560 > [ 3.119045] ? exc_page_fault+0x62/0x1c0 > [ 3.119350] ? asm_exc_page_fault+0x26/0x30 > [ 3.119675] ? bpf_prog_kallsyms_del+0x10f/0x140 > [ 3.120023] ? bpf_prog_kallsyms_del+0x101/0x140 > [ 3.120381] __bpf_prog_put_noref+0x12/0xf0 > [ 3.120704] bpf_prog_put_deferred+0xe9/0x110 > [ 3.121035] bpf_prog_put+0xbb/0xd0 > [ 3.121307] bpf_prog_release+0x15/0x20 > > Adding the following: > > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c > index 5c84a935ba63..5013fd53adfd 100644 > --- a/kernel/bpf/core.c > +++ b/kernel/bpf/core.c > @@ -709,6 +709,8 @@ void bpf_prog_kallsyms_del(struct bpf_prog *fp) > > bpf_ksym_del(&fp->aux->ksym); > #ifdef CONFIG_FINEIBT > + if (cfi_mode != CFI_FINEIBT) > + return; > bpf_ksym_del(&fp->aux->ksym_prefix); > #endif > } > > fixes the boot issue, but test_progs is not happy. Damn, I'm an idiot :-), I knew I should've boot tested all configurations again :/ > Just running test_progs it splats right away: > > [ 74.047757] kmemleak: Found object by alias at 0xffffffffa0001d80 > [ 74.048272] CPU: 14 PID: 104 Comm: kworker/14:0 Tainted: G W > O 6.7.0-rc3-00702-g41c30fec304d-dirty #5241 > [ 74.049118] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), > BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 > [ 74.050042] Workqueue: events bpf_prog_free_deferred > [ 74.050448] Call Trace: > [ 74.050663] > [ 74.050841] dump_stack_lvl+0x55/0x80 > [ 74.051141] __find_and_remove_object+0xdb/0x110 > [ 74.051521] kmemleak_free+0x41/0x70 > [ 74.051828] vfree+0x36/0x130 Durr, I'll see if I can get that stuff running locally, and otherwise play with the robot as you suggested. Thanks!