misc/154922: jail_getid(3) does not work; jexec(8) does not work with names

Julian Fagir gnrp at gnrp.in-berlin.de
Sun Feb 20 23:00:23 UTC 2011


>Number:         154922
>Category:       misc
>Synopsis:       jail_getid(3) does not work; jexec(8) does not work with names
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 20 23:00:23 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Julian Fagir
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD zweihorn1 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010     root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
jail_getid(3) returns just the same jid as a string.
jail_getname(3) returns only the jid of the jid you give (as a string).

As far as I see, it is not a problem of my understanding, as the jexec(8)-manpage explicitly states that the jail can be supplied as a name or jid.
jls does return the right name of the jail as ezjail is configured to create, and indeed both of them are doing fine when asking for the name or starting a shell in the jail.
`ezjail-admin console` does use the id of the jail, anyway.
>How-To-Repeat:
Just `jls`, pick any jailname $JAILNAME and then run `jexec $JAILNAME sh`. It will fail as it does not find the name of the jail.

Alternatively, compile the following program with -ljail and run it with the only parameter the name of the jail:

#include <sys/types.h>
#include <sys/param.h>
#include <sys/uio.h>
#include <sys/jail.h>

#include <stdio.h>
#include <jail.h>

int
main(int argc, char* argv[]) {
  int jid;
  if (argc != 2)
    return(1);
  jid = jail_getid(argv[1]);
  printf("Jail %s is running: %d\n", argv[1], jid);
  return(0);
}
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list