[Bug 256544] jail crashes on config parsing

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 11 Jun 2021 03:46:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256544

            Bug ID: 256544
           Summary: jail crashes on config parsing
           Product: Base System
           Version: Unspecified
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: cryptogranny@gmail.com

With the following config the jail binary crashes. Please, note $vnet in the
last config line. It's not defined and it's the reason.

# for real network
vnet;

mount.devfs;

path = "/censored/$name";

mount.devfs;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";

# for tcpdump
devfs_ruleset = 5;

allow.raw_sockets = true;
persist = true;

allow.set_hostname = true ;
allow.chflags = true ;
allow.sysvipc = true ;
allow.mount = true ;
allow.mount.devfs = true;
allow.mount.fdescfs = true ;
allow.mount.nullfs = true ;
allow.mount.procfs = true ;
allow.sysvipc = true;
#allow.mount.linprocfs = true ;
#allow.mount.linsysfs = true ;
allow.mount.tmpfs = true ;
allow.socket_af = true ;
allow.raw_sockets = true ;


1194 {

    exec.poststop = "$vnet ${jid} del";
}

(gdb) run -c 1194
Starting program: /usr/sbin/jail -c 1194

Program received signal SIGSEGV, Segmentation fault.
load_config () at /usr/src/usr.sbin/jail/config.c:229
229     in /usr/src/usr.sbin/jail/config.c

# uname -a
FreeBSD bewitched 12.2-RELEASE-p7 FreeBSD 12.2-RELEASE-p7 GENERIC  amd64

-- 
You are receiving this mail because:
You are the assignee for the bug.