From patchwork Mon Sep 18 15:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 13389978 X-Patchwork-Delegate: bpf@iogearbox.net Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EBD41D686 for ; Mon, 18 Sep 2023 16:06:53 +0000 (UTC) Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C42B2D42 for ; Mon, 18 Sep 2023 09:06:47 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id 38308e7fff4ca-2bfea381255so37284011fa.3 for ; Mon, 18 Sep 2023 09:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695053205; x=1695658005; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bWLbZ1J0oeUlS0QBC3LOMF2rfKN6MrliiLEkPfiun10=; b=OVZd0AGJaBh7AmWJ+ZE/PYG5u0oil6BFKksvf2l+T5UKJfN5ZYr7LbwwJD0YgdsbqG VQDWQTTHKfNGIyUczEHH7POKEA/yf36GiKW+J0VIHZ8Bcon5Do9eUe1cCygf4+rKp0K3 /6tYosjlSIf26p5q/pE+GfY2HO+zWaITREFYKsceUWcGg18dPpENEcxgLoUSGQ5IHrwb 688bf4XLwamCrBw7ruWqlKT6vDfmOckywdmUhvyFCleTz0kD5QJv/5nkhG6dPnlpoGjb WLn/tWzSn6nBgz8OMquzeCxoItPTNQGUDz0mQ5efzgGvEH2qliih5fsvwZ9+Vb/Koe18 G2gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053205; x=1695658005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWLbZ1J0oeUlS0QBC3LOMF2rfKN6MrliiLEkPfiun10=; b=e0pHHMNPeioAL6lzmqKc1RtCOZqmV5jitvEh9H5Y7IuD/a+LNj5W9Z5ypz2/F25ZkC t7KsL3fAA0UE2LxdiKDLkopCn5c0EFxTxdsZDw4yFBXyy9Zhon3rlHlRJtQeXnoCNv3O vWp//I6cis9u3nVUuhP13JinnLRDU4nsXFETxBpa5Mry4V05Lst4//W0A8wPW1kdwdjR P5FlE0Zzn5BP/Py/w4KGM7fwBYQiAy3NniuZxqK8PzX7omdwEEULywzJzyqdqA1mxiI9 Fb1EQAjf07WWgxUn53ST4oI7rorKYLxGYvNb3yIMTge4I8ciqIDshycujBr+dwJAoXLH dg+w== X-Gm-Message-State: AOJu0YyDJtsKjyTifM2rym6Prrer/fn8owcrVoGQ4jtFkLXRFbFAbxFh WjbtzvF5zhRh1lmZzQSamIH+adzn7YHzvQ== X-Google-Smtp-Source: AGHT+IFGZzuVgpOzjT+QEt1YLmcP1fk7iBZXUwlC0/Soo2Om0V0LGTdLXDmQs75mDcOc7LEvADMLKw== X-Received: by 2002:a05:6512:3150:b0:503:4c3:c67d with SMTP id s16-20020a056512315000b0050304c3c67dmr3924834lfi.21.1695052355315; Mon, 18 Sep 2023 08:52:35 -0700 (PDT) Received: from localhost ([212.203.98.42]) by smtp.gmail.com with ESMTPSA id br13-20020a170906d14d00b0099cf9bf4c98sm6718919ejb.8.2023.09.18.08.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:52:35 -0700 (PDT) From: Kumar Kartikeya Dwivedi To: bpf@vger.kernel.org, Alexei Starovoitov Subject: [PATCH bpf-next v2 1/3] selftests/bpf: Print log buffer for exceptions test only on failure Date: Mon, 18 Sep 2023 17:52:31 +0200 Message-ID: <20230918155233.297024-2-memxor@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918155233.297024-1-memxor@gmail.com> References: <20230918155233.297024-1-memxor@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1440; i=memxor@gmail.com; h=from:subject; bh=oHvLk0ZHhNY+L7Ri8crRqUByZW+W4S/TRihF1kQbWZ4=; b=owEBbQKS/ZANAwAIAUzgyIZIvxHKAcsmYgBlCHIa68qPVyIcWw95cm+Qf50mRMtCOeMoIpeaU jCwVNvFr96JAjMEAAEIAB0WIQRLvip+Buz51YI8YRFM4MiGSL8RygUCZQhyGgAKCRBM4MiGSL8R yrvMEACbNYE+XIIY2psVobAp7Jq00IF1//D0Z3HR2Ey/H/3oSyySfVWZBXDdGOiHWaS+srxfx/L +xNCRMZNjrqLkMhZRTjCCM5zgl6Wr+mtIBPvICkmK1Jc1n/ni5nWAx0Me29uwxyCMdTCuuv6koW vr0/6P6XjDlzNDNNpfp0GwolRHpSJNzunIrdbmCgcipJC9e8zlGVbu+m3aGqMLFdYNm0peDNhs1 uFYR/GmIwvY+ElkdndTPZRgtJkiO5Cj5Yiw/uTYRYNOMm3ZuE9Nj8Jm3Z5CVNsMOSzGmch5TIXG /UkispHOmzko/dKQaHjnIqK06vJY+EeAXOzfhC1269AOqgP4eE5+TpTARMtXbw7J+n7N2JSnKm3 PDc8FFnUF7HqAFRrS0VCottARFOplMOUxhXwRPXyk6FGfSoUdEqgxk1JeRvQl9T5JmYfCmYQbVh tsHvsf5MelsLda2WWZEyC5uy7r8OpFCu6CSG2HtYM4d772cD3Veh+/Ix/LILsjwQrrUnjf6XBM4 hNoen8qwVOIxKvz+Lu/w5CUKqAepACsUqqfgej1WFOb81qKslyLYHHPuDbMoope1E0amZ5CZa6k iuZjFcqyOtNUHnzZ7+BmXqd08FMj0SgqxYyuUeAVaAPs8EMzSxTZ2uCiMtl2W5/v0Pf8TFX2DEk HCGP329+HvxrODA== X-Developer-Key: i=memxor@gmail.com; a=openpgp; fpr=4BBE2A7E06ECF9D5823C61114CE0C88648BF11CA X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: bpf@iogearbox.net Alexei reported seeing log messages for some test cases even though we just wanted to match the error string from the verifier. Move the printing of the log buffer to a guarded condition so that we only print it when we fail to match on the expected string in the log buffer, preventing unneeded output when running the test. Reported-by: Alexei Starovoitov Fixes: d2a93715bfb0 ("selftests/bpf: Add tests for BPF exceptions") Signed-off-by: Kumar Kartikeya Dwivedi --- tools/testing/selftests/bpf/prog_tests/exceptions.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions.c b/tools/testing/selftests/bpf/prog_tests/exceptions.c index 5663e427dc00..516f4a13013c 100644 --- a/tools/testing/selftests/bpf/prog_tests/exceptions.c +++ b/tools/testing/selftests/bpf/prog_tests/exceptions.c @@ -103,9 +103,10 @@ static void test_exceptions_success(void) goto done; \ } \ if (load_ret != 0) { \ - printf("%s\n", log_buf); \ - if (!ASSERT_OK_PTR(strstr(log_buf, msg), "strstr")) \ + if (!ASSERT_OK_PTR(strstr(log_buf, msg), "strstr")) { \ + printf("%s\n", log_buf); \ goto done; \ + } \ } \ if (!load_ret && attach_err) { \ if (!ASSERT_ERR_PTR(link = bpf_program__attach(prog), "attach err")) \ From patchwork Mon Sep 18 15:52:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 13389951 X-Patchwork-Delegate: bpf@iogearbox.net Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED845210FE for ; Mon, 18 Sep 2023 15:57:35 +0000 (UTC) Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DAFDCFE for ; Mon, 18 Sep 2023 08:56:05 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id 38308e7fff4ca-2bceb02fd2bso74336221fa.1 for ; Mon, 18 Sep 2023 08:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695052356; x=1695657156; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r3Naoc4gG2mkQtePsEFFN2S+1KQG8MR2mniab1JfQY8=; b=Fw1MxHRBkKJkn49R8RH/rNdsfLedph0ccvFhQObxQFFTcGtd8qwWgjzDi6MAlzoRmf BqQm+iuW3y1mDZzNkxoWFD67s2ztIqa1W2wXhFb8xVcQzrbXRAp8nUXpqJ4pOhivf5iA DYixf+G7iLmqP9Q2MJMer5VT+v2yk5QtqY/SMYU/lR9jL1OSjjjW/FM0aZZzvDXL3koy MHGgQqGHXK4mzo5F4OU0CI4DJHfywHAlRUVp8HXG9PNOXqBm7d3/nYDoOJVzSVtQupIz 01gfiq1IGRsYOO1zToaYL1eH23dTQ6yOLJwmUrkcDjf2vOp+9Om7jrqvlpQKcYF/Us4+ jahg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695052356; x=1695657156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r3Naoc4gG2mkQtePsEFFN2S+1KQG8MR2mniab1JfQY8=; b=DyCxBPcShzIztOUE5IPVbGg+WiU7tsMPjlqsctvKIuM9KHiuPJcgzSTv3mxM7baB77 sVqWoJfeiUt84/fbJPSAnJSrk6krLbEgZw4QzsD1mhYY6HzKghXwQX4zF9M9ZvDnrOMz PisqwXhpUkhtCEw3QC5pe1ah1ap6nzkCZOHBS9lgmETZ2z3asz0nA+iYmlFiLDPQ7eDQ 55JI/muQwo7pdMaJRB3XuJNmK8LOMSUJemMg102fK2FO2J+aAg8eNf/2TITX49atVwX5 gUSIDD56iqA629Pu5IwJl4v3Thf0vaup3ctRbCxn93Q3SzcnyEivVtfv5XBDHXknXevF KFgA== X-Gm-Message-State: AOJu0YwbCC7CzaS6OL7rD8iodCbwqn4MGk0jqQKI1X+/Kx5EmBQKwOOB zDy3yQEubXmzA+YRzRs0qglx0M3oG3SWBA== X-Google-Smtp-Source: AGHT+IHEu4b5ilDrB4Wp4Zb94qoobwGh+3gjWyR5Vsg0C2KUdWJXzB3lWzI9xKmoLjTGAb2m5yyvGA== X-Received: by 2002:a2e:8699:0:b0:2bd:124a:23d5 with SMTP id l25-20020a2e8699000000b002bd124a23d5mr8364620lji.11.1695052356274; Mon, 18 Sep 2023 08:52:36 -0700 (PDT) Received: from localhost ([212.203.98.42]) by smtp.gmail.com with ESMTPSA id cw17-20020a170906c79100b009a1a5a7ebacsm6562382ejb.201.2023.09.18.08.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:52:35 -0700 (PDT) From: Kumar Kartikeya Dwivedi To: bpf@vger.kernel.org, Alexei Starovoitov Cc: Matthieu Baerts Subject: [PATCH bpf-next v2 2/3] bpf: Fix bpf_throw warning on 32-bit arch Date: Mon, 18 Sep 2023 17:52:32 +0200 Message-ID: <20230918155233.297024-3-memxor@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918155233.297024-1-memxor@gmail.com> References: <20230918155233.297024-1-memxor@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1155; i=memxor@gmail.com; h=from:subject; bh=ZOTWQIcL62XArqSGkyZTul7LUdFIfys+cfEYyQUk+J0=; b=owEBbQKS/ZANAwAIAUzgyIZIvxHKAcsmYgBlCHIaNFkPeR7f1jtQEtzuoZ6FDD6EEp2fT9oP7 fA8CdQa9qiJAjMEAAEIAB0WIQRLvip+Buz51YI8YRFM4MiGSL8RygUCZQhyGgAKCRBM4MiGSL8R ymTiD/4+XQAID0U0/VEaVYzF27fHunGa+xd78zxWBh4U4FL+bYJsuEhpdh4sELa5wVPPlFbZ2fo zRjlYA/JoH9w04QLBZoxxDwUIxGbqepd6mW6BT0Tc/1I+xa6H8L0dfg8Cd5aRRD8lkf4O5LCrus J84jJsJzo2nxJf4teHDbJGW/Wala4zXZG+y3675Lox3EuqP0/xdjwcKZCzfPXqgB4JrpDpiqtcg c9cNccxQdvneCYtv3C2Esi9gQE+yU5ghiVxOAR/JV2Gsq1HC96mNoSd8Z21YoXU6/LbQAnFZUsG +tTIscwsNTBVT970fPK6EdejA+DKoSTLG1YDdlhA540Ge+WQZq+hXFmws2iLC8V72V4aC+pizDm siWPpTfEC1dj58Xziu4JZt6DjjvDOrM+xdp9qxF8kJPqsEyRgTu272d0Fw3n0Rd0r2yI4CgPOjo fjzl34e6n4utaAYnnNcAdaN7WiRecqhmONn9Aga8rEHZG2UoKK2Z97RZiBwufTO4E8Y1XLTP/l/ pbLb6tHtxcfMBk02KxnllapmX5Rr1lOaQMlAqGI91V0dHlb0byQY/Gj1J/WasEhx0WTYmalENcJ L5i1H9MCPPBLbGGa5PQ9pPiujMrxgepLXUgjBONMeg/cwvYsPe8Sboco5+NHFV75d5ZBiX9WXKn fagwd/IEij2HzFA== X-Developer-Key: i=memxor@gmail.com; a=openpgp; fpr=4BBE2A7E06ECF9D5823C61114CE0C88648BF11CA X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: bpf@iogearbox.net On 32-bit architectures, the pointer width is 32-bit, while we try to cast from a u64 down to it, the compiler complains on mismatch in integer size. Fix this by first casting to long which should match the pointer width on targets supported by Linux. Fixes: ec5290a178b7 ("bpf: Prevent KASAN false positive with bpf_throw") Reported-by: Matthieu Baerts Signed-off-by: Kumar Kartikeya Dwivedi Tested-by: Matthieu Baerts --- kernel/bpf/helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 7ff2a42f1996..dd1c69ee3375 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -2488,7 +2488,7 @@ __bpf_kfunc void bpf_throw(u64 cookie) * deeper stack depths than ctx.sp as we do not return from bpf_throw, * which skips compiler generated instrumentation to do the same. */ - kasan_unpoison_task_stack_below((void *)ctx.sp); + kasan_unpoison_task_stack_below((void *)(long)ctx.sp); ctx.aux->bpf_exception_cb(cookie, ctx.sp, ctx.bp); WARN(1, "A call to BPF exception callback should never return\n"); } From patchwork Mon Sep 18 15:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Kartikeya Dwivedi X-Patchwork-Id: 13389977 X-Patchwork-Delegate: bpf@iogearbox.net Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 966231D686 for ; Mon, 18 Sep 2023 16:06:51 +0000 (UTC) Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F8E19A2 for ; Mon, 18 Sep 2023 09:06:45 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id 2adb3069b0e04-50098cc8967so7528000e87.1 for ; Mon, 18 Sep 2023 09:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695053203; x=1695658003; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1YiCPcSujgZLNKIlHUVm+vvy2lgJ4MowgcIqAbJ/rmc=; b=gYEMA+NhTkr/hNqwQMjplCRSMuOO4nfMYQnMaNGWetrENvqzp4005/OGHhYJj9G825 TVO/WU1zXRKwLiSn6gy5gTJJG48CZWevnYUTw4iBwIeoA/BDLROC7M3rurC89ozSR5uu bS+bxnAO56uAemegFqqLcnxOpGMriFuYoYHAY/TdkN3VZeK2cmvy2BhDVmKlUTA+psD1 mVVzfJcARsBxRjY77GttkctD9Z+5F1KpCUsAN9/YkOs4iekjK2ojljyEOBqHebXh3rPo sFg2w2ryR+1dQnlyjA1kLsXDPrPHRF4X9SAnVbnbctYQbWQTOvhdzG2jH6HozPMnjyuJ Id0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053203; x=1695658003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1YiCPcSujgZLNKIlHUVm+vvy2lgJ4MowgcIqAbJ/rmc=; b=GnL4xT3LXsnDB/nPXJE+zQMzc4ZsFXaKMSN/aGwB/KJecQDfugZcme0usvuBjbhiQL SppJYHr8PPR4ZWCZ29ZIwnmbTN0bmPqoRSoXEFHBEgpBmPBnUWswF7LelErwxwQpzDHA vhxeDWbSI6kyADF7+AXqR/rIfN5NOfdbbeIQP1TDbL2VrVk5zHXodDKguqXcvmPH84Xi 0rnHUwqzjn85Uq4BEkBEKsTbfwEzBEn1OFO+nILyvkWfZVpa9iUvPVu1MPhNxJr0AfFa OHE4QakSlqsYivcHbG19e1edOjBm0ZIKf+uuQbLSYVsGKwy6oz72T87x8xK/gfupTiOE 5AlQ== X-Gm-Message-State: AOJu0Ywr5dLtwav8q/fxwUoIWYZ4ITnQdL5tlW+HJDQgKfCGrXcj0ihK 60+rEO5gB9HFm0ZlMGr5InU0OWdx0oVYSw== X-Google-Smtp-Source: AGHT+IGZ63uHr7xb+6+yIjHbZC6RnPGYoW5v5vZwhjSkYEJqnXZD6U3bLZ0wZTJ7ipA+egYhhP5fUg== X-Received: by 2002:a17:907:a07a:b0:99e:5d8:a6f9 with SMTP id ia26-20020a170907a07a00b0099e05d8a6f9mr7350590ejc.66.1695052357492; Mon, 18 Sep 2023 08:52:37 -0700 (PDT) Received: from localhost ([212.203.98.42]) by smtp.gmail.com with ESMTPSA id gy18-20020a170906f25200b00991d54db2acsm6661187ejb.44.2023.09.18.08.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:52:37 -0700 (PDT) From: Kumar Kartikeya Dwivedi To: bpf@vger.kernel.org, Alexei Starovoitov Cc: Eric Dumazet Subject: [PATCH bpf-next v2 3/3] bpf: Disable exceptions when CONFIG_UNWINDER_FRAME_POINTER=y Date: Mon, 18 Sep 2023 17:52:33 +0200 Message-ID: <20230918155233.297024-4-memxor@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918155233.297024-1-memxor@gmail.com> References: <20230918155233.297024-1-memxor@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1606; i=memxor@gmail.com; h=from:subject; bh=znk/eRrHas+L6qZGPKLxKYJFS9c8+0jZu8DHA5j7bn8=; b=owEBbQKS/ZANAwAIAUzgyIZIvxHKAcsmYgBlCHIalXKT6QxLcISac8/HqhxMxlkR+GK7znj4E +bFGXLmgz+JAjMEAAEIAB0WIQRLvip+Buz51YI8YRFM4MiGSL8RygUCZQhyGgAKCRBM4MiGSL8R ysPHD/4gckACQnt9mvKkYiRgnhJmWOPQxGufX4JBHc53OR+Z0aMe6D4ZBzuD7KWw9DKeGUENSej qHEqEjqb8eB4DBR7aOYQIyCmb1cA4F34x6jPKo0D5OB8xdslShwaiY5YL41+qLw4wNfr+eDuzwQ a9FWtK5l/Yz+r0cJHulHzv2TIXexpUDGPj8Z2UsrjI2pnsKCjcTZXyQtFZzF4kPUH279nHLX6Y5 T9ANfkl4mUalEyiOjpbRXs8SbDHlDDCZIlzuJbgEDGY4dDdKgnP0uV+Yc7+wY5Ll3ZCFcNOZnXt OWRnphkJ0JnZjSlygCtPP7jcWyJ/8f4mbl3q7MNjVRlhHTXP7O2Q6kcIKOA44P90MCk9/lA8TX5 er7vFMqWUt8CrSeN7l+6VIcPGkuY1zGZtbdWHwgncNgr8v7FdtUhk/AI6rpG7XZA96FkhNYvzX9 7e7HWHE/3SHjtfui0l97flCl3pQIyPTQg7x2xO9GW1fvaIUonAmPdY1u+Xwr8Hd4iMiay+tJSuA JvXoNFkxh7YUIwQjjCp3uP1d+b+r4UCcWH0CVXlZyb/0uFGJgcmZkA5fqAWbJhH/xXx/mykEbtJ vL3kLa2uzTOZ8dpk0tFYfQXHfvpP0Hj4X4C58hp5bYkoTkBrbbCYVhZ8yPXDrvKAhYJhDj2R+K0 o/twVQ07Fd+3f9Q== X-Developer-Key: i=memxor@gmail.com; a=openpgp; fpr=4BBE2A7E06ECF9D5823C61114CE0C88648BF11CA X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: bpf@iogearbox.net The build with CONFIG_UNWINDER_FRAME_POINTER=y is broken for current exceptions feature as it assumes ORC unwinder specific fields in the unwind_state. Disable exceptions when frame_pointer unwinder is enabled for now. Fixes: fd5d27b70188 ("arch/x86: Implement arch_bpf_stack_walk") Reported-by: Eric Dumazet Signed-off-by: Kumar Kartikeya Dwivedi --- arch/x86/net/bpf_jit_comp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 84005f2114e0..8c10d9abc239 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -3003,16 +3003,15 @@ void bpf_jit_free(struct bpf_prog *prog) bool bpf_jit_supports_exceptions(void) { /* We unwind through both kernel frames (starting from within bpf_throw - * call) and BPF frames. Therefore we require one of ORC or FP unwinder - * to be enabled to walk kernel frames and reach BPF frames in the stack - * trace. + * call) and BPF frames. Therefore we require ORC unwinder to be enabled + * to walk kernel frames and reach BPF frames in the stack trace. */ - return IS_ENABLED(CONFIG_UNWINDER_ORC) || IS_ENABLED(CONFIG_UNWINDER_FRAME_POINTER); + return IS_ENABLED(CONFIG_UNWINDER_ORC); } void arch_bpf_stack_walk(bool (*consume_fn)(void *cookie, u64 ip, u64 sp, u64 bp), void *cookie) { -#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER) +#if defined(CONFIG_UNWINDER_ORC) struct unwind_state state; unsigned long addr;