Re: 2.6.9-rc2-mm2: devmem_is_allowed

From: Arjan van de Ven
Date: Fri Sep 24 2004 - 03:15:11 EST



On Fri, Sep 24, 2004 at 10:09:40AM +0200, Martin Diehl wrote:
> On Fri, 24 Sep 2004, Arjan van de Ven wrote:
>
> > On Fri, 2004-09-24 at 00:37, Martin Diehl wrote:
> > > Hi,
> > >
> > > after switching from working 2.6.9-rc2 to -mm2, X refused to start on my
> > > testbox. It turned out this was because it failed (EPERM) reading from
> > > /dev/mem beyond the 1MB limit.
> >
> > can you get me a strace of the failing X server?
> > The code as is is as designed; X has no business messing with kernel ram
> > over 1Mb, there is nothing there for it to (ab)use.
> > (There is PCI memory much higher up but that is allowed again)
>
> See below. I've reduced it to show the critical parts (AFAICS). Please
> tell me if I shall mail you the whole unmodified strace -f output from
> startx.

this looks good already; I'll investigate this further

> It looks like it is scanning /dev/mem page-by-page for some reason trying
> to get or identify some 512 page mapping. If /dev/mem does not return
> EPERM after 1MB (i.e. with my patch applied), it scans the whole 192MB of
> physical memory in the box entirely before it continues.

WHAT? WHY?

> Btw, if reading from /dev/mem is intended to fail above 1MB, it seems
> there might be an off-by-one somewhere, because the read starting at
> 1048576 (=1024 x 1024) below succeeds. I.e. the first page failing the
> read is page 257 on zero-based page counting, not 256.

the first page after 1Mb is "magic" for some bioses so this was deliberate

Attachment: pgp00000.pgp
Description: PGP signature