All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Teo Couprie Diaz <teo.coupriediaz@arm.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] setpgid02: Use pid_max as PGID for EPERM
Date: Thu, 20 Apr 2023 10:50:38 +0200	[thread overview]
Message-ID: <ZED83l2ke1whTc4E@yuki> (raw)
In-Reply-To: <b589a29f-98e5-b3dc-530b-af3a2a1207d2@arm.com>

Hi!
> The mechanism is indeed different. My first approach to this patch was 
> to fork and setsid() the child, which
> implied an EPERM due to the session difference.
> However, when discussing this approach on the mailing list (see 
> https://lists.linux.it/pipermail/ltp/2023-April/033505.html )
> it was brought to my attention that setpgid03 is in fact doing exactly 
> that already.
> 
> Knowing that, I didn't feel it would be worthwhile to add such a case in 
> setpgid02.
> 
> However, I spent more time looking at the code on the kernel side 
> prompted by your remark and I think
> that setpgid03 is going through another path:
> 
>      if (same_thread_group(p->real_parent, group_leader)) {
>          err = -EPERM;
>          if (task_session(p) != task_session(group_leader))
>              goto out;
> 
> So it might indeed make sense to add another case in setpgid02.
> 
> Would initializing a pty be necessary though ? Could it be simply 
> achieved by spawning a child that
> setsid() itself, and try to setpgid the parent to the child PGID ? 
> (Rather than setpgid the child as in setpgid03)

Right, no need for a tty, we can just change the session.

> Maybe it would make sense to add that case to setpgid03 rather than 
> setpgid02, as setpgid03 already has
> the necessary scaffolding ?

That would be the best, we can simply add TST_EXP_FAIL() to the
do_child() in setpgid03. However please make sure to update the test
descriptions in both tests.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2023-04-20  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 13:09 [LTP] [PATCH] setpgid02: Use pid_max as PGID for EPERM Teo Couprie Diaz
2023-04-19  8:25 ` Li Wang
2023-04-19 11:00 ` Cyril Hrubis
2023-04-19 11:11   ` Li Wang
2023-04-19 12:40     ` Teo Couprie Diaz
2023-04-20  8:50       ` Cyril Hrubis [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=ZED83l2ke1whTc4E@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=teo.coupriediaz@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.