On Sun, 5 Aug 2018, Martin Husemann wrote:

On Sun, Aug 05, 2018 at 09:09:54PM +0800, Paul Goyette wrote:
We could change syscall_establish() to install for both sys_nomodule or
sys_nosys entry points.  But then we'd need to remember which value to
restore when syscall_disestablish() is called.

Change the API and make syscall_establish() return the previous handler
as a token, and pass that to syscall_disestablish() ?

Well, syscall_{,dis}establish() works on a "package" of syscalls, so it
would have to return possibly multiple values.

Then maybe we should check the validity of the token in
syscall_disestablish(), but we are deep in "shoot your own foot"
teritory here.

Well, as I indicated before, it's not really essential to restore the
original value.  If we blindly reset to sys_nomodule the only down-side
is the attempt to find an auto-loadable module on subsequent calls for
the "wrongly-tagged" syscall.

Or we could just leave things alone, and tolerate the "hack" that is
currently being used.  And we could update the "hack" to store the
original entry-point value, so it could be properly restored.  This
would put the burden of remembering-the-original-entrypoint on the
individual module rather than adding overhead to the common code.  I
just don't like having to duplicate the "hack" in any other syscall
module that might want to have similar behavior.


+------------------+--------------------------+----------------------------+
| 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 |
+------------------+--------------------------+----------------------------+

Reply via email to