2000-11-28 19:55:54

by Kurt Garloff

[permalink] [raw]
Subject: modutils-2.3.21: modprobe looping

Hi Keith,

thanks for your modutils-2.3.21!

During testing I found a problem:
modprobe pppoe was recursing endlessly in build_stack().

Find attached the modules.dep that caused this: There is a circular
dependency of pppoe on pppox on pppoe on ....

modprobe has code to detect this in build_stack(), but it seems to not work.
The old dep is thrown away and the new one is taken. And checked for
dependencies again :-(
Of course, one could also think of depmod making sure that such circular
dependencies do not occur, but I guess, it's more robust if depmod has a
working test in any case.

Test system was a PPC machine running 2.4.0-test9.

Do you have a fix for this?

Regards,
--
Kurt Garloff <[email protected]> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE GmbH, Nuernberg, FRG SCSI, Security


Attachments:
(No filename) (0.00 B)
(No filename) (232.00 B)
Download all attachments

2000-11-28 21:04:23

by Keith Owens

[permalink] [raw]
Subject: Re: modutils-2.3.21: modprobe looping

On Tue, 28 Nov 2000 20:22:59 +0100,
Kurt Garloff <[email protected]> wrote:
>Find attached the modules.dep that caused this: There is a circular
>dependency of pppoe on pppox on pppoe on ....

The kernel code is broken. Circular dependencies make no sense, the
pppoe maintainer agrees and I thought that bug was fixed.

>modprobe has code to detect this in build_stack(), but it seems to not work.
>The old dep is thrown away and the new one is taken. And checked for
>dependencies again :-(
>Of course, one could also think of depmod making sure that such circular
>dependencies do not occur, but I guess, it's more robust if depmod has a
>working test in any case.

Circular dependencies are not supported, nor are they correrctly
detected. The existing code to walk the inter module relationships,
including dependencies, alias, probe, probeall, before and after
statements is a mess. It just grew over the years with special cases
being added and is not robust.

In modutils 2.5 the entire code will be discarded and replaced with a
standard graph walking algorithm with loop detection and back tracking
instead of special case code. That might change some modutils
behaviour in rare cases and I do not want to change its behaviour just
before kernel 2.4 is released. I have a list of changes that might
break backwards compatibility waiting for modutils 2.5, this is just
one of them.

2000-11-28 21:07:42

by Rod Stewart

[permalink] [raw]
Subject: Re: modutils-2.3.21: modprobe looping


On Wed, 29 Nov 2000, Keith Owens wrote:
> On Tue, 28 Nov 2000 20:22:59 +0100,
> Kurt Garloff <[email protected]> wrote:
> >Find attached the modules.dep that caused this: There is a circular
> >dependency of pppoe on pppox on pppoe on ....
>
> The kernel code is broken. Circular dependencies make no sense, the
> pppoe maintainer agrees and I thought that bug was fixed.

It is fixed in test10/11.

-Rms

2000-11-28 21:55:34

by Kurt Garloff

[permalink] [raw]
Subject: Re: modutils-2.3.21: modprobe looping

On Wed, Nov 29, 2000 at 07:33:53AM +1100, Keith Owens wrote:
> On Tue, 28 Nov 2000 20:22:59 +0100,
> Kurt Garloff <[email protected]> wrote:
> >Find attached the modules.dep that caused this: There is a circular
> >dependency of pppoe on pppox on pppoe on ....
>
> The kernel code is broken. Circular dependencies make no sense, the
> pppoe maintainer agrees and I thought that bug was fixed.

No question that circular dependencies are a bug in the kernel/modules.
I just thought, that it would be nice if modprobe would not run crazy and
end up in an endless loop, possible risking the machine to run out of mem
with all the nice side effects this has on Linux. This is especially bad,
because modprobe is called invisibly by kmod.
Here's what happened on the test machine (2.4.0-test9 on Dual Power3):
Swapping like crazy; getting unresponsive; ...
Here's the last output top was able to produce:
10:12pm up 5:56, 3 users, load average: 1.57, 0.41, 0.16
65 processes: 63 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 36.9% user, 19.0% system, 0.0% nice, 44.0% idle
Mem: 509320K av, 508272K used, 1048K free, 28172K shrd, 76K buff
Swap: 131064K av, 107388K used, 23676K free 7048K cached

PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
23543 root 15 0 574M 472M 328 R 0 85.8 95.0 0:55 modprobe
2 root 11 0 0 0 0 DW 0 26.3 0.0 0:06 kswapd
23544 root 14 0 568 428 328 R 0 2.1 0.0 0:01 top
[...]
(10 mins later)
I'm afraid I can't wait until the machine recovers, if it ever will.
[2.2 with AA VM would have started to kill processes (which is bad)
till it would have finally killed modprobe (which is good);
but I'm afraid that 2.4 will just not survive at all :-( ]

> Circular dependencies are not supported, nor are they correrctly
> detected. The existing code to walk the inter module relationships,
> including dependencies, alias, probe, probeall, before and after
> statements is a mess. It just grew over the years with special cases
> being added and is not robust.

This is a pity, because I think the current behaviour is not acceptable,
as it can kill the machine by just being invoked by kmod.
I will try to make sense out of the code and make sure that modprobe
will not go crazy, by either detecting loops (if I can do that in a way
wihtout breaking things) or by limiting the recursion depth. I'll send
you a patch.

> In modutils 2.5 the entire code will be discarded and replaced with a
> standard graph walking algorithm with loop detection and back tracking
> instead of special case code. That might change some modutils
> behaviour in rare cases and I do not want to change its behaviour just
> before kernel 2.4 is released. I have a list of changes that might
> break backwards compatibility waiting for modutils 2.5, this is just
> one of them.

Looking forward to it.

Regards,
--
Kurt Garloff <[email protected]> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE GmbH, Nuernberg, FRG SCSI, Security


Attachments:
(No filename) (3.11 kB)
(No filename) (232.00 B)
Download all attachments

2000-11-29 01:21:23

by Kurt Garloff

[permalink] [raw]
Subject: Re: modutils-2.3.21: modprobe looping

On Tue, Nov 28, 2000 at 10:24:48PM +0100, Kurt Garloff wrote:
> This is a pity, because I think the current behaviour is not acceptable,
> as it can kill the machine by just being invoked by kmod.
> I will try to make sense out of the code and make sure that modprobe
> will not go crazy, by either detecting loops (if I can do that in a way
> wihtout breaking things) or by limiting the recursion depth. I'll send
> you a patch.

Find it attached. As the dependency generation looked indeed rather
cumbersome to me, I didn't really touch it. I just did implement the
recursion limit to prevent the modprobe process grabbing all the memory of
the system ...
root@cantaloupe:~ > modprobe -k pppoe
modprobe: Too deep recursion in module dependencies!
modprobe: Circular dependency? pppox pppoe
Aborted

Regards,
--
Kurt Garloff <[email protected]> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE GmbH, Nuernberg, FRG SCSI, Security


Attachments:
(No filename) (0.00 B)
(No filename) (232.00 B)
Download all attachments