Jamie Gritton wrote:

> Author: jamie
> Date: Wed Aug 26 00:42:59 2020
> New Revision: 364791
> URL: https://svnweb.freebsd.org/changeset/base/364791
> 
> Log:
>   Handle jail.conf variables that have the same names as parameters.
>   
>   PR:         248444
>   Submitted by:       Akos Somfai
>   Reported by:        Markus Stoff
> 
> Modified:
>   head/usr.sbin/jail/config.c
> 
> Modified: head/usr.sbin/jail/config.c
> ==============================================================================
> --- head/usr.sbin/jail/config.c       Wed Aug 26 00:31:59 2020        
> (r364790)
> +++ head/usr.sbin/jail/config.c       Wed Aug 26 00:42:59 2020        
> (r364791)
> @@ -393,7 +393,8 @@ add_param(struct cfjail *j, const struct cfparam *p, e
>               else
>                       for (ipnum = IP__NULL + 1; ipnum < IP_NPARAM; ipnum++)
>                               if (!(intparams[ipnum].flags & PF_CONV) &&
> -                                 equalopts(name, intparams[ipnum].name)) {
> +                                 equalopts(name, intparams[ipnum].name) &&
> +                                 !(p->flags & PF_VAR)) {
>                                       j->intparams[ipnum] = np;
>                                       np->flags |= intparams[ipnum].flags;
>                                       break;

Looks like it's causing jail(8) to segfault, at least when using with
poudriere:

$
[00:00:00] Creating the reference jail... done
[00:00:07] Mounting system devices for current-local
[00:00:07] Mounting ports/packages/distfiles
[00:00:07] Using packages from previously failed build: 
/usr/local/poudriere/data/packages/current-local/.building
[00:00:07] Mounting ccache from: /var/cache/ccache
[00:00:07] Mounting packages from: 
/usr/local/poudriere/data/packages/current-local
[00:00:07] Copying /var/db/ports from: 
/usr/local/etc/poudriere.d/current-local-options
[00:00:07] Appending to make.conf: /usr/local/etc/poudriere.d/current-make.conf
/etc/resolv.conf -> 
/usr/local/poudriere/data/.m/current-local/ref/etc/resolv.conf
[00:00:07] Starting jail current-local
Segmentation fault (core dumped)
[00:00:08] Cleaning up
[00:00:08] Unmounting file systems
$

$ lldb /usr/sbin/jail --core /tmp/jail.core
(lldb) target create "/usr/sbin/jail" --core "/tmp/jail.core"
Core file '/tmp/jail.core' (x86_64) was loaded.

(lldb) bt all
* thread #1, name = 'jail', stop reason = signal SIGSEGV
  * frame #0: 0x000000000020c3fb jail`add_param(j=0x0000000800a09000, 
p=<unavailable>, ipnum=<unavailable>, value=<unavailable>) at config.c:399:16
    frame #1: 0x0000000000207e08 jail`main(argc=8, argv=0x00007fffffffe8f0) at 
jail.c:0
    frame #2: 0x0000000000206e10 jail`_start(ap=<unavailable>, 
cleanup=<unavailable>) at crt1_c.c:75:7
(lldb) 

This works fine when I back out this change.

Roman Bogorodskiy

Attachment: signature.asc
Description: PGP signature

Reply via email to