public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2 v2] security/dirtyc0w: synchronize parent and child
Date: Tue, 10 Oct 2017 08:17:19 -0400 (EDT)	[thread overview]
Message-ID: <1756862615.28187529.1507637839493.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20171009144307.GC25633@rei.lan>



----- Original Message -----
> Hi!
> > +		(void)execvpe(TEST_APP, av, tst_ipc_envp);
> > +		tst_brk(TBROK|TERRNO, "exec failed");
> 
> Can we please add SAFE_EXECVPE() to the library?
> 
> Other than that it looks good to me, acked.

I ran into a problem with older distros - execvpe() does not
exist there. How about we stay with execlp() and export
LTP_IPC_PATH by default, so that child inherits it?

Regards,
Jan

---

Subject: [PATCH/RFC] lib: add LTP_IPC_PATH to env. variables by default

Child started by exec() that needs to do tst_reinit() in order
to use checkpoints will inherit LTP_IPC_PATH by default.
Parent can choose to override/omit it in envp array when calling
exec[lvp]e().

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 lib/tst_test.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 233b370794a6..27a0b7c36679 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -100,10 +100,12 @@ static void setup_ipc(void)
        results = SAFE_MMAP(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, ipc_fd, 0);

        /* Checkpoints needs to be accessible from processes started by exec() */
-       if (tst_test->needs_checkpoints)
+       if (tst_test->needs_checkpoints) {
                sprintf(ipc_path, IPC_ENV_VAR "=%s", shm_path);
-       else
+               putenv(ipc_path);
+       } else {
                SAFE_UNLINK(shm_path);
+       }

        SAFE_CLOSE(ipc_fd);


  reply	other threads:[~2017-10-10 12:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 11:57 [LTP] [PATCH 1/2 v2] lib: allow checkpoints to be used by any uid Jan Stancek
2017-10-06 11:57 ` [LTP] [PATCH 2/2 v2] security/dirtyc0w: synchronize parent and child Jan Stancek
2017-10-09 14:43   ` Cyril Hrubis
2017-10-10 12:17     ` Jan Stancek [this message]
2017-10-10 12:22       ` Cyril Hrubis

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=1756862615.28187529.1507637839493.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /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