linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
From: Mark Fortescue <mark@mtfhpc.demon.co.uk>
To: mark@mtfhpc.demon.co.uk
Cc: aaw@google.com, akpm@linux-foundation.org,
	linux-arch@vger.kernel.org, sparclinux@vger.kernel.org,
	wli@holomorphy.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Re: [SPARC32] NULL pointer derefference
Date: Tue, 31 Jul 2007 02:02:19 -0700 (PDT)	[thread overview]
Date: Tue, 31 Jul 2007 08:55:20 +0100 (BST)	[thread overview]
Message-ID: <20070731.020219.78708972.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.61.0707310831080.4116@mtfhpc.demon.co.uk>

> I have formulated a patch that prevents the update_mmu_cache from doing 
> enything if there is no context available. This apears to have no 
> immediate, undesirable side effects.
> 
> This worked better than the alternative of setting up a context to work with.
> 
> Can you for see any issues in doing this?
> 
> If not, can you check+apply the attached (un-mangled) patch.

Thanks for tracking this down Mark.

The issue is that, when exec()'ing to userspace from a kernel thread,
we need activate_context() to be invoked before we try to touch
userspace at all.  This new argument handling is invoking
get_user_pages() before that happens.

activate_context() happens via flush_old_exec(), but that occurs via
load_elf_binary() et al. which is long after the argument fetching
code runs in fs/exec.c that is using get_user_pages().

(Mark, hint: activate_context() is defined to switch_mm() on
 sparc32, which is sun4c_switch_mm() which you thought was only
 invoked from context switches :-))

Touching userspace before activate_context() is questionable at best,
in my opinion.  But I can't come up with a good way to fix this right
now other than Mark's sparc patch, so I will apply it.

Thanks again Mark!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-07-31  9:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30  2:18 Mark Fortescue
2007-07-30  4:19 ` David Miller, Mark Fortescue
2007-07-30 10:39   ` Mark Fortescue
2007-07-31  5:35   ` Mark Fortescue
2007-07-31  6:42     ` David Miller, Mark Fortescue
2007-07-31  7:55       ` [PATCH] " Mark Fortescue
2007-07-31  9:02         ` David Miller, Mark Fortescue [this message]
2007-07-31  5:10 ` Ollie Wild
2007-07-31  6:54   ` Mark Fortescue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070731.020219.78708972.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=aaw@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark@mtfhpc.demon.co.uk \
    --cc=sparclinux@vger.kernel.org \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox