Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 09:54:45 +0200
From:      Jacques Fourie <jacques.fourie@gmail.com>
To:        Brian Fundakowski Feldman <green@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: kernel vm question
Message-ID:  <be2f524305012723543d835432@mail.gmail.com>
In-Reply-To: <20050127192629.GB1009@green.homeunix.org>
References:  <41F90140.3020705@trispen.com> <20050127160914.GA72454@VARK.MIT.EDU> <be2f52430501270848132f15c8@mail.gmail.com> <20050127192629.GB1009@green.homeunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the reply - I really appreciate it. I have tried to change
the protection on the page in a way similar to mprotect() but no luck.
I have had a look at what ddb does when modifying kernel code and
after applying the same ideas to my code everything works without a
problem.

The funny thing is that the original code (a mechanism we use to
'intercept' certain network functions in the kernel in order to do
extra processing such as IPsec) was working on FreeBSD 4.8 on all the
hardware that I tested with. Only after I ported the software to
FreeBSD 4.9 I began seeing this issue and then only on 2 specific
hardware configurations.
Now that I have a working solution it is not that important to me but
I would still like to understand why this does not fail 100% of the
time if the kernel code pages are not writeable by default.

Thanks again for all the replies I have received so far.

regards,
jacques



On Thu, 27 Jan 2005 14:26:29 -0500, Brian Fundakowski Feldman
<green@freebsd.org> wrote:
> On Thu, Jan 27, 2005 at 06:48:56PM +0200, Jacques Fourie wrote:
> > Hi,
> >
> > Yes, I am trying to patch a piece of code in the kernel. The strange
> > thing is that this code works without a problem on FreeBSD 4.8 - has
> > the VM system changed to such an extent between 4.8 and 4.9 that the
> > pages in the kernel code segment are not writeable anymore?
> >
> > Thanks for the bit about the compiler optimization - at least I
> > understand that part now :)
> 
> They should have never been writable.  You should be able to change that
> protection on the page temporarily though to achieve the effect you want;
> take a look at e.g. mprotect(), you should be able to do much the same
> thing with kernel_map instead.
> 
> --
> Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
>   <> green@FreeBSD.org                               \  The Power to Serve! \
>  Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\
>



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