[lxc/lxc] f7f15b: make setproctitle()'s /proc/pid/stat parsing safe

0 views
Skip to first unread message

Christian Brauner

unread,
Apr 11, 2023, 1:47:48 AM4/11/23
to lxc-...@lists.linuxcontainers.org
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: f7f15b20a301d280403675ace11cdb53e42a909d
https://github.com/lxc/lxc/commit/f7f15b20a301d280403675ace11cdb53e42a909d
Author: Tycho Andersen <ty...@tycho.pizza>
Date: 2023-04-10 (Mon, 10 Apr 2023)

Changed paths:
M src/lxc/initutils.c

Log Message:
-----------
make setproctitle()'s /proc/pid/stat parsing safe

it turns out that our parsing of /proc/pid/stat was not safe in general
(though probably safe for lxc, since our executable names do not contain
spaces).

Let's fix this by looking backwards through the file for ), and then
continuing on from there.

This was reported to me by Solar Designer, who pointed me to this thread:
https://twitter.com/solardiz/status/1634204168545001473

Indeed, this is a lot of tap dancing to work around the kernel's 16
character executable limit. Perhaps I'll send a kernel patch to raise that
limit next.

Signed-off-by: Tycho Andersen <ty...@tycho.pizza>


Commit: e2d10d666cc5a14bf284d961c0939bc1aa27e334
https://github.com/lxc/lxc/commit/e2d10d666cc5a14bf284d961c0939bc1aa27e334
Author: Christian Brauner <chri...@brauner.io>
Date: 2023-04-11 (Tue, 11 Apr 2023)

Changed paths:
M src/lxc/initutils.c

Log Message:
-----------
Merge pull request #4299 from tych0/make-setproctitle-safe

make setproctitle()'s /proc/pid/stat parsing safe


Compare: https://github.com/lxc/lxc/compare/52326514c64b...e2d10d666cc5
Reply all
Reply to author
Forward
0 new messages