|
From: Burton S. <BSt...@co...> - 2005-03-15 13:17:43
|
Our app does a uid switch with this:
/* user id specified on commandline */
if((setgid(myGlobals.groupId) != 0) || (setuid(myGlobals.userId) != 0)) {
traceEvent(CONST_TRACE_FATALERROR, "Unable to change user ID");
exit(-1);
}
traceEvent(CONST_TRACE_ALWAYSDISPLAY, "Now running as requested user '%s'
(%d:%d)",
myGlobals.effectiveUserName, myGlobals.userId,
myGlobals.groupId);
Once the switch occurs, valgrind (rc4) fails shortly after:
Tue 15 Mar 2005 07:03:43 AM CST Plugins started... continuing with
initialization
Tue 15 Mar 2005 07:03:43 AM CST Now running as requested user 'ntop'
(1001:100)
Tue 15 Mar 2005 07:03:43 AM CST INIT: Created pid file
(/devel/ntop/ntop.pid)
Tue 15 Mar 2005 07:03:43 AM CST Device 0. eth1
(active)
Tue 15 Mar 2005 07:03:43 AM CST Device 1. eth2
(active)
Tue 15 Mar 2005 07:03:43 AM CST Note: Reporting device initally set to 0
[eth1]
==15519== TRANSLATE: 0x1CCAECC0 redirected to 0x1B902F87
Tue 15 Mar 2005 07:03:43 AM CST MEMORY: Base memory load is 0.01MB (0+0)
Tue 15 Mar 2005 07:03:43 AM CST MEMORY: Base interface structure (no hashes
loaded) is 0.28MB each
Tue 15 Mar 2005 07:03:43 AM CST MEMORY: or 0.55MB for 2 interfaces
Tue 15 Mar 2005 07:03:43 AM CST MEMORY: ipTraffixMatrix structure (no
TrafficEntry loaded) is 8.01MB
Tue 15 Mar 2005 07:03:43 AM CST THREADMGMT: pcapDispatch(eth1) thread
running [p15519, t585038768]...
Tue 15 Mar 2005 07:03:43 AM CST THREADMGMT: Started thread (585038768) for
network packet sniffing on eth1
Tue 15 Mar 2005 07:03:43 AM CST THREADMGMT: Started thread (595532720) for
network packet sniffing on eth2
Tue 15 Mar 2005 07:03:43 AM CST THREADMGMT: pcapDispatch(eth2) thread
running [p15519, t595532720]...
==15519== FATAL: can't open /proc/self/maps
If I disable the switch with our (-u root) parameter (which I can live
with), it doesn't fail:
Tue 15 Mar 2005 07:05:26 AM CST Now running as requested user 'root' (0:0)
Tue 15 Mar 2005 07:05:26 AM CST INIT: Created pid file (/var/run/ntop.pid)
Tue 15 Mar 2005 07:05:26 AM CST Device 0. eth1
(active)
Tue 15 Mar 2005 07:05:26 AM CST Device 1. eth2
(active)
Tue 15 Mar 2005 07:05:26 AM CST Note: Reporting device initally set to 0
[eth1]
==15535== TRANSLATE: 0x1CCAECC0 redirected to 0x1B902F87
Tue 15 Mar 2005 07:05:26 AM CST MEMORY: Base memory load is 0.01MB (0+0)
Tue 15 Mar 2005 07:05:26 AM CST MEMORY: Base interface structure (no hashes
loaded) is 0.28MB each
Tue 15 Mar 2005 07:05:26 AM CST MEMORY: or 0.55MB for 2 interfaces
Tue 15 Mar 2005 07:05:26 AM CST MEMORY: ipTraffixMatrix structure (no
TrafficEntry loaded) is 8.01MB
Tue 15 Mar 2005 07:05:26 AM CST THREADMGMT: pcapDispatch(eth1) thread
running [p15535, t585038768]...
Tue 15 Mar 2005 07:05:27 AM CST THREADMGMT: Started thread (585038768) for
network packet sniffing on eth1
Tue 15 Mar 2005 07:05:27 AM CST THREADMGMT: pcapDispatch(eth2) thread
running [p15535, t595532720]...
Tue 15 Mar 2005 07:05:27 AM CST THREADMGMT: Started thread (595532720) for
network packet sniffing on eth2
Tue 15 Mar 2005 07:05:46 AM CST RRD: Cycle 1 ended, 0 RRDs updated
Tue 15 Mar 2005 07:07:56 AM CST FINGERPRINT: ending cycle 1 - checked 2,
resolved 2
Tue 15 Mar 2005 07:10:27 AM CST FINGERPRINT: ending cycle 2 - checked 1,
resolved 1
Tue 15 Mar 2005 07:10:47 AM CST RRD: Cycle 2 ended, 195 RRDs updated
However, 2.2 works fine w/o the parameter.
It's hard to tell what's causing the error, as there is a lot of processing
between the 'thread running' message and any subsequent log messages. And
running valgrind under gdb gives a SIGSEGV very early on.
Command line:
/usr/bin/valgrind --verbose --suppressions=/devel/ntop/valgrind.supp
--leak-check=yes --trace-children=yes --num-callers=6 --gen-suppressions=yes
/devel/bin/ntop -i eth1,eth2 @/etc/ntopdevel.conf
-----Burton
|