[Top] [All Lists]

Re: [patch] linux 2.4.5: __dbe_table iteration #2

To: Keith Owens <>
Subject: Re: [patch] linux 2.4.5: __dbe_table iteration #2
From: "Maciej W. Rozycki" <>
Date: Thu, 23 Aug 2001 18:52:45 +0200 (MET DST)
Cc: Ralf Baechle <>,,
In-reply-to: <>
Organization: Technical University of Gdansk
Reply-to: "Maciej W. Rozycki" <>
On Thu, 23 Aug 2001, Keith Owens wrote:

> The definition of struct archdata in kernel and modutils can be
> different, a new kernel layout with an old modutils is legal but fatal
> unless you code for it.  The correct test for archdata is
> if (!mod_member_present(mp, archdata_start) ||
>     (mp->archdata_end - mp->archdata_start) <=
>      offsetof(struct archdata, dbe_table_end))
>       continue;
> Do not use archdata unless it is at least large enough to contain
> dbe_table_end.  That test also takes care of NULL pointers, end - start
> == 0 for NULL.

 Hmm, your suggested code checks if the passed struct is long enough for
dbe_table_start only -- what about dbe_table_end?  The following code: 

ap = (struct archdata *)(mod->archdata_start);
if (!mod_member_present(mp, archdata_start) ||
    (mp->archdata_end - mp->archdata_start) <
     offsetof(struct archdata, dbe_table_end) + sizeof(ap->dbe_table_end))

should be stricter.  While modutils as released won't ever pass a smaller
struct, someone may modify them or use another program to invoke
init_module(), so we need to protect the kernel against bogus data. 

> The rest of the code looks OK, except it needs a global change of
> arch_init_module: to module_arch_init: to match the macro name.

 OK, I'll do it.  It should have been done for ia64 in the first place.
Or should it be changed into "<arch>_init_module" to match functions' real

> Do you have the corresponding modutils patch or shall I do it? 

 I've send it to you separately just after the kernel patch.  Should I
resend it? 


+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+        e-mail:, PGP key available        +

<Prev in Thread] Current Thread [Next in Thread>