Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2010 02:55:52 +0100
From:      "C. P. Ghost" <cpghost@cordula.ws>
To:        Robert Bonomi <bonomi@mail.r-bonomi.com>
Cc:        questions@freebsd.org
Subject:   Re: how to disable loadable kernel moduels?
Message-ID:  <d74eb87c1002241755q576ed48bwd04fbbedbe290bc9@mail.gmail.com>
In-Reply-To: <201002242247.o1OMlPov010540@mail.r-bonomi.com>
References:  <201002242247.o1OMlPov010540@mail.r-bonomi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 24, 2010 at 11:47 PM, Robert Bonomi
<bonomi@mail.r-bonomi.com> wrote:
>
> Can somebody point me towrads the source module(s) that contain the
> syscall 'dispatch' code and/or the loadable module implementation.

According to /usr/src/sys/kern/syscalls.master, the kldload() syscall
ID is 304:
  304     AUE_MODLOAD     STD     { int kldload(const char *file); }

You may also want to look at /usr/src/sys/kern/kern_linker.c
which contains kern_kldload(), kldload()  and others. You could
try to short-circuit one of them, by returning immediately some
appropriate E* error code, as in:

int
kern_kldload(struct thread *td, const char *file, int *fileid)
{
#ifdef DISABLE_KLDLOAD_ALWAYS
    return ENOSYS;
#endif
    /* the remaining of kern_kldload() goes here... */
}

Maybe this would be enough to disable KLD loading entirely?

> I'm looking to either disable the kernel function ENTIRELY, *or* (in
> the spirit of 'making life difficult for the bad guys') letting it
> do everything it normally does, *except* actually installing the module
> _functionality_ -- i.e., kldload executes w/o error, kldstat shows that
> the module "is" loaded, etc.; but any attempt to _use_ the functionality
> therein is a no-op.

Regards,
-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d74eb87c1002241755q576ed48bwd04fbbedbe290bc9>