[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080314093138.22861a55@laptopd505.fenrus.org>
Date: Fri, 14 Mar 2008 09:31:38 -0700
From: Arjan van de Ven <arjan@...radead.org>
To: Yan <rottled@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: 2.6.22.6 - Discrepancy between running and on-disk kernels
On Fri, 14 Mar 2008 12:08:16 -0400
Yan <rottled@...il.com> wrote:
> Can you point me to where in the source that self-patching happens? I
> tried grep'ing
> through the source for anything relevant, and came out empty handed.
in the apply_alternatives() function
>
> -yan
>
> On Fri, Mar 14, 2008 at 12:00 PM, Arjan van de Ven
> <arjan@...radead.org> wrote:
> > On Fri, 14 Mar 2008 10:51:43 -0400
> > Yan <rottled@...il.com> wrote:
> >
> > > Hello,
> > >
> > > I have been trying to compare the code from the on-disk
> > > compressed kernel that was booted and the running kernel
> > > extracted from /dev/kmem. I extracted the kernel's code from the
> > > disk image by stripping the head.S and similar and gunzipping
> > > it, and extracted the kernel from /dev/kmem by reading data
> > > between _text and _etext symbol offsets.
> > >
> > > I then ran both through a disassembler and diff'ed the outputs.
> > > Predictably, the disassembly was similar, but not identical. Some
> > > instructions (e.g. bts) had a 'lock' prefix, where as others had
> > > a 'nop' in its place.
> > >
> > > There were other differences with some instructions like mfence.
> > > Everything else matched just fine, the differences were mostly in
> > > memory-referencing instructions.
> > >
> > > My question is, what can be changing the kernel between being on
> > > static storage and being loaded?
> >
> > the kernel code is self-patching, it gets modified to match your
> > system during boot time. So you cannot assume that the kernel on
> > disk and the kernel in memory are identical.
> > (Same goes for modules)
> >
--
If you want to reach me at my work email, use arjan@...ux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists