试图通过 checkinstall 或 porg 理解 LD_PRELOAD 和 SUID/SGID

trying to understand LD_PRELOAD and SUID/SGID with checkinstall or porg

我想用porg in my LFS distro. It's similar to checkinstall,它用LD_PRELOAD

1。如果您阅读 README:

CheckInstall currently is unable to track any file system changes made by statically linked programs

我认为它指的是mkdirmvln等命令。所以我对此应该没有任何问题。我说得对吗?

2。然后,主要问题:

NOTE ON SUID/SGID PROGRAMS: CheckInstall can't track their actions because of some limitations in the LD_PRELOAD system that installwatch uses. This is good for security reasons, but it can generate unexpected results when the installation process uses SUID/SGID binaries.

这是什么意思?我不在乎我是否忘记了一些文件。我很在意是否会出现意想不到的结果,或者我是否无法正确安装包。

还有,有多少包有这个问题?

  1. 如果您系统上的 coreutils(mkdirmv 等)是静态链接的(即 运行ning file报告 "statically linked") porg 将无法跟踪他们的操作,因此一些已安装的文件可能无法跟踪。静态链接的可执行文件是 Linux 的第二 class 公民,LD_PRELOAD 不支持它们。

  2. Setuid 可执行文件确实会在使用前清理 LD_PRELOAD - 它们会忽略所有名称中带有斜杠的文件(以便只能加载来自标准系统路径的文件)并且还需要共享库本身设置了 setuid 位。因此,在您的情况下,您需要找到 porg 的预加载库并在其上设置 setuid 位(通过 chmod a+s libxyz.so)。顺便说一句,要求 porg 作者在他们的发行版中进行此更改可能是有意义的。我认为这不会在典型的软件包中引起任何问题,因为安装程序通常不需要 运行 setuid 程序(如 mountpasswdsudo)。