Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 28553 - lm_sensors "sensors -s" can't access /proc file for writing with latest gentoo-sources
Summary: lm_sensors "sensors -s" can't access /proc file for writing with latest gento...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: x86-kernel@gentoo.org (DEPRECATED)
URL: ttp://forums.gentoo.org/viewtopic.php...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-12 14:52 UTC by Matthew Vaughn
Modified: 2003-09-14 05:08 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Stack trace for "sensors -s" (sensors-strace.txt,8.38 KB, text/plain)
2003-09-12 14:55 UTC, Matthew Vaughn
Details
dupe (sensors-strace.txt,8.38 KB, text/plain)
2003-09-12 14:55 UTC, Matthew Vaughn
Details
GRSEC patch (grsec_disabled.c.patch,436 bytes, patch)
2003-09-13 15:08 UTC, Tim Yamin (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Vaughn 2003-09-12 14:52:48 UTC
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"
Comment 1 Matthew Vaughn 2003-09-12 14:55:11 UTC
Created attachment 17593 [details]
Stack trace for "sensors -s"
Comment 2 Matthew Vaughn 2003-09-12 14:55:42 UTC
Created attachment 17594 [details]
dupe
Comment 3 Matthew Vaughn 2003-09-12 14:57:43 UTC
Comment on attachment 17594 [details]
dupe

duplicate of attachment #17593 [details]
Comment 4 Tim Yamin (RETIRED) gentoo-dev 2003-09-13 04:26:32 UTC
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.
Comment 5 Matthew Vaughn 2003-09-13 12:16:50 UTC
I am not using GRSEC (Grsecurity).
Comment 6 Tim Yamin (RETIRED) gentoo-dev 2003-09-13 13:13:29 UTC
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]
Comment 7 Matthew Vaughn 2003-09-13 14:09:38 UTC
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.
Comment 8 Tim Yamin (RETIRED) gentoo-dev 2003-09-13 15:08:25 UTC
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...
Comment 9 Tim Yamin (RETIRED) gentoo-dev 2003-09-13 15:08:43 UTC
Created attachment 17661 [details, diff]
GRSEC patch
Comment 10 Matthew Vaughn 2003-09-13 15:45:48 UTC
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
Comment 11 Tim Yamin (RETIRED) gentoo-dev 2003-09-13 16:49:47 UTC
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...]
Comment 12 Matthew Vaughn 2003-09-13 17:43:15 UTC
After adding the include, the kernel built properly and it is now possible to execute "sensors -s" successfully.
Comment 13 Tim Yamin (RETIRED) gentoo-dev 2003-09-14 05:08:45 UTC
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.