Hi,
On 9/2/22 16:27, Greg Kroah-Hartman wrote:
On Fri, Sep 02, 2022 at 01:59:11PM +0000, Varsha Teratipally wrote:
Hi all,
Commit 20401d1058f3f841f35a594ac2fc1293710e55b9("ipc: replace costly bailout check in sysvipc_find_ipc()" fixes a high cve and optimizes the costly loop by adding a checkpoint, which I think might be a good candidate for the stable branches
What do you mean by "high cve"?
And that feels like it's an artificial benchmark fixup, what real workload benefits from this change?
Standard ipcs end up parsing /proc/sysvipc/*, thus there are real users where the performance of /proc/sysvsem/* matters.
But:
The performance of the function was bad since 2007, i.e. why is is now urgent? I do not see a bug that must be fixed.
Initial patch:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/ipc/...
(core issue: The code needs to find the next entry in an idr. And instead of using idr_get_next(), it uses idr_find() in a for(;;id++) loop.)
<<<
[manfred@localhost Input]$ rpm -qf /usr/bin/ipcs util-linux-core-2.38-1.fc36.x86_64
[manfred@localhost Input]$ strace -e openat /usr/bin/ipcs openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/lib/locale/en_US.UTF-8/LC_TIME", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/lib/locale/en_US.utf8/LC_TIME", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) ------ Message Queues -------- key msqid owner perms used-bytes messages openat(AT_FDCWD, "/proc/sysvipc/msg", O_RDONLY) = 3
------ Shared Memory Segments -------- key shmid owner perms bytes nattch status openat(AT_FDCWD, "/proc/sysvipc/shm", O_RDONLY) = 3 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3 openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 0x00000000 18 manfred 600 524288 2 dest openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 0x5125004a 19 manfred 600 3208 1
------ Semaphore Arrays -------- key semid owner perms nsems openat(AT_FDCWD, "/proc/sysvipc/sem", O_RDONLY) = 3 openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 0x51250047 0 manfred 600 1 openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3 0x51250049 2 manfred 600 1