disabling kernel access to memory

Dave Hansen haveblue at us.ibm.com
Tue Aug 17 05:00:31 EST 2004


On Mon, 2004-08-16 at 09:53, Joel Schopp wrote:
> >>When creating artificial 'holes' in the physical address space,
> >>I would really like to disable all access to this memory in an
> >>effort to catch anyone making incorrect accesses.  Of course,
> >>these holes are at least 16MB (min LMB size) in size.  Is there
> >>an 'easy' way to prevent all access to these holes?
> >
> >
> > You might be able to hand them back to the hypervisor using the DLPAR
> > calls.
>
> I think the idea is that DLPAR calls are the hard part.  Doing an
> isolate requires all the PTEs and TCEs don't reference the memory for
> instance.

That shouldn't be too hard.  This is for debugging anyway, right Mike?
Put a check in the htab_pte_insert() (or whatever the hardware insertion
call) is to scream if you attempt to set a hardware pte to one of the
empty areas.  Then go kill all the Linux ptes, effectively (if these
were real functions (you shouldn't have to do this anyway if all of the
pages from that area are out of the allocator):

	for_each_task()
		for_each_pgd()
			for_each_pmd()
			...

Then, kill the kernel mappings.

> Back in my userspace days I remember threading libraries liked to use
> mprotect for such things.  Linux kernel has mprotect and sys_mprotect,
> not sure if they will fit your needs or not.

Those only apply to userspace pages.  I think Mike want to make sure to
kill all accesses to the memory, including from the kernel.

-- Dave


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list