linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: linux-arch@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH] s390: add arch_change_pid for arch updates after task pid change
Date: Thu, 19 Apr 2018 18:08:28 +0200	[thread overview]
Message-ID: <20180419160827.GB19917@redhat.com> (raw)
In-Reply-To: <20180419162056.6b657d71@mschwideX1>

On 04/19, Martin Schwidefsky wrote:
>
> On Thu, 19 Apr 2018 16:07:29 +0200
> Oleg Nesterov <oleg@redhat.com> wrote:
>
> > On 04/19, Martin Schwidefsky wrote:
> > >
> > > In a multi-threaded program any thread can call execve(). If this
> > > is not done by the thread group leader, the de_thread() function
> > > replaces the pid of the task that calls execve() with the pid of
> > > thread group leader. If the task reaches user space again without
> > > going over __switch_to() the sampling tag is still set to the old
> > > pid.
> >
> > If this is the only reason for arch_change_pid() hook, then perhaps
> > it would be better/simpler to add it into de_thread() right after
> > change_pid(tsk, PIDTYPE_PID, task_pid(leader)) ?
> >
> > note also that this way arch_change_pid() doesn't need any checks and
> > any arguments, you can simply do
> >
> > void arch_change_pid(void)
> > {
> > 	S390_lowcore.current_pid = current->pid;
> > 	if (test_facility(40))
> > 		lpp(&S390_lowcore.lpp);
> > }
>
> Yeah, the first patch I created to verify that this indeed the problem
> basically looked like your proposal. But then why not make it a more
> general hook for any kind of PID change?

Well, I doubt very much we will ever need an arch-specific hook for
sys_setsid() or setpgid()... plus

> Dunno if this is a worthwhile
> approach, the simpler version for sure works as well.

and perhaps you can make another, even more simple change? can't you just
introduce the s390 version of arch_setup_new_exec, something like

	void arch_setup_new_exec(void)
	{
		if (S390_lowcore.current_pid != current->pid) {
			S390_lowcore.current_pid = current->pid;
			...
		}
	}

?

Oleg.

  reply	other threads:[~2018-04-19 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  6:44 [RFC][PATCH] s390: add arch_change_pid for arch updates after task pid change Martin Schwidefsky
2018-04-19 14:07 ` Oleg Nesterov
2018-04-19 14:20   ` Martin Schwidefsky
2018-04-19 16:08     ` Oleg Nesterov [this message]
2018-04-20  8:12       ` Martin Schwidefsky

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=20180419160827.GB19917@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=schwidefsky@de.ibm.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;
as well as URLs for NNTP newsgroup(s).