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 v3.1] lib: add tst_no_corefile()
Date: Thu, 11 Jul 2019 08:45:36 -0400 (EDT)	[thread overview]
Message-ID: <1337100107.32641000.1562849136661.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20190711123441.GA8709@rei>



----- Original Message -----
> Hi!
> > +void tst_no_corefile(int verbose)
> > +{
> > +	struct rlimit new_r, old_r;
> > +
> > +	SAFE_GETRLIMIT(RLIMIT_CORE, &old_r);
> > +	if (old_r.rlim_max >= 1 || geteuid() == 0) {
> > +		/*
> > +		 * 1 is a special value, that disables core-to-pipe.
> > +		 * At the same time it is small enough value for
> > +		 * core-to-file, so it skips creating cores as well.
> > +		 */
> > +		new_r.rlim_cur = 1;
> > +		new_r.rlim_max = 1;
> > +		SAFE_SETRLIMIT(RLIMIT_CORE, &new_r);
> > +	}
> > +
> > +	if (verbose)
> > +		tst_res(TINFO, "Avoid dumping corefile for process(pid=%d)", getpid());
> 
> Should we print the message here only
> 
> 	if (old_r.rlim_max <= 1 || geteuid() == 0)
> 
> because otherwise we will print the mesasge even in cases that the
> corefile is not in fact limited.

Depends on setup of core_pattern, if it's core-to-file it's already limited.
If it's core-to-pipe, then it's no limit, so I agree, we can move it above.

> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 

  reply	other threads:[~2019-07-11 12:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05  5:16 [LTP] [PATCH v3] lib: add tst_no_corefile() Li Wang
2019-07-08 13:08 ` [LTP] [PATCH v3.1] " Jan Stancek
2019-07-11 12:34   ` Cyril Hrubis
2019-07-11 12:45     ` Jan Stancek [this message]
2019-07-17  7:47       ` Li Wang
2019-07-17  7:56         ` Jan Stancek
2019-07-15  3:01   ` Li Wang

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=1337100107.32641000.1562849136661.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