From patchwork Thu Feb 1 12:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13541043 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A20E7C47DDB for ; Thu, 1 Feb 2024 12:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=GJOAnFksgtaILlqWKOjw3eYKnv2fZH66n6wjR+MZECA=; b=pCbu8acV/PFoAx LlBXIyLbN4lC+2EJ6mGEZ8d7oiWMMQQPz/qj8q815ZjODKBVuodSgctcVs8wJtdlMhnpHal3s3x42 plTOwgR7EBX+gu1rVar0l5BfNMgpW3W4jmOaRDhRzZ6eGDee0x2LUa64jrYg0H3cK06zKTNEzclGo qOHF7bL6inokZzt8pPhmp0ClsVfqPI3qnWEk7qxS1+Ql91p0eD/WBYaMn+FmHdZKDZQubWYrqRJBj NfCA2CdPUEUrB0G5mNPnohKjpPJBaYYf/JGV86pHpMX0P7yN/orFmulavTuY7QgMWWtS2JXbZbTmg pqvSrSyyhkZ7Qqo1BwZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVWYk-00000007q3D-01b9; Thu, 01 Feb 2024 12:52:50 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVWYh-00000007q2i-2Arl for linux-arm-kernel@lists.infradead.org; Thu, 01 Feb 2024 12:52:48 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40fc2a6f8b6so1226875e9.2 for ; Thu, 01 Feb 2024 04:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706791965; x=1707396765; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jUeXDXBjzlWBB7hV8iOt1EuTewFUf9S8O5h3LKIL2UI=; b=Ue/IlR4nNyKqEfEXiOVL411GxvSq8MEjoCpJlCMmDsuQoYdgunjy+ocNkYaAa+yJG7 emSxl6D61u6HmGif02Td9Qm+yQx3B9liBE6ZS+X+fIAxGDGeJ6YIf/HHw1ehcVtIPlkN vdlMmCnjk10LfqOOYSNDLWiK2fJH6m/pTM64hSHVv1j0nkA1ED8CV0I8J0tQLZ8NpgL0 z2yoPWbWGPYP44nqxYtdUwzNE2OEaUVwNcwFZJRqYtcr0UXWvpnJo6N/h1sY6/59I5yO Pls9Rwu4hsEryCKrDzmdUOYZRl/WAPQPSVAFspGdNmbwev3YI8ocTLUKwHkZQT2e95FY kCjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706791965; x=1707396765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jUeXDXBjzlWBB7hV8iOt1EuTewFUf9S8O5h3LKIL2UI=; b=ifLbdhmmnA/aTaCV3RcpAzWlpKZRDiHnZsUNfiCOiqJn6734InIqU6y6tQHZ1udHvO +NMGyNUWWYvWGlJsqpOKEmnMae1s6zjybIr+PR29FiS7Uw6ja28F2Qb1uvpJ4p9666yg ZDqtOWDpNqOTf9Vhcd5FtZqeDgs/n2hi9d8D6vMR8Rc+TYZkweCc/f3ld1lB13+OBrl9 iaMKNgdOCvPp3YpIAlnWWVd9DnNCn6je4KTnyB5hHUfVaj1VDqLK2PjpAihOTwZz8iSH /Bpc9jIB/5hT/BKasAmPUp47Y06unrfdVR33R+DMD3ITVC7HoErYpHCcGiZqbwK4/PPs ezoA== X-Gm-Message-State: AOJu0Yx6a8JwIdjNE9uaODKyFja2rxN7FV183Q8XqFKCZgMcxTH2xrH7 ZnXRTN4N77AQzLKIJ3TqpMqU8laIsxMsr2KcKsQUMc0x/hF7ACwF X-Google-Smtp-Source: AGHT+IHDUedmH9atBsvi7Stca0/oxZ//g6mYBacWx5k46nhJj2xZmzoiYzWIK3trfs87XFhNdxKgKQ== X-Received: by 2002:a05:600c:4288:b0:40e:fbc8:401 with SMTP id v8-20020a05600c428800b0040efbc80401mr4102711wmc.20.1706791965328; Thu, 01 Feb 2024 04:52:45 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUDZSe3Y4z5SrksehFmwG5d/+bjBID1+Qy/LLH01OlCH9WZsCRrU2BOZpUrFEOvO124VLwqbVK6xDPnygMPKyldbUBUT4A+6+uNCIZFCWGWMX5atHPrwMV+5b27Yf+DI7Ar1PXkVIlUM05RTPZ7clOHvf3sxoy54zJFBpakbEyM07pcT4tdBiq9FnH2FtpYgKfZYf8cXsYqzDYzZ591m9uJfx1qm3HzLtaZ3llN0vD43ov0nTmsz4NjVPHhEMy0dAv3nJT0jSE0tHPWM3cgYKXFqV6YY108D1INoxDRU9h0EBFAJx9hZIvPM3+6qNOPbUdOaDw93qN/xv1O4kHEDyRdw5KoyvQgC6UQ4Yg+4ZjvukRnBA+UPYh8ApiTQSoAFYhXkTsOOR6UtixgRzreP7dNEAYHoAHN8Np4TuL05OxLe9ADAjoiPk7GNDmzxtYDZ8WmnSy9UNigarNtsNllQIuomSbEsUxQ12nUgGGZi/S8Rln6J0Vm6g7n5+FrA2Wuk0Cp+MJEwAinPjaZJnGlghu1m8b7DiUxHdcNDC4BdBUlNAMKfg== Received: from localhost (54-240-197-231.amazon.com. [54.240.197.231]) by smtp.gmail.com with ESMTPSA id l13-20020a05600c4f0d00b0040efbdd2376sm4382539wmq.41.2024.02.01.04.52.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2024 04:52:44 -0800 (PST) From: Puranjay Mohan To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Catalin Marinas , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kumar Kartikeya Dwivedi Cc: puranjay12@gmail.com Subject: [PATCH bpf-next v3 0/2] bpf, arm64: Support Exceptions Date: Thu, 1 Feb 2024 12:52:23 +0000 Message-Id: <20240201125225.72796-1-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240201_045247_583371_A3787B0E X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes in V2->V3: V2: https://lore.kernel.org/all/20230917000045.56377-1-puranjay12@gmail.com/ - Use unwinder from stacktrace.c rather than open coding the unwind logic. - Fix a bug in the prologue related to BPF_FP (Xu Kuohai) Changes in V1->V2: V1: https://lore.kernel.org/all/20230912233942.6734-1-puranjay12@gmail.com/ - Remove exceptions from DENYLIST.aarch64 as they are supported now. The base support for exceptions was merged with [1] and it was enabled for x86-64. This patch set enables the support on ARM64, all sefltests are passing: # ./test_progs -a exceptions #74/1 exceptions/exception_throw_always_1:OK #74/2 exceptions/exception_throw_always_2:OK #74/3 exceptions/exception_throw_unwind_1:OK #74/4 exceptions/exception_throw_unwind_2:OK #74/5 exceptions/exception_throw_default:OK #74/6 exceptions/exception_throw_default_value:OK #74/7 exceptions/exception_tail_call:OK #74/8 exceptions/exception_ext:OK #74/9 exceptions/exception_ext_mod_cb_runtime:OK #74/10 exceptions/exception_throw_subprog:OK #74/11 exceptions/exception_assert_nz_gfunc:OK #74/12 exceptions/exception_assert_zero_gfunc:OK #74/13 exceptions/exception_assert_neg_gfunc:OK #74/14 exceptions/exception_assert_pos_gfunc:OK #74/15 exceptions/exception_assert_negeq_gfunc:OK #74/16 exceptions/exception_assert_poseq_gfunc:OK #74/17 exceptions/exception_assert_nz_gfunc_with:OK #74/18 exceptions/exception_assert_zero_gfunc_with:OK #74/19 exceptions/exception_assert_neg_gfunc_with:OK #74/20 exceptions/exception_assert_pos_gfunc_with:OK #74/21 exceptions/exception_assert_negeq_gfunc_with:OK #74/22 exceptions/exception_assert_poseq_gfunc_with:OK #74/23 exceptions/exception_bad_assert_nz_gfunc:OK #74/24 exceptions/exception_bad_assert_zero_gfunc:OK #74/25 exceptions/exception_bad_assert_neg_gfunc:OK #74/26 exceptions/exception_bad_assert_pos_gfunc:OK #74/27 exceptions/exception_bad_assert_negeq_gfunc:OK #74/28 exceptions/exception_bad_assert_poseq_gfunc:OK #74/29 exceptions/exception_bad_assert_nz_gfunc_with:OK #74/30 exceptions/exception_bad_assert_zero_gfunc_with:OK #74/31 exceptions/exception_bad_assert_neg_gfunc_with:OK #74/32 exceptions/exception_bad_assert_pos_gfunc_with:OK #74/33 exceptions/exception_bad_assert_negeq_gfunc_with:OK #74/34 exceptions/exception_bad_assert_poseq_gfunc_with:OK #74/35 exceptions/exception_assert_range:OK #74/36 exceptions/exception_assert_range_with:OK #74/37 exceptions/exception_bad_assert_range:OK #74/38 exceptions/exception_bad_assert_range_with:OK #74/39 exceptions/non-throwing fentry -> exception_cb:OK #74/40 exceptions/throwing fentry -> exception_cb:OK #74/41 exceptions/non-throwing fexit -> exception_cb:OK #74/42 exceptions/throwing fexit -> exception_cb:OK #74/43 exceptions/throwing extension (with custom cb) -> exception_cb:OK #74/44 exceptions/throwing extension -> global func in exception_cb:OK #74/45 exceptions/exception_ext_mod_cb_runtime:OK #74/46 exceptions/throwing extension (with custom cb) -> global func in exception_cb:OK #74/47 exceptions/exception_ext:OK #74/48 exceptions/non-throwing fentry -> non-throwing subprog:OK #74/49 exceptions/throwing fentry -> non-throwing subprog:OK #74/50 exceptions/non-throwing fentry -> throwing subprog:OK #74/51 exceptions/throwing fentry -> throwing subprog:OK #74/52 exceptions/non-throwing fexit -> non-throwing subprog:OK #74/53 exceptions/throwing fexit -> non-throwing subprog:OK #74/54 exceptions/non-throwing fexit -> throwing subprog:OK #74/55 exceptions/throwing fexit -> throwing subprog:OK #74/56 exceptions/non-throwing fmod_ret -> non-throwing subprog:OK #74/57 exceptions/non-throwing fmod_ret -> non-throwing global subprog:OK #74/58 exceptions/non-throwing extension -> non-throwing subprog:OK #74/59 exceptions/non-throwing extension -> throwing subprog:OK #74/60 exceptions/non-throwing extension -> non-throwing subprog:OK #74/61 exceptions/non-throwing extension -> throwing global subprog:OK #74/62 exceptions/throwing extension -> throwing global subprog:OK #74/63 exceptions/throwing extension -> non-throwing global subprog:OK #74/64 exceptions/non-throwing extension -> main subprog:OK #74/65 exceptions/throwing extension -> main subprog:OK #74/66 exceptions/reject_exception_cb_type_1:OK #74/67 exceptions/reject_exception_cb_type_2:OK #74/68 exceptions/reject_exception_cb_type_3:OK #74/69 exceptions/reject_exception_cb_type_4:OK #74/70 exceptions/reject_async_callback_throw:OK #74/71 exceptions/reject_with_lock:OK #74/72 exceptions/reject_subprog_with_lock:OK #74/73 exceptions/reject_with_rcu_read_lock:OK #74/74 exceptions/reject_subprog_with_rcu_read_lock:OK #74/75 exceptions/reject_with_rbtree_add_throw:OK #74/76 exceptions/reject_with_reference:OK #74/77 exceptions/reject_with_cb_reference:OK #74/78 exceptions/reject_with_cb:OK #74/79 exceptions/reject_with_subprog_reference:OK #74/80 exceptions/reject_throwing_exception_cb:OK #74/81 exceptions/reject_exception_cb_call_global_func:OK #74/82 exceptions/reject_exception_cb_call_static_func:OK #74/83 exceptions/reject_multiple_exception_cb:OK #74/84 exceptions/reject_exception_throw_cb:OK #74/85 exceptions/reject_exception_throw_cb_diff:OK #74/86 exceptions/reject_set_exception_cb_bad_ret1:OK #74/87 exceptions/reject_set_exception_cb_bad_ret2:OK #74/88 exceptions/check_assert_eq_int_min:OK #74/89 exceptions/check_assert_eq_int_max:OK #74/90 exceptions/check_assert_eq_zero:OK #74/91 exceptions/check_assert_eq_llong_min:OK #74/92 exceptions/check_assert_eq_llong_max:OK #74/93 exceptions/check_assert_lt_pos:OK #74/94 exceptions/check_assert_lt_zero:OK #74/95 exceptions/check_assert_lt_neg:OK #74/96 exceptions/check_assert_le_pos:OK #74/97 exceptions/check_assert_le_zero:OK #74/98 exceptions/check_assert_le_neg:OK #74/99 exceptions/check_assert_gt_pos:OK #74/100 exceptions/check_assert_gt_zero:OK #74/101 exceptions/check_assert_gt_neg:OK #74/102 exceptions/check_assert_ge_pos:OK #74/103 exceptions/check_assert_ge_zero:OK #74/104 exceptions/check_assert_ge_neg:OK #74/105 exceptions/check_assert_range_s64:OK #74/106 exceptions/check_assert_range_u64:OK #74/107 exceptions/check_assert_single_range_s64:OK #74/108 exceptions/check_assert_single_range_u64:OK #74/109 exceptions/check_assert_generic:OK #74/110 exceptions/check_assert_with_return:OK #74 exceptions:OK Summary: 1/110 PASSED, 0 SKIPPED, 0 FAILED [1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?h=for-next&id=ec6f1b4db95b7eedb3fe85f4f14e08fa0e9281c3 Puranjay Mohan (2): arm64: stacktrace: Implement arch_bpf_stack_walk() for the BPF JIT bpf, arm64: support exceptions arch/arm64/kernel/stacktrace.c | 26 ++++++ arch/arm64/net/bpf_jit_comp.c | 87 +++++++++++++++----- tools/testing/selftests/bpf/DENYLIST.aarch64 | 1 - 3 files changed, 94 insertions(+), 20 deletions(-)