mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [signal] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
Date: Mon, 10 Sep 2012 02:10:15 +0100	[thread overview]
Message-ID: <20120910011015.GM13973@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120910004753.GB27699@localhost>

On Mon, Sep 10, 2012 at 08:47:53AM +0800, Fengguang Wu wrote:
> Al,
> 
> Something bad happens since the below commit. Because commit [12/18] f411932
> was not tested, it might also be the first bad commit.

There's a damn good reason why the branch is called the way it's called ;-)
It's missing a lot of kernel_thread() stuff; I'm still not sure if it's
worth going that way, but there are some very attractive aspects.

Basically, if we had guaranteed that pt_regs instance on the bottom of the
stack will _not_ overlap anything for a kernel thread, we can move copying
pt_regs into kernel_execve() itself.  Which simplifies the hell out of
ret_from_kernel_execve() instances...

The price is that we need to leave that space aside for kernel threads.
It's not _that_ much and kernel threads are generally less stack-hungry
than the worst cases of syscalls (note that for userland process in the
middle of syscall that pt_regs instance *will* be there, no matter what).

FWIW, the plan for that branch is to do the following trick:
either split ret_from_kernel_thread away from ret_from_fork, setting the
right one to be used at copy_thread() time or make ret_from_fork itself
check if it's returning to kernel.  Either way, do *not* go through
return from syscall in return to kernel case; instead of that, have
ret_from_kernel_thread:
	schedule_tail();
	get the function to be called and its argument from regs and call it
	pass return value to do_exit() (BTW, I'm not at all sure we wouldn't
be better off if we took those do_exit() calls into 3--5 places in callbacks;
kernel_thread() is really very low-level and has few immediate callers).

Of course, such patches would have to go before the ret_from_kernel_execve()
ones.  Right now this branch is guaranteed to be broken; build testing does
make sense, but trying to boot it...  Not yet.

      parent reply	other threads:[~2012-09-10  1:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-10  0:47 Fengguang Wu
2012-09-10  0:54 ` [signal] general protection fault Fengguang Wu
2012-09-10  0:56 ` [signal] divide error Fengguang Wu
2012-09-10  0:59 ` [signal] double fault Fengguang Wu
2012-09-10  1:07 ` [signal] WARNING: at kernel/lockdep.c:2623 trace_hardirqs_off_caller() Fengguang Wu
2012-09-10  1:13   ` Al Viro
2012-09-10  1:23     ` Fengguang Wu
2012-09-10  1:10 ` Al Viro [this message]

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=20120910011015.GM13973@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome