I took a hard look at it again…with more printf()s.

It is killed at the execv which calls the calling executable to get
different random number generated values with a slightly different argv set
to prevent an indefinite loop.

I put the following in before the execv:

int i = pledge("stdio exec rpath”,
"stdio exec proc rpath cpath wpath dns id unveil tty error");
        if (i == -1)
                err(1, "pledge, line: %d", __LINE__);

After doing this it would dmesg rpath. I had to unveil(argv[0], “rx”);
argv[0] which is “./pkg_ping” or “/full/path/to/pkg_ping” instead of having
it as merely unveil(argv[0], “x”); which worked before.

Now it gets shot in the head and leaves nothing in dmesg

Does that mean that if execpromises is set, that it will get killed at
every execve() series call? Does pledge/unveil not accept directly
execv()ing back into the same program? Is it trying to read another file
which unveil is still affecting?





>>
>> Luke Small <lukensm...@gmail.com> wrote:
>>
>> > I have a program which runs fork() a couple times with pledges: “stdio
>> > cpath wpath” for writing to disk and “stdio dns” for a dns caching
>> process
>> > after accepting command-line input. Is the execpromises, permitted to
>> > increase/change to accommodate the different fork()s from the parent? If
>> > so, why isn’t all of this discussed in the manpage.
>> >
>> > I’m running 7.0 and it immediately is killed when I run pledge with a
>> > non-NULL execpromise.
>> >
>> > No error, just a sigabort. And nothing in the man page (even for
>> -current:
>> > on the web) which explains anything.
>> >
>> > https://github.com/lukensmall/pkg_ping
>> >
>> > This a command-line program is used to make manually choosing a
>> responsive
>> > mirror or automatically writing the most responsive OpenBSD mirror to
>> > /etc/installurl very easy.
>> >
>> > On Wed, Nov 24, 2021 at 11:50 AM Luke Small <lukensm...@gmail.com>
>> wrote:
>> >
>> > > I tried calling pledge with a non-NULL execpromise and noticed that
>> it was
>> > > killed. That’d be convenient if that behavior was noted in the man
>> page!--
>> > > -Luke
>> > >
>> > --
>> > -Luke
>>
> --
> -Luke
>
-- 
-Luke

Reply via email to