Wednesday September 06, 2006 System-wide AppCrash for special processes
As discussed in Easy way to install AppCrash system-wide, AppCrash can be installed as a daemon watching the entire system for crashing processes. This has proven to be the most practical way to use it. Most AppCrash users I know don't modify any of those scripts. They just use the ones supplied with the tool.
(Generally, I've noticed that ready-to-use tools performing specific tasks tend to be used much more than toolkits requiring the users to spend a lot of time and effort to learn and then to build their own tools.)
However, recently I've got a few reports from users of AppCrash saying pstack(1) and other such commands didn't work due to permission problems of the crashing process in some cases, particularly when the crashing processes are more than "user applications."
The original AppCrash design was that app_crash.d or app_crash_global.d executed the runme_on_app_crash script as the user who owned the crashing process. As it turned out, there is a problem with this approach in some cases: certain special processes have complex permission settings that prevent this design from working correctly.
Here are two examples:
% /usr/ucb/ps auxww | grep Xsun gregns 17077 3.9 22.1287688111848 ? S Jul 28 513:48 /usr/openwin/bin/Xsun :0 -defdepth 24 -nobanner -auth /var/dt/A:0-D0aigb % whoami gregns % pstack 17077 pstack: cannot examine 17077: permission denied
To resolve this problem, I've modified (simplified, actually) the system-wide AppCrash setup described in Easy way to install AppCrash system-wide to run the /opt/app_crash/runme_on_app_crash script as root, regardless of who owns the crashing process.
Morgan Herrington and I have discussed the implications of this design change.
On one hand, running the runme_on_app_crash script as root resolves the problem described above: pstack(1) and other such commands produce their output as required for any crashing process. On the other hand, it may create some problems.
Here are the issues we have considered.
% ls -ld /var/tmp drwxrwxrwt 12 root sys 12288 Sep 1 15:42 /var/tmp/
Therefore, files created by root can't be deleted from there by non-root:
% cd /var/tmp % ls -l junk -rw-r--r-- 1 root root 0 Sep 1 15:39 junk % whoami gregns % rm junk rm: junk: override protection 644 (yes/no)? yes rm: junk not removed: Permission deniedTo resolve this problem, I've added the following statement at the end of the runme_on_app_crash script:
chmod 666 $APPCRASH_OUTThis way, the resulting output file will still be owned by root, but anyone will be able to delete it at cleanup time:
% ls -l junk -rw-rw-rw- 1 root root 0 Sep 1 15:39 junk % whoami gregns % rm junk %
If you already have system-wide AppCrash installed, here's how you can update it:
# /etc/init.d/app_crash stop # /etc/init.d/app_crash start
( Sep 06 2006, 11:11:36 AM EDT ) Permalink Comments [1]