ppc64 BPF JIT mod by 1 will not return 0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Thadeu Lima de Souza Cascardo | ||
Focal |
Fix Released
|
Medium
|
Thadeu Lima de Souza Cascardo | ||
Hirsute |
Fix Released
|
Medium
|
Unassigned | ||
Impish |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
When doing MOD by 1 with a immediate/constant divisor on PPC, the JIT will produce code that returns the dividend, just like a division, instead of 0.
Both eBPF and cBPF will fail as well when doing such operations.
[Test case]
$ cat bpf-mod1.c
#include <linux/bpf.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/socket.h>
#include <stdio.h>
#include <sys/prctl.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <err.h>
#include <string.h>
#include <linux/filter.h>
#define ARRAY_SIZE(array) (sizeof(
static int pair[2];
static int attach()
{
int r;
struct sock_filter insn[] = {
{ BPF_LD | BPF_W | BPF_ABS, 0, 0, 0 },
{ BPF_ALU | BPF_MOD, 0, 0, 1 },
{ BPF_RET | BPF_A, 0, 0, 0 },
};
struct sock_fprog prog = {};
prog.filter = insn;
prog.len = ARRAY_SIZE(insn);
return 0;
}
int main(int argc, char **argv)
{
int buf[5];
int r;
r = attach();
if (r < 0) {
}
r = recv(pair[1], buf, 5, MSG_DONTWAIT);
if (r != -1 || errno != EAGAIN) {
}
return 0;
}
$ gcc -o bpf-mod1 bpf-mod1.c
$ ./bpf-mod1
cbpf-mod1: program failed: Success
After fix:
$ ./bpf-mod1
$ echo $?
0
[Potential regression]
BPF programs might be misbehave on ppc64el.
=======
This is a scripted bug report about ADT failures while running linux tests for linux/5.4.0-90.101 on focal. Whether this is caused by the dep8 tests of the tested source or the kernel has yet to be determined.
Consistently failing on Focal/linux 5.4.0-90.101
13:15:26 DEBUG| [stdout] # selftests: net: test_bpf.sh
13:15:27 DEBUG| [stdout] # test_bpf: [FAIL]
13:15:27 DEBUG| [stdout] not ok 9 selftests: net: test_bpf.sh # exit=1
Testing failed on:
ppc64el: https:/
tags: | added: kernel-adt-failure |
tags: | added: focal |
description: | updated |
summary: |
- linux ADT test failure with linux/5.4.0-90.101 + linux ADT test_bpf failure with linux/5.4.0-90.101 |
summary: |
- linux ADT test_bpf failure with linux/5.4.0-90.101 + ppc64 BPF JIT mod by 1 will not return 0 |
description: | updated |
Changed in linux (Ubuntu Hirsute): | |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in linux (Ubuntu Impish): | |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in linux (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Focal): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Hirsute): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Impish): | |
status: | In Progress → Fix Committed |
This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:
apport-collect 1948351
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.