Public bug reported: Some protocols based on J1939 require PGNs be sent with different priorities. Although the priority can be set using setsockopt(2) with the SO_J1939_SEND_PRIO socket option, this requires two system calls to send a message leading to a potential race condition if the socket is shared between threads. The sendmsg(2) call allows socket options to be supplied as ancillary control data as part of a single send operation. However, it appears the J1939 driver does not process these options and messages are always transmitted with the priority set at the socket level. https://github.com/torvalds/linux/blob/a635d6748234582ea287c5ffeae28b9b23f91c7e/net/can/j1939/socket.c#L919 Ideally, sendmsg should allow any transmit-side socket options (e.g. SO_J1939_SEND_PRIO, SO_BROADCAST) to be supplied on a per-send basis. Attached is a simple C program to reproduce. the second sendmsg transmits with the default priority as observed in candump output: vcan0 1BFFFF42 [5] 48 65 6C 6C 6F vcan0 1BFFFF42 [5] 48 65 6C 6C 6F ProblemType: Bug DistroRelease: Ubuntu 26.04 Package: linux-image-7.0.0-27-generic 7.0.0-27.27 ProcVersionSignature: Ubuntu 7.0.0-27.27-generic 7.0.6 Uname: Linux 7.0.0-27-generic x86_64 ApportVersion: 2.34.0-0ubuntu2 Architecture: amd64 AudioDevicesInUse: USER PID ACCESS COMMAND /dev/snd/controlC0: jeremy 2469 F.... wireplumber /dev/snd/seq: jeremy 2448 F.... pipewire CasperMD5CheckResult: pass CurrentDesktop: ubuntu:GNOME Date: Fri Jul 10 07:54:52 2026 InstallationDate: Installed on 2026-06-28 (12 days ago) InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release amd64 (20260423.1) Lsusb: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 258a:0010 Hailuck Co.,Ltd PTP TouchPad Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120 Bus 001 Device 004: ID 0e8d:7961 MediaTek Inc. Wireless_Device Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub MachineType: Micro Computer(HK) Tech Limited Venus series ProcEnviron: LANG=en_US.UTF-8 PATH=(custom, no user) SHELL=/bin/bash TERM=xterm-256color XDG_RUNTIME_DIR=<set> ProcFB: 0 i915drmfb ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-7.0.0-27-generic root=UUID=cb056be5-6cde-4da3-a5c5-3cadf16217a7 ro quiet splash crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M SourcePackage: linux UpgradeStatus: No upgrade log present (probably fresh install) dmi.bios.date: 08/10/2023 dmi.bios.release: 5.25 dmi.bios.vendor: American Megatrends International, LLC. dmi.bios.version: 1.01 dmi.board.asset.tag: Default string dmi.board.name: AHBTB dmi.board.vendor: Shenzhen Meigao Electronic Equipment Co.,Ltd dmi.board.version: OEM dmi.chassis.asset.tag: Default string dmi.chassis.type: 3 dmi.chassis.vendor: Default string dmi.chassis.version: Default string dmi.modalias: dmi:bvnAmericanMegatrendsInternational,LLC.:bvr1.01:bd08/10/2023:br5.25:svnMicroComputer(HK)TechLimited:pnVenusseries:pvrOEM:rvnShenzhenMeigaoElectronicEquipmentCo.,Ltd:rnAHBTB:rvrOEM:cvnDefaultstring:ct3:cvrDefaultstring:skuDefaultstring:pfaDefaultstring: dmi.product.family: Default string dmi.product.name: Venus series dmi.product.sku: Default string dmi.product.version: OEM dmi.sys.vendor: Micro Computer(HK) Tech Limited ** Affects: linux (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug resolute wayland-session ** Attachment added: "Reproduction" https://bugs.launchpad.net/bugs/2160286/+attachment/5980981/+files/main.c -- You received this bug notification because you are subscribed to linux in Ubuntu. Matching subscriptions: Bgg, Bmail, Nb https://bugs.launchpad.net/bugs/2160286 Title: CAN-J1939: sendmsg control data is not used Status in linux package in Ubuntu: New Bug description: Some protocols based on J1939 require PGNs be sent with different priorities. Although the priority can be set using setsockopt(2) with the SO_J1939_SEND_PRIO socket option, this requires two system calls to send a message leading to a potential race condition if the socket is shared between threads. The sendmsg(2) call allows socket options to be supplied as ancillary control data as part of a single send operation. However, it appears the J1939 driver does not process these options and messages are always transmitted with the priority set at the socket level. https://github.com/torvalds/linux/blob/a635d6748234582ea287c5ffeae28b9b23f91c7e/net/can/j1939/socket.c#L919 Ideally, sendmsg should allow any transmit-side socket options (e.g. SO_J1939_SEND_PRIO, SO_BROADCAST) to be supplied on a per-send basis. Attached is a simple C program to reproduce. the second sendmsg transmits with the default priority as observed in candump output: vcan0 1BFFFF42 [5] 48 65 6C 6C 6F vcan0 1BFFFF42 [5] 48 65 6C 6C 6F ProblemType: Bug DistroRelease: Ubuntu 26.04 Package: linux-image-7.0.0-27-generic 7.0.0-27.27 ProcVersionSignature: Ubuntu 7.0.0-27.27-generic 7.0.6 Uname: Linux 7.0.0-27-generic x86_64 ApportVersion: 2.34.0-0ubuntu2 Architecture: amd64 AudioDevicesInUse: USER PID ACCESS COMMAND /dev/snd/controlC0: jeremy 2469 F.... wireplumber /dev/snd/seq: jeremy 2448 F.... pipewire CasperMD5CheckResult: pass CurrentDesktop: ubuntu:GNOME Date: Fri Jul 10 07:54:52 2026 InstallationDate: Installed on 2026-06-28 (12 days ago) InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release amd64 (20260423.1) Lsusb: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 258a:0010 Hailuck Co.,Ltd PTP TouchPad Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120 Bus 001 Device 004: ID 0e8d:7961 MediaTek Inc. Wireless_Device Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub MachineType: Micro Computer(HK) Tech Limited Venus series ProcEnviron: LANG=en_US.UTF-8 PATH=(custom, no user) SHELL=/bin/bash TERM=xterm-256color XDG_RUNTIME_DIR=<set> ProcFB: 0 i915drmfb ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-7.0.0-27-generic root=UUID=cb056be5-6cde-4da3-a5c5-3cadf16217a7 ro quiet splash crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M SourcePackage: linux UpgradeStatus: No upgrade log present (probably fresh install) dmi.bios.date: 08/10/2023 dmi.bios.release: 5.25 dmi.bios.vendor: American Megatrends International, LLC. dmi.bios.version: 1.01 dmi.board.asset.tag: Default string dmi.board.name: AHBTB dmi.board.vendor: Shenzhen Meigao Electronic Equipment Co.,Ltd dmi.board.version: OEM dmi.chassis.asset.tag: Default string dmi.chassis.type: 3 dmi.chassis.vendor: Default string dmi.chassis.version: Default string dmi.modalias: dmi:bvnAmericanMegatrendsInternational,LLC.:bvr1.01:bd08/10/2023:br5.25:svnMicroComputer(HK)TechLimited:pnVenusseries:pvrOEM:rvnShenzhenMeigaoElectronicEquipmentCo.,Ltd:rnAHBTB:rvrOEM:cvnDefaultstring:ct3:cvrDefaultstring:skuDefaultstring:pfaDefaultstring: dmi.product.family: Default string dmi.product.name: Venus series dmi.product.sku: Default string dmi.product.version: OEM dmi.sys.vendor: Micro Computer(HK) Tech Limited To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2160286/+subscriptions
Комментариев нет:
Отправить комментарий