Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH can-next v5 00/24] can: memcg accounting, CAN_ISOTP fixes and cleanups
@ 2026-12-03 11:55 Oliver Hartkopp
  2026-12-03 11:55 ` [PATCH can-next v5 01/24] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
                   ` (23 more replies)
  0 siblings, 24 replies; 27+ messages in thread
From: Oliver Hartkopp @ 2026-12-03 11:55 UTC (permalink / raw)
  To: linux-can
  Cc: Marc Kleine-Budde, Oliver Hartkopp, Sashiko, Zihan Xi,
	Oleksij Rempel, Wentian Ye

Patches 1-3 are the remaining CAN patches of the former lock_sock() and
memcg series, whose first patches have been applied via the net tree.
They are followed by CAN_ISOTP fixes and cleanups that have been found
while preparing the CAN XL support for CAN_ISOTP.

Patches 1-2 read the CAN_RAW and CAN_ISOTP socket options under
conf_lock, so that a concurrent setsockopt() can not lead to a mix of
old and new values in getsockopt().

Patch 3 enables the memcg accounting for the CAN allocations that can
be triggered by unprivileged users (socket structures, receivers,
CAN_BCM ops and frames, CAN_RAW/J1939 filters, the CAN_ISOTP TX buffer
for large PDUs and the J1939 per device data).

Patch 4 fixes a CAN_ISOTP socket in listen mode that sent a FC.OVFLW on
the bus. It carries a Fixes tag and applies to net as well.

Patches 5-12 improve the CAN_ISOTP socket options and timing:
- check the CAN_ISOTP_OPTS values before applying them
- add the frame transmission time to the CF broadcast gap and limit it
  to the N_As/N_Ar timeout
- add the N_As/N_Ar timeout monitoring with the local echo and start
  the N_Bs/N_Cr timeouts with the transmission confirmation
- reject undefined CAN FD tx_flags and reserved STmin values
- ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING as
  documented

Patches 13-16 fix the CAN_ISOTP reception against ISO 15765-2:
- drop frames without N_PCI and FFs with an invalid length extension
- check FF_DLmin and the data length of the last CF

Patches 17-24 are cleanups in preparation of the CAN XL support for
CAN_ISOTP.

Patches 5-16 only affect invalid configurations and frames, tighten the
uAPI or implement the ISO 15765-2 timeouts and therefore do not carry
Fixes tags.

Changes in v5:
- can: isotp: add the frame transmission time to the protocol timeouts:
  replaced by "can: isotp: limit the frame transmission time to the
  N_As/N_Ar timeout", which only limits and documents frame_txtime
- can: isotp: use the N_As timeout for the local echo: replaced by
  "can: isotp: add N_As timeout monitoring for SF/FF/CF", which
  supervises the transmission of all SF/FF/CF with the local echo and
  starts the FC timeout (N_Bs) with the local echo of the FF
- new patch: can: isotp: add N_Ar timeout monitoring for FC, which
  supervises the transmission of the FC with the local echo and starts
  the CF timeout (N_Cr) with the local echo of the FC
- Link to v4: https://lore.kernel.org/linux-can/20261201-getsockopt-memcg-isotp-v4-0-97261be8e38e@hartkopp.net/

Changes in v4:
- can: enable memcg accounting for user triggered allocations:
  reworded the reason for the unaccounted j1939 RX sessions
- can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING:
  reworded "misconfiguration" to "flag combination"
- can: isotp: check the minimum FF_DL: describe the two kinds of
  accepted FFs separately in the commit message
- Link to v3: https://lore.kernel.org/linux-can/20261130-getsockopt-memcg-isotp-v3-0-21d72c15ad1d@hartkopp.net/

Changes in v3:
- can: isotp: add the frame transmission time to the CF broadcast gap:
  explain the missing Fixes tag for the unit fix in iso15765-2.rst
- can: isotp: add the frame transmission time to the protocol timeouts:
  add frame_txtime to the CF echo timeouts as well
- new patch: can: isotp: use the N_As timeout for the local echo
  (1 s instead of 2 s, document ECOMM for the local echo timeout)
- can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC:
  state the intentional uAPI tightening, update the remark in isotp.h,
  document the rejected values and fix the struct name in iso15765-2.rst
- can: isotp: drop frames without N_PCI: reworded commit message
- can: isotp: drop FF frames with invalid length extension: describe the
  impact and the reason for the missing Fixes tag
- can: isotp: rename rx_lock as it has become state machine lock:
  precise the locking comment for isotp_release()
- Link to v2: https://lore.kernel.org/linux-can/20261128-getsockopt-memcg-isotp-v2-0-034ba95e17a4@hartkopp.net/

Changes in v2:
- can: enable memcg accounting for user triggered allocations:
  added Acked-by from Oleksij Rempel
- can: isotp: do not send FC.OVFLW in listen mode:
  moved to patch 4, describe the impact on a correct listen mode
  configuration, add Fixes tag and Cc stable
