[systemd-devel] [PATCH] core/service: check if mainpid matches only if it set

Lennart Poettering lennart at poettering.net
Thu Feb 13 17:07:36 PST 2014

On Mon, 30.12.13 17:26, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> -        if (s->notify_access == NOTIFY_MAIN && pid != s->main_pid) {
> +        if (s->notify_access == NOTIFY_MAIN && s->main_pid != 0 && pid != s->main_pid) {
>                  log_warning_unit(u->id,
>                                   "%s: Got notification message from PID %lu, but reception only permitted for PID %lu",
>                                   u->id, (unsigned long) pid, (unsigned long) s->main_pid);
>                  return;

Hmm, this doesn't look right. This is about access control after all,
and we shouldn't allow these updates to be accepted from just anybody,
just because we don't know the main pid...

I have now changed this so that if we don't know the main pid, we will
print this at a lower log level (debug) and be less confusing with PID
== 0...

Does that make sense?


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list