tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Concerns in kern/subr_kobj.c



While perusing the code, I noticed some possible issues:

1. In kobj_unload() the calls to kobj_machdep() for data and rodata
   sections are conditional on the appropriate ko->ko_xxx_address being
   non-zero, yet the corresponding call for the text section is
   unconditional.

   But, from code just a little bit further down, there is a check
   for the ko->ko_text_address being 0 before calling uvm_km_free()
   on the text section.

   It seems to me that both calls should be conditional, or both
   should be unconditional.

2. In kobj_affix(), the calls to kobj_machdep() for data and rodata
   sections discard any possible error value from previous sections.
   So, if kobj_machdep() fails for the text section, but succeeds for
   the data or rodata sections, the rest of the code is unaware of
   any error having occurred.

   In particular, the trailing call to kobj_unload() would not happen;
   instead the code would simply proceed to update the VM protection
   bits for the text and rodata sections.



+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index