[CRIU] [PATCH] crtools: allow only absolute logfile and pidfile paths with -d option

Andrew Vagin avagin at parallels.com
Mon Nov 11 02:23:14 PST 2013


On Mon, Nov 11, 2013 at 04:33:48PM +0400, Ruslan Kuprieiev wrote:
> On 11.11.2013 08:41, Andrew Vagin wrote:
> >On Mon, Nov 11, 2013 at 06:41:02AM +0400, Ruslan Kuprieiev wrote:
> >>-d is to be used primarily by some start up scripts, so lets allow only absolute path for confidence.
> >I don't understand the reason. We use -D to set current dir, so when we
> >use reletive paths, we undestand where these files are created.
> 
> -D should be used to point where daemon should chdir to. And
> pidfile/logfile paths may differ. So to determine behavior we
> decided to allow only absolute paths for logfile/pidfile.

I don't understand, why you want to forbid reletive paths. Why is it
bad? Why is it dangerous.

A current directory is not something undefined...

> 
> >-d is used in zdtm.sh for page-server. Don't forget to fix it there.
> >
> >>Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> >>---
> >>  crtools.c | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >>
> >>diff --git a/crtools.c b/crtools.c
> >>index 9f0b6e4..20cedbc 100644
> >>--- a/crtools.c
> >>+++ b/crtools.c
> >>@@ -277,6 +277,12 @@ int main(int argc, char *argv[])
> >>  		}
> >>  	}
> >>+	if (opts.restore_detach)
> >>+		if (opts.output[0] != '/' || opts.pidfile[0] != '/') {
> >>+			pr_err("-d requires absolute paths for both logfile and pidfile\n");

I think you need to metion --restore-detached and --daemon here

> >>+			return -1;
> >>+		}
> >>+
> >>  	log_set_loglevel(log_level);
> >>  	if (log_init(opts.output))
> >>-- 
> >>1.8.1.2
> >>
> >>_______________________________________________
> >>CRIU mailing list
> >>CRIU at openvz.org
> >>https://lists.openvz.org/mailman/listinfo/criu
> 


More information about the CRIU mailing list