public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Dmitry ADAMUSHKA (EXT)" <dmitry.adamushka_ext@softathome.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>, Ralf Baechle <ralf@linux-mips.org>,
	wouter cloetens <wouter.cloetens@softathome.com>,
	linux-kernel@vger.kernel.org,
	Dmitry Adamushko <dmitry.adamushko@gmail.com>
Subject: Re: 'khelper' (child) is stuck in endless loop: do_signal() and !user_mode(regs)
Date: Thu, 8 Mar 2012 17:29:13 +0100	[thread overview]
Message-ID: <20120308162913.GA12554@redhat.com> (raw)
In-Reply-To: <1587824623.61690.1331219566458.JavaMail.root@storentr1.softathome.com>

On 03/08, Dmitry ADAMUSHKA (EXT) wrote:
>
> The following quick hack "fixes" it for x86.

First of all let me repeat, I do not understand this asm ;)
Fortunately Ingo and Peter do.

But,

> --- arch/x86/kernel/entry_32.S.orig     2012-03-08 15:42:25.041296595 +0100
> +++ arch/x86/kernel/entry_32.S  2012-03-08 15:58:29.926081131 +0100
> @@ -98,12 +98,6 @@
>  #endif
>  .endm
>
> -#ifdef CONFIG_VM86
> -#define resume_userspace_sig   check_userspace
> -#else
> -#define resume_userspace_sig   resume_userspace
> -#endif
> -
>  /*
>   * User gs save/restore
>   *
> @@ -327,10 +321,19 @@ ret_from_exception:
>         preempt_stop(CLBR_ANY)
>  ret_from_intr:
>         GET_THREAD_INFO(%ebp)
> -check_userspace:
> +resume_userspace_sig:
> +#ifdef CONFIG_VM86
>         movl PT_EFLAGS(%esp), %eax      # mix EFLAGS and CS
>         movb PT_CS(%esp), %al
>         andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
> +#else
> +/*
> + * We can be coming here from a syscall done in the kernel space,
> + * e.g. a failed kernel_execve().
> + */
> +       movl PT_CS(%esp), %eax
> +       andl $SEGMENT_RPL_MASK, %eax
> +#endif
>         cmpl $USER_RPL, %eax
>         jb resume_kernel                # not returning to v8086 or userspace

IIUC (I can be easily wrong) this breaks the endless loop, but
only after do_notify_resume() was already called.

_perhaps_ it would be better to avoid do_notify_resume() in this
case altogether. Say, fire_user_return_notifiers() doesn't look
right in this case, we are not going to return to the usermode.

Not that I think this is really wrong though.

Oleg.


  parent reply	other threads:[~2012-03-08 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAO6Zf6C+SDZ-TV12wr9oiO6HB-itQ6fLPHFugXk0osEiAxW22w@mail.gmail.com>
2012-03-08 15:12 ` 'khelper' (child) is stuck in endless loop: do_signal() and !user_mode(regs) Dmitry ADAMUSHKA (EXT)
2012-03-08 15:55   ` Dmitry ADAMUSHKA (EXT)
2012-03-08 16:08     ` Oleg Nesterov
2012-03-08 16:29   ` Oleg Nesterov [this message]
2012-03-08 16:58     ` Dmitry ADAMUSHKA (EXT)
2012-03-12 16:35       ` Dmitry ADAMUSHKA (EXT)
2012-03-12 18:00         ` Oleg Nesterov
     [not found] <139779962.60750.1331202718116.JavaMail.root@storentr1.softathome.com>
2012-03-08 10:37 ` Dmitry ADAMUSHKA (EXT)
2012-03-08 15:46   ` Oleg Nesterov
     [not found] <1144797072.59663.1331142646789.JavaMail.root@storentr1.softathome.com>
2012-03-07 17:51 ` Dmitry ADAMUSHKA (EXT)
2012-03-07 18:46   ` Oleg Nesterov
2012-03-07 20:05     ` Dmitry Adamushko

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=20120308162913.GA12554@redhat.com \
    --to=oleg@redhat.com \
    --cc=dmitry.adamushka_ext@softathome.com \
    --cc=dmitry.adamushko@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ralf@linux-mips.org \
    --cc=wouter.cloetens@softathome.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