linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* build problems on architectures where FIXADDR_* stuff is not constant
@ 2003-05-13 12:23 Oleg Drokin
  2003-05-13 20:46 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Drokin @ 2003-05-13 12:23 UTC (permalink / raw)
  To: jdike, akpm, roland, linux-kernel, user-mode-linux-devel

Hello!

   Since there are architectures where FIXADDR_* stuff is not constant (e.g. UML),
   I propose this patch that allows such architectures to build. (now compilation
   dies with complaints about using not constant value as struct initialiser).
   Here is my proposed patch, or may be there is a better way?

   This is against latest 2.5 bk tree.

Bye,
    Oleg

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1094  -> 1.1095 
#	         mm/memory.c	1.123   -> 1.124  
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/05/13	green@angband.namesys.com	1.1095
# memory.c:
#   Well, not everyone have these FIXADDR_* as constants. UML have those as computed value.
#   So we need to assign those not in struct initializer.
# --------------------------------------------
#
diff -Nru a/mm/memory.c b/mm/memory.c
--- a/mm/memory.c	Tue May 13 16:18:28 2003
+++ b/mm/memory.c	Tue May 13 16:18:28 2003
@@ -696,15 +696,15 @@
 				   ones, we can make this be "&init_mm" or
 				   something.  */
 				.vm_mm = NULL,
-				.vm_start = FIXADDR_START,
-				.vm_end = FIXADDR_TOP,
-				.vm_page_prot = PAGE_READONLY,
 				.vm_flags = VM_READ | VM_EXEC,
 			};
 			unsigned long pg = start & PAGE_MASK;
 			pgd_t *pgd;
 			pmd_t *pmd;
 			pte_t *pte;
+			fixmap_vma.vm_start = FIXADDR_START;
+			fixmap_vma.vm_end = FIXADDR_TOP;
+			fixmap_vma.vm_page_prot = PAGE_READONLY;
 			pgd = pgd_offset_k(pg);
 			if (!pgd)
 				return i ? : -EFAULT;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: build problems on architectures where FIXADDR_* stuff is not constant
  2003-05-13 12:23 build problems on architectures where FIXADDR_* stuff is not constant Oleg Drokin
@ 2003-05-13 20:46 ` Andrew Morton
  2003-05-13 23:56   ` Andrew Morton
  2003-05-14  5:32   ` Oleg Drokin
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2003-05-13 20:46 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: jdike, roland, linux-kernel, user-mode-linux-devel

Oleg Drokin <green@namesys.com> wrote:
>
>    Since there are architectures where FIXADDR_* stuff is not constant (e.g. UML),
> ...
> +			fixmap_vma.vm_start = FIXADDR_START;
> +			fixmap_vma.vm_end = FIXADDR_TOP;
> +			fixmap_vma.vm_page_prot = PAGE_READONLY;
>  			pgd = pgd_offset_k(pg);
>  			if (!pgd)
>  				return i ? : -EFAULT;

That's modifying static storage which other, unrelated processes or CPUs
may be playing with.

The new code in get_user_pages() is rather rude - it's returning a
statically allocated VMA which isn't in the VMA tree - the caller (who
holds mmap_sem()) could reasonably expect that the VMA can be located via
find_vma(), or removed from the tree or whatever.  But it cannot.

I think it needs to be redone.  Either by stuffing a VMA into every
process's mm which describes the fixmap area, or by failing
get_user_pages() if the caller has passed in a non-NULL `vmas' and is
requesting access to the fixmap area.

Probably the latter.  That'll require that access_process_vm() be changed
to not require a vma.  It's only using the vma for cache flushing, but the
flishing in there is borked anyway.  



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: build problems on architectures where FIXADDR_* stuff is not constant
  2003-05-13 20:46 ` Andrew Morton
@ 2003-05-13 23:56   ` Andrew Morton
  2003-05-14  5:32   ` Oleg Drokin
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-05-13 23:56 UTC (permalink / raw)
  To: green, jdike, roland, linux-kernel, user-mode-linux-devel

Andrew Morton <akpm@digeo.com> wrote:
>
> The new code in get_user_pages() is rather rude - it's returning a
> statically allocated VMA which isn't in the VMA tree - the caller (who
> holds mmap_sem()) could reasonably expect that the VMA can be located via
> find_vma(), or removed from the tree or whatever.  But it cannot.
> 
> I think it needs to be redone.  Either by stuffing a VMA into every
> process's mm which describes the fixmap area, or by failing
> get_user_pages() if the caller has passed in a non-NULL `vmas' and is
> requesting access to the fixmap area.

Or by lazily instantiating the fixmap VMA within get_user_pages().  So if
someone happens to want to access the fixmap, that's when the vma which
describes it gets stuffed into the tree.

That'd require that get_user_pages() be called under down_write(mmap_sem).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: build problems on architectures where FIXADDR_* stuff is not constant
  2003-05-13 20:46 ` Andrew Morton
  2003-05-13 23:56   ` Andrew Morton
@ 2003-05-14  5:32   ` Oleg Drokin
  1 sibling, 0 replies; 4+ messages in thread
From: Oleg Drokin @ 2003-05-14  5:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: jdike, roland, linux-kernel, user-mode-linux-devel

Hello!

On Tue, May 13, 2003 at 01:46:20PM -0700, Andrew Morton wrote:
> >    Since there are architectures where FIXADDR_* stuff is not constant (e.g. UML),
> > ...
> > +			fixmap_vma.vm_start = FIXADDR_START;
> > +			fixmap_vma.vm_end = FIXADDR_TOP;
> > +			fixmap_vma.vm_page_prot = PAGE_READONLY;
> >  			pgd = pgd_offset_k(pg);
> >  			if (!pgd)
> >  				return i ? : -EFAULT;
> That's modifying static storage which other, unrelated processes or CPUs
> may be playing with.

Ah, stupid me. Missed the "static" thing :(

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-05-14  5:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-13 12:23 build problems on architectures where FIXADDR_* stuff is not constant Oleg Drokin
2003-05-13 20:46 ` Andrew Morton
2003-05-13 23:56   ` Andrew Morton
2003-05-14  5:32   ` Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).