Updating shared libraries

I want to add functionality to PackageKit to detect when a new version of a shared library is installed, and there are applications still using the old version that no longer exists. We can then inform the user if they need to restart the computer or log off and back on if the library was updated for a security vulnerability.

Does anyone have any example code (preferably written in C, although I’m not that bothered) that I could use? I think this would be quite nice functionality in future versions of PackageKit.


8 responses to “Updating shared libraries”

  1. glandium

    Debian has checkrestart, but it’s in python.

  2. Bob Bobson

    Why should users have to restart just because they’re updated a library? Doesn’t everyone criticise Windows for that? Just restart the application.

  3. Pádraig Brady

    This is any open file in general right, not just libs?
    I wonder could you cross reference deleted file from /proc?
    I.E. see of any of `find /proc/[0-9]*/fd -follow -links 0 2>/dev/null` are the files you just installed.

  4. Alex

    I don’t have code for this, and its probably not the best way to do it, but you could parse the contents of /proc/*/maps to collect a list of processes which have the library in question mapped in to their address space.

  5. gvarisco

    Sectool does something similar with their tests’ suite, but it is written in bash:


  6. Jerome Haltom

    You can basically troll through /proc/PID/something and pull all of the mapped files. gnome-system-monitor does this.

  7. Frank

    After a quick try with lsof: when deleting a shared lib in use by a program, lsof still lists the file with it’s original name, but the ‘fd’ is displayed as “DEL”.
    Maybe that gives you an idea about the direction to look in …

  8. Stu

    Can’t you call ldconfig and tell it to update the shared libraries without rebooting ?

Bad Behavior has blocked 2769 access attempts in the last 7 days.