When I attempt to use the "sensors -s" command (as root, under gentoo-sources-2.4.20-r*) for setting lm_sensors options to the /proc sensors interface, this message is displayed: root@omega root # sensors -s w83782d-i2c-1-2d: Can't access /proc file for writing; Run as root? This only happens under gentoo-sources. Reproducible: Always Steps to Reproduce: 1. emerge and configure a gentoo-sources kernel with at least the following options: # I2C support CONFIG_I2C=m CONFIG_I2C_CHARDEV=m CONFIG_I2C_PROC=m 2. Have i2c and lm-sensors emerged. 3. Using the gentoo-sources kernel, load the i2c-core, i2c-dev, and i2c-proc modules. Load also the modules pertaining to your sensors. Use sensors-detect if necessary to determine which ones. 4. Execute 'sensors -s' as root, regardless of whether /etc/sensors.conf has been modified. 5. Gawk in frustration. Actual Results: stdout: w83782d-i2c-1-2d: Can't access /proc file for writing; Run as root? Expected Results: No output (successful write to /proc files). Portage 2.0.49-r3 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1, 2.4.20-gentoo-r7) ================================================================= System uname: 2.4.20-gentoo-r7 i686 AMD Athlon(tm) Processor ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer -finline-functions -falign-jumps=5 -falign-loops=5 -falign-functions=64 -funroll-loops -mfpmath=sse -mmmx -msse -m3dnow" CHOST="i686-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer -finline-functions -falign-jumps=5 -falign-loops=5 -falign-functions=64 -funroll-loops -mfpmath=sse -mmmx -msse -m3dnow" DISTDIR="/usr/portage/distfiles" FEATURES="sandbox ccache autoaddcvs fixpackages" GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo ftp://gentoo.noved.org/ http://gentoo.noved.org/ ftp://ftp.gtlib.cc.gatech.edu/pub/gentoo http://adelie.polymtl.ca/" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.us.gentoo.org/gentoo-portage" USE="x86 oss avi crypt cups encode foomaticdb gif jpeg libg++ mad mikmod mmx mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib gdbm slang readline aalib svga ggi tcltk java guile X sdl gpm tcpd pam libwww ssl perl python imlib oggvorbis gtk qt motif opengl mozilla cdr 3dnow acpi acpi4linux dga evms2 jikes joystick lvm1 mbox moznoirc oav openal php samba sse tiff usb v4l xml xvid -apm -kde -gnome -berkdb -arts -esd"
Created attachment 17593 [details] Stack trace for "sensors -s"
Created attachment 17594 [details] dupe
Comment on attachment 17594 [details] dupe duplicate of attachment #17593 [details]
You are probably using GRSEC. That is a "feature" of it and not a bug, so I guess the best you can do it to either set it to manual settings or lower the security level.
I am not using GRSEC (Grsecurity).
Can you please try 2.8.0 and see if that still happens? This problem is either a GRSEC patch or a bug which was fixed in 2.8.0. [You'll need to _not_ use the kernel modules for this and emerge i2c-2.8.0 and then lm-sensors-2.8.0]
Procedure taken: 1. Disabled all I2C support in kernel, rebuilt and installed modules. 2. Unloaded all I2C modules and their dependants. 3. Emerged sys-apps/i2c-2.8.0 and sys-apps/lm-sensors-2.8.0. 4. Loaded relevant I2C modules and attempted 'sensors -s.' The result after the procedure is identical to the result before it. 'sensors -s' still can't access the /proc files.
This is a grsecurity bug when it is *disabled*. I've added a patch [to grsecurity/grsec_disabled.c], can you apply that to your kernel and recompile, and report back if it works/fails/... Thanks...
Created attachment 17661 [details, diff] GRSEC patch
The patch is applied successfully but the build fails: gcc -D__KERNEL__ -I/usr/src/linux-2.4.20-gentoo-r7/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=athlon-mp -nostdinc -iwithprefix include -DKBUILD_BASENAME=grsec_disabled -c -o grsec_disabled.o grsec_disabled.c grsec_disabled.c: In function `gr_handle_sysctl': grsec_disabled.c:23: `GR_READ' undeclared (first use in this function) grsec_disabled.c:23: (Each undeclared identifier is reported only once grsec_disabled.c:23: for each function it appears in.) grsec_disabled.c:25: `GR_WRITE' undeclared (first use in this function) make[2]: *** [grsec_disabled.o] Error 1 make[2]: Leaving directory `/usr/src/linux-2.4.20-gentoo-r7/grsecurity' make[1]: *** [first_rule] Error 2 make[1]: Leaving directory `/usr/src/linux-2.4.20-gentoo-r7/grsecurity' make: *** [_dir_grsecurity] Error 2
Yep, can you add: #include <linux/grdefs.h> to grsec_disabled.c after all the other #include lines... and then just run 'make' again [you don't need to clean or re-dep, etc...]
After adding the include, the kernel built properly and it is now possible to execute "sensors -s" successfully.
OK, I've added the patch to CVS to the latest gentoo-sources [r7]. Please make sure you do an 'emerge sync' and then remerge your kernel sources. You can use your old kernel config, but please run either 'make menuconfig' or 'make oldconfig' and save the new config before continuing.