Iio_device symlink missing

I am trying Jetpack 4.6.1 on my AGX board and noticed iio_device symlink is now missing.

In old 4.3:

$ ls -l /sys/bus/i2c/devices/1-0040/
total 0
lrwxrwxrwx 1 root root    0 Mar 29 01:17 driver -> ../../../../bus/i2c/drivers/ina3221x
lrwxrwxrwx 1 root root    0 Mar 29 01:52 iio_device -> iio:device0
drwxr-xr-x 3 root root    0 Mar 29 01:17 iio:device0
-r--r--r-- 1 root root 4096 Mar 29 01:17 modalias
-r--r--r-- 1 root root 4096 Mar 29 01:52 name
lrwxrwxrwx 1 root root    0 Mar 29 01:52 of_node -> ../../../../firmware/devicetree/base/i2c@c240000/ina3221x@40
drwxr-xr-x 2 root root    0 Mar 29 01:52 power
lrwxrwxrwx 1 root root    0 Mar 29 01:17 subsystem -> ../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Mar 29 01:17 uevent

There is symlink: iio_device -> iio:device0

But in 4.6.1,

$ ls -l /sys/bus/i2c/devices/1-0040/
total 0
lrwxrwxrwx 1 root root    0 Mar 28 23:52 driver -> ../../../../bus/i2c/drivers/ina3221x
drwxr-xr-x 3 root root    0 Mar 28 23:52 iio:device0
-r--r--r-- 1 root root 4096 Mar 28 23:52 modalias
-r--r--r-- 1 root root 4096 Mar 28 23:52 name
lrwxrwxrwx 1 root root    0 Mar 28 23:52 of_node -> ../../../../firmware/devicetree/base/i2c@c240000/ina3221x@40
drwxr-xr-x 2 root root    0 Mar 28 23:52 power
lrwxrwxrwx 1 root root    0 Mar 28 23:52 subsystem -> ../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Mar 28 23:52 uevent

I don’t see the symlink.
I am not sure if it is related to NVIDIA Sensor IIO Kernel Changes Break Common IIO Drivers - #14 by JDSchroeder but that post says patch was already merged in 4.5.

If I directly go into “iio:device0” and I notice another difference.
In JP4.3, all files are world readable:

-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_current_limit_0
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_current_limit_1
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_current_limit_2
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_current_limit_sum
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_power_limit_0
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_power_limit_1
-rw-r--r-- 1 root root 4096 Mar 29 02:55 crit_power_limit_2
...

But in JP4.6, they are only accessible by root. Our application runs as non-root, and won’t be able to access them anymore:

-rw------- 1 root root 4096 Mar 29 02:53 crit_current_limit_0
-rw------- 1 root root 4096 Mar 29 02:53 crit_current_limit_1
-rw------- 1 root root 4096 Mar 29 02:53 crit_current_limit_2
-rw------- 1 root root 4096 Mar 29 02:53 crit_current_limit_sum
-rw------- 1 root root 4096 Mar 29 02:53 crit_power_limit_0
-rw------- 1 root root 4096 Mar 29 02:53 crit_power_limit_1
-rw------- 1 root root 4096 Mar 29 02:53 crit_power_limit_2
...

Without looking at the new kernel code, I can’t tell you what was changed. I’m guessing the code that created that extra symlink was dropped from the latest version (i.e., was never forward ported). You should be able to find the code that was doing the symlink creation in the old kernel and port it to the new kernel if you are needing it.

Yep. That is typical security for you. Someone probably decided that it is safest not to have the group and other permissions set on the driver sysfs files. You should be able to find it in the driver code and add the permissions back to have group and other read-only permissions once again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.