Repository navigation
varlink/pid1 fixes for systemd-oomd (addresses #20330) - #24919
Conversation
keszybz
left a comment
There was a problem hiding this comment.
Partial review, because I ran out of time. Will continue later.
| assert(ret_s); | ||
|
|
||
| if (m->varlink_server) | ||
| return 1; |
There was a problem hiding this comment.
Hmm, what it the return convention, i.e. what is the difference between 0 and 1?
There was a problem hiding this comment.
Hmmm I'm not sure. It looks like this all used to return 0 but was changed in 064a5c1. @daandemeyer is there a reason why we return both 0 and 1?
8ed62d4 to
03d8e1e
Compare
|
Update according to review comments that seem unambiguous:
|
03d8e1e to
432481b
Compare
|
Latest update changes an |
432481b to
3bec461
Compare
|
Changes:
|
3bec461 to
2e9eadc
Compare
|
I think I addressed all of the latest review comments:
|
2e9eadc to
0f68c7d
Compare
|
I'd still put the serialize/deserialize functions in varlink-internal.h or so to clearly indicate these are not intended for public distribution if we ever make varlink.h public |
0f68c7d to
7377cd8
Compare
|
Addressed the latest round of comments from Yu and split out the varlink serialize/deserialize into |
Split out per-socket code into a separate function to use as part of serialize/deserialize in the next commit.
7377cd8 to
5e1f33b
Compare
|
Addressed the latest round of comments from Yu and added a comment about why NSS is not used for the systemd-oomd unit check. |
Attempt to address systemd#20330 (comment). Summary of the comment: Unprivileged users can potentially cause a denial of service during systemd-oomd unit subscriptions by spamming requests to SubscribeManagedOOMCGroups. As systemd-oomd.service is the only unit that should be accessing this method, add a check on the caller's unit name to deter them from successfully using this method.
5e1f33b to
2842128
Compare
|
Fixed header and added comment. |
| if (!u) | ||
| return varlink_error(link, VARLINK_ERROR_PERMISSION_DENIED, NULL); | ||
|
|
||
| /* This is meant to be a deterrent and not actual security. The alternative is to check for the systemd-oom |
There was a problem hiding this comment.
I think that this comment is under-selling the protection provided here. Unit names are under control of root, and a unit name is not easy to fake. The attacker would need to move the PID into the systemd-oomd.service cgroup, which requires privileges again.
Attempt to fix the 2 issues brought up in #20330.
The first few commits address the issue of serializing the varlink sockets across systemctl daemon-reexec boundaries.
The last commit adds a check so that only systemd-oomd can use SubscribeManagedOOMCGroups.