Sample rootfs includes incompatible sctp definitions

I recently updated our kernel configuration to include SCTP support for our Jetson AGX Xavier based board. I installed libsctp-dev and cloned the lksctp-tools repo (https://github.com/sctp/lksctp-tools) to the target and built that. The very first test failed when I tried to run make v4tests. The failure indicated there is an invalid argument problem.

After a bit of digging, I discovered that the /usr/include/linux/sctp.h header, which is provided by the sample rootfs that NVIDIA supplies on the developer site, was referenced during compilation. It turns out that this is incompatible with the version that the kernel is built with. There are 3 additional parameters in the struct sctp_event_subscribe above what the kernel is expecting, hence the error.

I looked at the sample rootfs we use (JAX-TX2-Tegra_Linux_Sample-Root-Filesystem_R32.1.0_aarch64.tbz2) and the latest and greatest (Tegra_Linux_Sample-Root-Filesystem_R32.4.3_aarch64.tbz2) and they both include additional parameters.

Here’s the struct as defined in the kernel-4.9 include/uapi/linux/sctp.h file:

/*
 * Described in Section 7.3
 *   Ancillary Data and Notification Interest Options
 */
struct sctp_event_subscribe {
	__u8 sctp_data_io_event;
	__u8 sctp_association_event;
	__u8 sctp_address_event;
	__u8 sctp_send_failure_event;
	__u8 sctp_peer_error_event;
	__u8 sctp_shutdown_event;
	__u8 sctp_partial_delivery_event;
	__u8 sctp_adaptation_layer_event;
	__u8 sctp_authentication_event;
	__u8 sctp_sender_dry_event;
};

Here’s the struct as defined in the /usr/include/linux/sctp.h from the sample rootfs:

/*
 * Described in Section 7.3
 *   Ancillary Data and Notification Interest Options
 */
struct sctp_event_subscribe {
        __u8 sctp_data_io_event;
        __u8 sctp_association_event;
        __u8 sctp_address_event;
        __u8 sctp_send_failure_event;
        __u8 sctp_peer_error_event;
        __u8 sctp_shutdown_event;
        __u8 sctp_partial_delivery_event;
        __u8 sctp_adaptation_layer_event;
        __u8 sctp_authentication_event;
        __u8 sctp_sender_dry_event;
        __u8 sctp_stream_reset_event;
        __u8 sctp_assoc_reset_event;
        __u8 sctp_stream_change_event;
};

Notice that there are 3 extra events in the latter. This difference induces run-time errors when trying to use setsockopt for SCTP_EVENTS.

I believe NVIDIA should update the sample rootfs to include a version that is compatible with the kernel build.

The sample rootfs is actually pure Ubuntu. You can check the package name via:

# dpkg -S /usr/include/linux/sctp.h
linux-libc-dev:arm64: /usr/include/linux/sctp.h

The “normal” method of updating this would be:

sudo apt update
sudo apt-get upgrade linux-libc-dev

The version which is part of the kernel is not used in user space software. This is used internally by the kernel, and probably is different on purpose (not as a bug).

However, I will stipulate that sometimes protocols which the kernel supports will have different versions released over time. It is quite possible that even with the user space software updated, that a different SCTP protocol version is also required…in that case it would be necessary to back port the newer kernel SCTP protocol code to the current kernel.

Or conversely, if a library is getting this error while using this version of SCTP in kernel calls, then the library would need to be downgraded to a compatibility release which works with that protocol version in the kernel.

Thanks for the info!