On Wed, 4 Nov 2020, Rin Okuyama wrote:
ptrace_common_{init,fini} are called from the ptrace_common module's modcmd routine in kern/sys_ptrace_common.c. The modcmd routine in turn is called at module initialization time. In the case of a built-in module, it will be called by module_init via init_main; if the module is loaded (or auto-loaded) module_load will call the modcmd routine.The module will be built-in if either ``options PTRACE'' or ``file- system PROCFS'' is set in the kernel configuration file.Oops, sorry, I meant ptrace_{init,fini}(). These functions are not called at all since this commit, which forbids ptrace(2) for non-root users.
If the module is built-in (``options PTRACE'' selected in the config file), then the module will already have been initialized. If the module is not built-in, then a privileged user will need to modload(8) the module. Prior to this change, the built-in ptrace_common module was calling the ptrace module's init/fini routine. Quite likely ptrace_common was built-in (due to inclusion of file-system PROCFS), so the init was handled during init_main(). This change ensures that the ptrace init/fini routines are called ONLY if the ptrace module itself (not the ptrace_common) routine is built-in. Please check to make sure that ``options PTRACE'' is included in your kernel config. +--------------------+--------------------------+-----------------------+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | [email protected] | | Software Developer | 0786 F758 55DE 53BA 7731 | [email protected] | +--------------------+--------------------------+-----------------------+
