[Bug 723708] New: checkproc returns wrong values
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c0 Summary: checkproc returns wrong values Classification: openSUSE Product: openSUSE 12.1 Version: Factory Platform: x86-64 OS/Version: SuSE Other Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: f.de.kruijf@gmail.com QAContact: qa@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Starting amavis with rcamavis as root gives an error message which tells that amavisd did not start. See also the following: # rcamavis status amavis.service - LSB: Start amavisd-new Loaded: loaded (/etc/init.d/amavis) Active: failed since Wed, 12 Oct 2011 16:58:49 +0200; 6h ago Process: 5070 ExecStart=/etc/init.d/amavis start (code=exited, status=7/NOTRUNNING) CGroup: name=systemd:/system/amavis.service ├ 5079 /usr/sbin/amavisd (master) ├ 5085 /usr/sbin/amavisd (virgin child) └ 5086 /usr/sbin/amavisd (virgin child) However amavisd is running. See the follwing: # ps aux | grep amavis vscan 5079 0.0 9.5 217148 97120 ? Ss 16:58 0:01 /usr/sbin/amavisd (master) vscan 5085 0.0 9.4 218420 96144 ? S 16:58 0:00 /usr/sbin/amavisd (virgin child) vscan 5086 0.0 9.4 218420 96136 ? S 16:58 0:00 /usr/sbin/amavisd (virgin child) root 10999 0.0 0.0 6784 872 pts/1 S+ 23:52 0:00 grep amavis The problem lies in the utility checkproc which returns the wrong values: # checkproc amavisd ; echo $? 3 eik121b1v:~ # checkproc -p /var/spool/amavis/amavisd.pid amavisd ; echo $? 1 The return values are 3 and 1, but in both cases the return value must be 0, because amavisd is running. See above. Reproducible: Always Steps to Reproduce: 1.Start amavisd using the command rcamavis as root 2.Check that amavisd is running with ps aux | grep amavis 3.Give the two lines of commands given above and check the returned value. Actual Results: Values 3 and 1. Expected Results: In both cases the return value must be 0. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c1 --- Comment #1 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-13 10:38:33 UTC --- *** Bug 721655 has been marked as a duplicate of this bug. *** http://bugzilla.novell.com/show_bug.cgi?id=721655 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c2 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |werner@suse.com Severity|Major |Minor --- Comment #2 from Dr. Werner Fink <werner@suse.com> 2011-10-13 12:42:43 UTC --- Man checkproc ... please use the *full* path to amavisd and not only the name of the program: checkproc -p /var/spool/amavis/amavisd.pid /usr/sbin/amavisd -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c3 --- Comment #3 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-13 20:24:54 UTC --- I retried it with the full name and it still returns the wrong values. # ps aux | grep amavis root 4553 0.0 0.0 6788 872 pts/1 S+ 22:19 0:00 grep amavis # rcamavis start Job failed. See system logs and 'systemctl status' for details. # ps aux | grep amavis vscan 4570 22.2 9.5 217152 97124 ? Ss 22:20 0:01 /usr/sbin/amavisd (master) vscan 4574 0.0 9.4 218424 96156 ? S 22:20 0:00 /usr/sbin/amavisd (virgin child) vscan 4575 0.0 9.4 218424 96148 ? S 22:20 0:00 /usr/sbin/amavisd (virgin child) root 4577 0.0 0.0 6788 872 pts/1 S+ 22:20 0:00 grep amavis # checkproc /usr/sbin/amavisd ; echo $? 3 # checkproc -p /var/spool/amavis/amavisd.pid /usr/sbin/amavisd ; echo $? 1 # -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c4 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO CC| |varkoly@suse.com InfoProvider| |f.de.kruijf@gmail.com --- Comment #4 from Dr. Werner Fink <werner@suse.com> 2011-10-14 10:12:28 UTC --- And are you user root for using checkproc e.g. /suse/werner> sudo checkproc /usr/sbin/sshd /suse/werner> echo $? 0 and does this happen for all running programs or does it happen only for amavisd processes? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c5 Freek de Kruijf <f.de.kruijf@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|f.de.kruijf@gmail.com | --- Comment #5 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-14 14:10:51 UTC --- Obviously I am user root, see the # in front of the commands. No. I started apache2 using 'rcapache2 start'. Then used # checkproc /usr/sbin/httpd2 ; echo $? and the result was 0. As I suggested earlier, the cause could be that /usr/sbin/amavisd is a perl script. You can easily reproduce it. Only two lines in /etc/amavisd.conf may need some change. $mydomain = ... and $myhostname = .... needs to be added if uname -n does not provide a fully qualified name. After that you start amavisd by giving 'rcamavis start'. It reports an error because checkproc returns the wrong value, but is is running. After that you give the checkproc command, which gives you the wrong answers. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c6 --- Comment #6 from Dr. Werner Fink <werner@suse.com> 2011-10-14 15:09:34 UTC --- Perl scripts are *not* supported, from manual page of checkproc: BUGS Identifying a process based on the executable file and the correspond- ing inode number only works if the process stays alive during start- proc's execution. Processes rewriting their zeroth argument or shell scripts (the inode number of the shell executable file is not identical to that of the script file) may not be identified by a filename path. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c7 --- Comment #7 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-14 15:27:43 UTC --- OK. This means that /etc/init.d/amavis needs a rewrite, because it relies on checkproc. Apparently this is a deviation from earlier versions of checkproc. Because /etc/init.d/amavis in openSUSE 12.1 is the same as in openSUSE 11.4. Amavis worked in openSUSE 11.4. Can you suggest how to check for running amavisd processes? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c8 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.pr |varkoly@suse.com |ovo.novell.com | --- Comment #8 from Dr. Werner Fink <werner@suse.com> 2011-10-14 16:08:57 UTC --- I've no idea what has changed between amavisd-new-2.6.4 and amavisd-new-2.7.0 and as there was no changes accordingly to detecting scripts in checkproc I've no suggestion for amavis perl scripts. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c9 --- Comment #9 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-14 16:43:37 UTC --- The problem is probably a combination of checkproc not supposed to work for perl scripts but it did. In openSUSE 11.4 checkproc worked OK for detecting whether amavisd was running or not. Now in openSUSE 12.1 it does not work that way. I will try to run the version of amavisd-new from openSUSE 11.4 in openSUSE 12.1 and see what happens. After all it is just a perl script. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c10 --- Comment #10 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-14 20:30:28 UTC --- I connected the openSUSE 11.4 oss repository with a priority of 110 to zypper in openSUSE 12.1 factory. After that I tried all permutations of the two versions of amavisd-new and sysvinit-tools. In all 4 possibilities the behavior of checkproc testing the presence of an active amavisd was wrong. So probably it has something to do with a different interaction between checkproc and the kernel. Anyway I will come up with a patch for /etc/init.d/amavis not using checkproc. I will probably use 'ps aux' to search for a running amavisd. In bug#706257 I reported the failure of amavis reporting the failure, but being active. I will attach the patch to that bug report. I leave it to Werner to close this bug report or to investigate why checkproc behaves different in openSUSE 11.4 and 12.1. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c11 --- Comment #11 from Dr. Werner Fink <werner@suse.com> 2011-10-17 07:35:41 UTC --- the /proc file system or better the permssions have changed betwen the kernel used on 11.4 and the kernel used for 21.1 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c12 --- Comment #12 from Dr. Werner Fink <werner@suse.com> 2011-10-17 13:31:55 UTC --- .. /suse/werner> cat ~/Tests/myscript #!/usr/bin/perl -T sleep(100000); /suse/werner> checkproc -v ~/Tests/myscript 9844 /suse/werner> echo 9844 > /tmp/myscript.pid /suse/werner> checkproc -v -p /tmp/myscript.pid ~/Tests/myscript 9844 /suse/werner> uname -r 3.1.0-rc7-3-desktop .. it seems that there must be a special problem Beside this 'ps aux' could be a a problem as any user on the same system can start a script named amavisd -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c13 --- Comment #13 from Dr. Werner Fink <werner@suse.com> 2011-10-18 09:36:39 UTC --- Just submitted a version of sysvinit which includes killproc/checkproc/startproc/start_daemon knowing an option -x for detecting scripts overwriting their command line with the help of the upto 15 bytes long filename found in /proc/<pid>/stat If accepted to 12.1 the boot script for amavis could be modified to use the option -x for checkproc and all other tools mentioned above. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c14 --- Comment #14 from Bernhard Wiedemann <bwiedemann@suse.com> 2011-10-18 12:00:21 CEST --- This is an autogenerated message for OBS integration: This bug (723708) was mentioned in https://build.opensuse.org/request/show/88444 Factory / sysvinit -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c15 --- Comment #15 from Freek de Kruijf <f.de.kruijf@gmail.com> 2011-10-20 07:47:37 UTC --- Unfortunately the bugfix does not work: eik121b1v:~ # rcamavis start Job failed. See system logs and 'systemctl status' for details. eik121b1v:~ # ps aux | grep amavisd vscan 3608 9.5 9.6 218908 98880 ? Ss 09:34 0:01 /usr/sbin/amavisd (master) vscan 3612 0.0 9.5 220180 97916 ? S 09:34 0:00 /usr/sbin/amavisd (virgin child) vscan 3613 0.0 9.5 220180 97912 ? S 09:34 0:00 /usr/sbin/amavisd (virgin child) root 3617 0.0 0.0 6792 872 pts/1 S+ 09:34 0:00 grep amavisd eik121b1v:~ # checkproc -v amavisd eik121b1v:~ # checkproc -v /usr/sbin/amavisd eik121b1v:~ # checkproc -x amavisd ; echo $? 3 eik121b1v:~ # checkproc -x -p /var/spool/amavis/amavisd.pid amavisd ; echo $? 1 eik121b1v:~ # checkproc -x /usr/sbin/amavisd ; echo $? 3 eik121b1v:~ # checkproc -x -p /var/spool/amavis/amavisd.pid /usr/sbin/amavisd ; echo $? 1 eik121b1v:~ # more /proc/$(cat /var/spool/amavis/amavisd.pid)/stat 3608 (/usr/sbin/amavi) S 1 3608 3608 0 -1 4202560 11045 0 14 0 127 8 0 0 20 0 1 0 8609 224161792 24720 18446744073709551615 4194304 5645308 140735348404400 140735348403656 140307836922899 0 0 4224 81927 0 0 0 17 0 0 0 20 0 0 eik121b1v:~ # -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c16 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aj@suse.com, | |gregkh@suse.com, | |radmanic@suse.com Component|Basesystem |Kernel AssignedTo|varkoly@suse.com |kernel-maintainers@forge.pr | |ovo.novell.com Summary|checkproc returns wrong |/proc/<pid>/stat does not |values |show filename but path | |(was: checkproc returns | |wrong values) OS/Version|SuSE Other |SLES 11 Severity|Minor |Critical --- Comment #16 from Dr. Werner Fink <werner@suse.com> 2011-10-20 08:59:26 UTC --- (In reply to comment #15)
eik121b1v:~ # more /proc/$(cat /var/spool/amavis/amavisd.pid)/stat 3608 (/usr/sbin/amavi) S 1 3608 3608 0 -1 4202560 11045 0 14 0 127 8 0 0 20 0 1 0 8609 224161792 24720 18446744073709551615 4194304 5645308 140735348404400 140735348403656 140307836922899 0 0 4224 81927 0 0 0 17 0 0 0 20 0 0 eik121b1v:~ #
IMHO this is a kernel bug! The 15 bytes (16 including ASCII zero) should not use the full path but the filename of the program or the script. Hopefully this will not happen on SLES11-SP2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c17 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO CC| |jslaby@suse.com InfoProvider| |werner@suse.com --- Comment #17 from Jiri Slaby <jslaby@suse.com> 2011-10-31 10:00:12 UTC --- (In reply to comment #16)
IMHO this is a kernel bug! The 15 bytes (16 including ASCII zero) should not use the full path but the filename of the program or the script.
It contains whatever the task sets as its comm. Either by prctl(PR_SET_NAME) or by writing to /proc/<pid>/comm file. Maybe amavis sets its full path? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c18 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- InfoProvider|werner@suse.com |varkoly@suse.com --- Comment #18 from Dr. Werner Fink <werner@suse.com> 2011-11-02 12:18:25 UTC --- This seems to be a behaviour change of the kernel (read comment #7) and I'm not the author nor maintainer of amavis, asking Peter seems to be an better option ;) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c19 --- Comment #19 from Dr. Werner Fink <werner@suse.com> 2011-11-02 12:23:12 UTC --- @Jiri: without having the real filename of the script is becomes impossible to detect any running script by its filename, tools like pidof (with option -x) and startproc/killproc/checkproc become useless for scripts. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c20 --- Comment #20 from Peter Varkoly <varkoly@suse.com> 2011-11-06 07:26:11 UTC --- I've created the systemd service file for amavisd and now it works fine. I know this is not a solution for the original problem. Amavisd sets the command name by setting the '$0' variable: $0 = "amavisd ($amavis_task_id)"; $0 = 'sub-' . $0; # let it show in ps(1) $0 = 'amavisd (virgin child)'; $0 = sprintf("amavisd (ch%d-accept)", $child_invocation_count); $0 = sprintf("amavisd (ch%d-avail)", $child_invocation_count); $0 = sprintf("amavisd (ch%d-finish)", $child_invocation_count); $0 = 'amavisd (master)'; $0 = sprintf("amavisd (ch%d-P-idle)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-P)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-P-idle)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-P)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-P-idle)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-P)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-idle)", $Amavis::child_invocation_count); $0 = sprintf("amavisd (ch%d-%s)", $0 = sprintf("amavisd (ch%d-%s-idle)", $0 = sprintf("amavisd (ch%d)", $Amavis::child_invocation_count); But never ever will be set the full path. I'm helpless :-( -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c21 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- InfoProvider|varkoly@suse.com |mls@suse.com --- Comment #21 from Dr. Werner Fink <werner@suse.com> 2011-11-07 10:27:04 UTC --- (In reply to comment #20) Maybe this is a perl feature if a script sets $0 then use /proc/<pid>/comm of prctl(PR_SET_NAME), now let us aks a perl wizard like our perl maintainer :) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c22 --- Comment #22 from Peter Varkoly <varkoly@suse.com> 2011-11-08 05:08:01 UTC --- *** Bug 706257 has been marked as a duplicate of this bug. *** http://bugzilla.novell.com/show_bug.cgi?id=706257 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c23 Andreas Bolsch <andreas.bolsch@alumni.tu-berlin.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andreas.bolsch@alumni.tu-be | |rlin.de --- Comment #23 from Andreas Bolsch <andreas.bolsch@alumni.tu-berlin.de> 2011-11-19 14:01:41 UTC --- Same problem appears for spamd from spamassassin in 12.1 as it is a Perl script, too ... -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c24 --- Comment #24 from Pavel Koshevoy <paul@aragog.com> 2011-11-19 17:11:58 UTC --- Created an attachment (id=463035) --> (http://bugzilla.novell.com/attachment.cgi?id=463035) modified amavis script to use checkproc_script instead of checkproc /etc/init.d/amavis did not start/stop/status properly for me due to checkproc. I've worked around the checkproc problem by adding a shell script function checkproc_script that simulates the intended behavior of checkproc but also works for scripts. This solves the problem for me. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c25 Michael Schröder <mls@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW CC| |mls@suse.com InfoProvider|mls@suse.com | --- Comment #25 from Michael Schröder <mls@suse.com> 2011-11-21 13:47:33 UTC --- To shed some light on this, perl-5.14 uses prctl() to set $0, perl-5.12 did not do this. Here's the perldelta entry: Assignment to C<$0> sets the legacy process name with C<prctl()> on Linux On Linux the legacy process name will be set with L<prctl(2)>, in addition to altering the POSIX name via C<argv[0]> as perl has done since version 4.000. Now system utilities that read the legacy process name such as ps, top and killall will recognize the name you set when assigning to C<$0>. The string you supply will be cut off at 16 bytes, this is a limitation imposed by Linux. amavisd reads $0 (which results in /usr/sbin/amavisd), modifies it, and writes it back to $0. perl then does the prctl() call with the new name. One can argue that perl should just use the basename for the prctl() call, to be somewhat compatible to the kernel's setup_new_exec() call. But I don't think this would fix the bug, as amavisd modifies $0 by appending/prepending stuff, so checkproc probably won't detect a match (but maybe it cuts off after a space?). Seems like there's no trace of the old name left when a prctl(PR_SET_NAME) has been done. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c26 --- Comment #26 from Dr. Werner Fink <werner@suse.com> 2011-11-21 14:06:59 UTC --- (In reply to comment #24) Hmmm ... if the script starts with `#!' then checkproc should also test out /proc/<pid>/cmdline -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c27 Stephan Kulow <coolo@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |coolo@suse.com --- Comment #27 from Stephan Kulow <coolo@suse.com> 2011-11-21 15:24:50 CET --- checkproc looks for "(" + base + ")", so there is basically no chance to find it. But the checkproc code is marked as /* High risky */, so my suggestion would be: don't change $0 for the master process in amivsd to fix it. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c28 --- Comment #28 from Stephan Kulow <coolo@suse.com> 2011-11-21 15:29:29 CET --- Just wrote a little perl script: #! /usr/bin/perl -T $0 = "$0 (master)"; sleep(1000); Calling /tmp/t.pl gives me: coolo@desdemona#>cat /proc/738/stat 738 (/tmp/t.pl (mast) S 26084 738 26084 34819 738 4202496 555 0 0 0 0 0 0 0 20 0 1 0 104159608 16486400 437 18446744073709551615 4194304 5647116 140736706101472 140736706100376 139797874883824 0 0 128 0 0 0 0 17 1 0 0 0 0 0 coolo@desdemona#>cat /proc/738/cmdline /tmp/t.pl (master) So no hint this is a perl exe - I suggest not to support this in checkproc and be done with it ;( -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c29 --- Comment #29 from Dr. Werner Fink <werner@suse.com> 2011-11-21 14:37:53 UTC --- (In reply to comment #27) "(" + base + ")" is used for /proc/<pid>/stat the function checkscripts() is used for /proc/<pid>/cmdline (In reply to comment #28) As I've already written a few years back it is /* High risky */ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c30 Stefan Schäfer <st-schaefer@fsproductions.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |st-schaefer@fsproductions.d | |e --- Comment #30 from Stefan Schäfer <st-schaefer@fsproductions.de> 2011-11-26 16:19:26 UTC --- I'am not shure if I am right. For me it seem's that it that the command line is a part of this problem If I change line #16220 /usr/sbin/amavis from: $0 = c(´myprogram_name´ . ´ (master)´); to $0 = c(´myprogram_name´); starting, stopping and status request by sysvinit works fine. The same is to checkproc: invis-7:~ # checkproc -x -p /var/spool/amavis/amavisd.pid /usr/sbinamavisd invis-7:~ # echo $? 0 So far so good, but "killall amavisd" and "pgrep amavisd" didn't work. One reason is the shortened command line in /proc/<pid>/status "pgrep amavi" works I hope that my thougts are helpful. Stefan -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c31 Jeff Mahoney <jeffm@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO CC| |jeffm@suse.com InfoProvider| |werner@suse.com --- Comment #31 from Jeff Mahoney <jeffm@suse.com> 2012-03-24 23:52:00 EDT --- So what's the verdict here? I can see in 3.3 that calling /home/jeffm/tmp.pl only displays 'tmp.pl' in stat. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c32 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|werner@suse.com | --- Comment #32 from Dr. Werner Fink <werner@suse.com> 2012-03-26 14:09:30 UTC --- checkproc was written to be able to compare device and inodes of the running program and the binary from disk. For a fallback checkproc uses /proc/<pid>/stat to identify a running script by its names (which indeed is a risk). It seems that some scripts now shown with full path name whch does not fit into the 16 bytes used for the name in /proc/<pid>/stat -> compare with comment #c28 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c33 --- Comment #33 from Dr. Werner Fink <werner@suse.com> 2012-03-26 14:16:08 UTC --- Just compared Stephan's script on an old kernel with a kernel from 12.1: old : head -n 1 /proc/27985/status && cat /proc/27985/stat Name: t.pl 27985 (t.pl) S 32327 27985 32327 34841 27985 4202496 541 0 0 0 0 0 0 0 20 0 1 0 475999684 6320128 439 1771696128 134512640 136972940 3218382528 3218381524 4294960176 0 0 128 0 0 0 0 17 0 0 0 0 0 0 12.1 : head -n 1 /proc/7490/status && cat /proc/7490/stat Name: /suse/werner/Te 7490 (/suse/werner/Te) S 7450 7490 7450 34818 7490 4202496 539 0 0 0 0 0 0 0 20 0 1 0 476517410 15196160 371 7091580928 4194304 5647116 140735570242032 40735570240936 140594171436528 0 0 128 0 0 0 0 17 0 0 0 0 0 0 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c34 --- Comment #34 from Dr. Werner Fink <werner@suse.com> 2012-03-26 14:19:52 UTC --- It seems that there is no information left about the script file name: 12. : find /proc/7490/ -type f -a -perm u=r | xargs cat | grep t.pl cat: /proc/7490/task/7490/ns/net: Invalid argument cat: /proc/7490/task/7490/ns/uts: Invalid argument cat: /proc/7490/task/7490/ns/ipc: Invalid argument cat: /proc/7490/ns/net: Invalid argument cat: /proc/7490/ns/uts: Invalid argument cat: /proc/7490/ns/ipc: Invalid argument .. no way -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c35 --- Comment #35 from Jeff Mahoney <jeffm@suse.com> 2012-03-26 14:30:18 EDT --- It's a userspace issue. I used this script so I don't need to do ps and find the pid: #! /usr/bin/perl -T $0 = "$0 (master)"; open(STAT, "/proc/$$/stat") or die; my $line = <STAT>; print $line; Using a SLES11 SP2 system for both runs: jeffm@sled1:~> uname -r ; /home/jeffm/tmp.pl 3.1.0-1.2-default 4595 (tmp.pl) R 4550 4595 4550 34817 4595 4202496 521 0 0 0 0 0 0 0 20 0 1 0 26560 16584704 420 14329221120 4194304 5805580 140736756691568 140736756689928 140386202527568 0 0 128 0 0 0 0 17 1 0 0 0 0 0 jeffm@sled1:~> uname -r ; /home/jeffm/tmp.pl 3.0.13-default 4373 (tmp.pl) R 4271 4373 4271 34816 4373 4202496 522 0 0 0 0 0 0 0 20 0 1 0 7127 16584704 421 14329221120 4194304 5805580 140735039436048 140735039435640 140725939357520 0 0 128 0 0 0 0 17 0 0 0 0 0 0 Using an openSUSE 12.1 system for both runs: sled2:ß # uname -r ; /home/jeffm/tmp.pl 3.0.13-0.27-default 2946 (/home/jeffm/tmp) R 2114 2946 2114 1088 2946 4202496 507 0 0 0 0 0 0 0 20 0 1 0 4693 15196160 359 18446744073709551615 4194304 5647116 140734911709344 140734851228808 139719650340272 0 0 128 0 0 0 0 17 12 0 0 0 0 0 sled2:ß # uname -r ; /home/jeffm/tmp.pl 3.1.9-1.4-desktop 4814 (/home/jeffm/tmp) R 2541 4814 2541 1088 4814 4202496 523 0 0 0 0 0 0 0 20 0 1 0 11850 16482304 426 18446744073709551615 4194304 5647116 140735712501248 140735712500728 140045854358960 0 0 128 0 0 0 0 17 4 0 0 5 0 0 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c36 Jeff Mahoney <jeffm@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|Kernel |Basesystem AssignedTo|kernel-maintainers@forge.pr |mls@suse.com |ovo.novell.com | --- Comment #36 from Jeff Mahoney <jeffm@suse.com> 2012-03-26 17:33:04 EDT --- The difference between the two environments is that perl 5.14 (12.1) uses prctl() to set the process name and perl 5.10 (SP2) doesn't. It just relies on changing argv. The ltraces and straces I've seen bear this out. The kernel does fill comm with the last component of the path. Perl 5.10 doesn't call prctl so it doesn't replace it. Perl 5.14 does, which is why you see something different in /proc/pid/stat. Passing on to perl maintainer for further discussion. In any case, it's not a kernel issue. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c37 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |jeffm@suse.com --- Comment #37 from Dr. Werner Fink <werner@suse.com> 2012-03-27 07:13:50 UTC --- (In reply to comment #35) It is *not* a user space issue, it is a regression caused by the kernel version update. Before the kernel update no perl script was able to override the string in /proc/<pid>/stat nor the Name in /proc/<pid>/status, now after the kernel version update any perl script can do. This breaks the compatibility from SLES11-SP1 to SLES11-SP2 and this is what I call a regression. And I'd like to know how to determine the name of the used script below /proc/<pid>/ with kernels 3.+ with user space tools in SLES11-SP2 to be able to determine the script name by a system tools like pgrep(1), pkill(1), pidof(1), and my tools like checkproc(8). This kernel version update has take the edge off former working tools. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c38 Jeff Mahoney <jeffm@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|jeffm@suse.com | --- Comment #38 from Jeff Mahoney <jeffm@suse.com> 2012-03-27 11:10:46 EDT --- Yes, Werner, it is. Please re-read comment #35 which clearly demonstrates that it varies by which perl version is installed and not by which kernel version is installed. Comment #36 documents EXACTLY why that is. The prctl() PR_SET_NAME call has been essentially unchanged since SLES9. The difference is that perl 5.10 didn't use it and perl 5.14 does. Perl used to change just argv[0] and now it changes argv[0] AND uses prctl() to change the name that is used in /proc/$$/stat. Don't believe me? Try the same tests I did in comments #35 and #36. I don't know if there is a way to get what you want without modifying perl not to call prctl(). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c39 Michael Schröder <mls@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|mls@suse.com |werner@suse.com --- Comment #39 from Michael Schröder <mls@suse.com> 2012-03-28 09:56:24 UTC --- The perl maintainer already discussed this in comment #25 ;) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c40 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|werner@suse.com |mls@suse.com --- Comment #40 from Dr. Werner Fink <werner@suse.com> 2012-03-28 10:09:31 UTC --- (In reply to comment #39) ... and how can I fix this bug without having the required informations from the side of perl around? Sorry I'm not able to perform some magic to read not existing informations from /proc/<pid>/stat This is a regression that can be fixed by disabling this feature in perl otherwise I'm not able to fix anything. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c41 --- Comment #41 from Dr. Werner Fink <werner@suse.com> 2012-03-28 10:13:17 UTC --- Beside this there is no 'RESOLVED' with 'NOTSUPPORTEDANYMORE'. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c42 Michael Schröder <mls@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|mls@suse.com |werner@suse.com --- Comment #42 from Michael Schröder <mls@suse.com> 2012-03-28 10:22:15 UTC --- Sorry, but that's no bug in perl. But read my comment again, I doubt that you can fix this. The main amavisd process should be changed not to mess with $0. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=723708 https://bugzilla.novell.com/show_bug.cgi?id=723708#c43 Dr. Werner Fink <werner@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|werner@suse.com |varkoly@suse.com --- Comment #43 from Dr. Werner Fink <werner@suse.com> 2012-03-28 10:51:21 UTC --- maintainer of amavisd-new is varkoly@suse.com and not me, that is I can not fix this. Then the question rises if a patched amavisd will miss a major feature, that is to have a new command line. The next question is what about all the other perl scripts? IMHO this perl `feature' isn't one -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com