As Thadeu mentioned, this happens because the test_bpf module doesn't go through the verifier causing the failure when the code is not jitted. Upstream fixed the testcase with 21ccaf21497b (bpf: add further test cases around div/mod and others) by replacing "INT: DIV by zero" by "INT: DIV by -1" on test_bpf and moving/adding the div by zero tests to tools/testing/selftests/bpf/test_verifier.c.
Changing the div test from zero to -1 in bionic is trivial, however this would leave the zero case uncovered. Making the proper fix would require backporting 21ccaf21497b, which in turn would need at least 87c1793b1b7f (bpf: add couple of test cases for div/mod by zero) and 111e6b45315c (selftests/bpf: make test_verifier run most programs) but possibly many others.
As Thadeu mentioned, this happens because the test_bpf module doesn't go through the verifier causing the failure when the code is not jitted. Upstream fixed the testcase with 21ccaf21497b (bpf: add further test cases around div/mod and others) by replacing "INT: DIV by zero" by "INT: DIV by -1" on test_bpf and moving/adding the div by zero tests to tools/testing/ selftests/ bpf/test_ verifier. c.
Changing the div test from zero to -1 in bionic is trivial, however this would leave the zero case uncovered. Making the proper fix would require backporting 21ccaf21497b, which in turn would need at least 87c1793b1b7f (bpf: add couple of test cases for div/mod by zero) and 111e6b45315c (selftests/bpf: make test_verifier run most programs) but possibly many others.