Comment 0 for bug 2069807

Revision history for this message
Florian Scholz (natflorian) wrote :

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));

Thank you very much and Best Regards,
Florian Scholz