- new patch: can: isotp: add the frame transmission time to the CF
  broadcast gap (also fixes the unit of the forced stmin values in
  iso15765-2.rst)
- can: isotp: add the frame transmission time to the protocol timeouts:
  limit frame_txtime to the N_As/N_Ar timeout of 1 s from ISO 15765-2
  instead of 100 ms, document the limit in isotp.h and iso15765-2.rst
- can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS:
  state the intentional uAPI tightening, always set CANFD_FDF for
  CAN FD, document the accepted tx_flags
- can: isotp: reject CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING
  replaced by "can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without
  CAN_ISOTP_RX_PADDING" which fixes check_pad() as documented instead
  of rejecting the option
- can: isotp: drop frames without N_PCI, check the minimum FF_DL, check
  the data length of the last CF: describe the impact and the reason
  for the missing Fixes tag in the commit messages
- dropped: can: isotp: ignore invalid SF and FF frames during a reception
- can: isotp: rename rx_lock as it has become state machine lock:
  fixed typo in the subject, updated the locking comment in isotp_rcv()
- can: isotp: change return type of functions to void:
  removed the trailing return statements
- can: isotp: introduce CAN_ISOTP_MIN_TX_DL:
  use it only for TX_DL checks, separate block in isotp.h
- Link to v1: https://patch.msgid.link/20261126-getsockopt-memcg-isotp-v1-0-681ef8d8c2c9@hartkopp.net

---
Oliver Hartkopp (24):
      can: raw: read socket options under conf_lock in raw_getsockopt()
      can: isotp: read socket options under conf_lock in isotp_getsockopt()
      can: enable memcg accounting for user triggered allocations
      can: isotp: do not send FC.OVFLW in listen mode
      can: isotp: check the CAN_ISOTP_OPTS values before applying them
      can: isotp: add the frame transmission time to the CF broadcast gap
      can: isotp: limit the frame transmission time to the N_As/N_Ar timeout
      can: isotp: add N_As timeout monitoring for SF/FF/CF
      can: isotp: add N_Ar timeout monitoring for FC
      can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS
      can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC
      can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING
      can: isotp: drop frames without N_PCI
      can: isotp: drop FF frames with invalid length extension
      can: isotp: check the minimum FF_DL
      can: isotp: check the data length of the last CF
      can: isotp: drop inline keyword, let the compiler decide
      can: isotp: rename rx_lock as it has become state machine lock
      can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs
      can: isotp: rename variable for the required content length
      can: isotp: rename checkpad functions returning bool values
      can: isotp: change return type of functions to void
      can: isotp: rename pointer in isotp_rcv() prototype
      can: isotp: introduce CAN_ISOTP_MIN_TX_DL

 Documentation/networking/iso15765-2.rst |  35 ++-
 include/uapi/linux/can/isotp.h          |  16 +-
 net/can/af_can.c                        |  12 +-
 net/can/bcm.c                           |  10 +-
 net/can/isotp.c                         | 418 +++++++++++++++++++-------------
 net/can/j1939/main.c                    |   2 +-
 net/can/j1939/socket.c                  |  12 +-
 net/can/raw.c                           |  78 +++---
 8 files changed, 348 insertions(+), 235 deletions(-)
---
base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
change-id: 20261126-getsockopt-memcg-isotp-052433c7adda

Best regards,
--  
Oliver Hartkopp <socketcan@hartkopp.net>


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-12-03 12:41 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 11:55 [PATCH can-next v5 00/24] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 01/24] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 02/24] can: isotp: read socket options under conf_lock in isotp_getsockopt() Oliver Hartkopp
2026-12-03 12:22   ` sashiko-bot
2026-12-03 11:55 ` [PATCH can-next v5 03/24] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-12-03 12:41   ` sashiko-bot
2026-12-03 11:55 ` [PATCH can-next v5 04/24] can: isotp: do not send FC.OVFLW in listen mode Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 05/24] can: isotp: check the CAN_ISOTP_OPTS values before applying them Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 06/24] can: isotp: add the frame transmission time to the CF broadcast gap Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 07/24] can: isotp: limit the frame transmission time to the N_As/N_Ar timeout Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 08/24] can: isotp: add N_As timeout monitoring for SF/FF/CF Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 09/24] can: isotp: add N_Ar timeout monitoring for FC Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 10/24] can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 11/24] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 12/24] can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 13/24] can: isotp: drop frames without N_PCI Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 14/24] can: isotp: drop FF frames with invalid length extension Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 15/24] can: isotp: check the minimum FF_DL Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 16/24] can: isotp: check the data length of the last CF Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 17/24] can: isotp: drop inline keyword, let the compiler decide Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 18/24] can: isotp: rename rx_lock as it has become state machine lock Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 19/24] can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 20/24] can: isotp: rename variable for the required content length Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 21/24] can: isotp: rename checkpad functions returning bool values Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 22/24] can: isotp: change return type of functions to void Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 23/24] can: isotp: rename pointer in isotp_rcv() prototype Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 24/24] can: isotp: introduce CAN_ISOTP_MIN_TX_DL Oliver Hartkopp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox