Public bug reported: Good morning, we are currently porting an old kernel driver to Linux kernel 5.4.0-126 on Ubuntu 20.04.5 LTS and noted odd behaviour that doesn't occur with the same kernel version on Ubuntu 20.04.6 LTS.
The installation is fresh and based on the Ubuntu Server images + OpenSSH and the generic kernel. ii linux-headers-5.4.0-126 5.4.0-126.142 all Header files related to Linux kernel version 5.4.0 ii linux-headers-5.4.0-126-generic 5.4.0-126.142 amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP ii linux-image-5.4.0-126-generic 5.4.0-126.142 amd64 Signed kernel image generic ii linux-modules-5.4.0-126-generic 5.4.0-126.142 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP The driver basically opens a raw socket and configures mac address filtering based on BPF with sock_setsockopt. struct sock_filter lsf_code[] = { { 0x20, 0, 0, 0x00000008 }, { 0x15, 0, 3, 0xcc112233 }, { 0x28, 0, 0, 0x00000006 }, { 0x15, 0, 1, 0x0000aabb }, { 0x6, 0, 0, 0x0000ffff }, { 0x6, 0, 0, 0x00000000 }, }; struct sock_fprog lsf = { .len = ARRAY_SIZE(lsf_code), .filter = lsf_code, }; lsf_code[1].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[2])); lsf_code[3].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[0])) >> 16; if ((result = kernel_setsockopt(eci->sock, SOL_SOCKET, SO_ATTACH_FILTER, (char *)&lsf, sizeof(lsf))) < 0) { PRINTE("eci_open2(%d): attachment of LSF to socket failed - result %d\n", eci->dev, result); return (result); } Thank you very much and Best Regards, Florian Scholz ** Affects: ubuntu Importance: Undecided Status: New ** Description changed: - Good morning, + Good morning, we are currently porting an old kernel driver to Linux kernel 5.4.0-126 on Ubuntu 20.04.5 LTS and noted odd behaviour that doesn't occur with the same kernel version on Ubuntu 20.04.6 LTS. The installation is fresh and based on the Ubuntu Server images + OpenSSH and the generic kernel. ii linux-headers-5.4.0-126 5.4.0-126.142 all Header files related to Linux kernel version 5.4.0 ii linux-headers-5.4.0-126-generic 5.4.0-126.142 amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP ii linux-image-5.4.0-126-generic 5.4.0-126.142 amd64 Signed kernel image generic ii linux-modules-5.4.0-126-generic 5.4.0-126.142 amd64 Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP The driver basically opens a raw socket and configures mac address filtering based on BPF with sock_setsockopt. - struct sock_filter lsf_code[] = { - { 0x20, 0, 0, 0x00000008 }, - { 0x15, 0, 3, 0xcc112233 }, - { 0x28, 0, 0, 0x00000006 }, - { 0x15, 0, 1, 0x0000aabb }, - { 0x6, 0, 0, 0x0000ffff }, - { 0x6, 0, 0, 0x00000000 }, - }; - struct sock_fprog lsf = { - .len = ARRAY_SIZE(lsf_code), - .filter = lsf_code, - }; - lsf_code[1].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[2])); - lsf_code[3].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[0])) >> 16; - sock_setsockopt(eci->sock, SOL_SOCKET, SO_DETACH_FILTER, *((sockptr_t *)&timeout), sizeof(timeout)); - - + struct sock_filter lsf_code[] = { + { 0x20, 0, 0, 0x00000008 }, + { 0x15, 0, 3, 0xcc112233 }, + { 0x28, 0, 0, 0x00000006 }, + { 0x15, 0, 1, 0x0000aabb }, + { 0x6, 0, 0, 0x0000ffff }, + { 0x6, 0, 0, 0x00000000 }, + }; + struct sock_fprog lsf = { + .len = ARRAY_SIZE(lsf_code), + .filter = lsf_code, + }; + lsf_code[1].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[2])); + lsf_code[3].k = ntohl(*((__u32 *)&eci->cfg.dst_ieee[0])) >> 16; + if ((result = kernel_setsockopt(eci->sock, SOL_SOCKET, SO_ATTACH_FILTER, (char *)&lsf, sizeof(lsf))) < 0) { + PRINTE("eci_open2(%d): attachment of LSF to socket failed - result %d\n", + eci->dev, result); + return (result); + } Thank you very much and Best Regards, Florian Scholz -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2069807 Title: BPF Filtering issues with 20.04.5/5.4.0-126 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+bug/2069807/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs