[systemd-devel] [PATCH] Prevent crash due to infinite .include loop

Tom Gundersen teg at jklm.no
Sun Mar 10 20:00:27 PDT 2013


On Mar 11, 2013 9:12 AM, "Timothée Ravier" <siosm99 at gmail.com> wrote:
> A friend of mine found that with the current configuration system, it is
> possible for a unit to include itself thus creating an infinite loop.

Oops...

> I see two ways to fix this problem for good:
>
> * Limit the include depth arbitrarily and fail when reached;

Please don't  :-)

> * Remember which files systemd has already parsed and skip those if
> found in a ".include" directive.

This, but fail the unit. As unit file entries are not commutative there is
no correct place to 'cut the loop', so simply skipping already included
files would be incorrect.

Make sure to only fail on real cycles though: If A includes B and C, we
still want to allow both B and C to include D.

Thanks for the report.

Cheers,

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130311/b9d061a8/attachment.html>


More information about the systemd-devel mailing list