Index | Thread | Search

From:
David Higgs <higgsd@gmail.com>
Subject:
pinsyscalls question
To:
OpenBSD Tech <tech@openbsd.org>
Date:
Sat, 4 Jan 2025 17:23:08 -0500

Download raw body.

Thread
  • David Higgs:

    pinsyscalls question

In exec_elf_makecmds:

/* Static binaries may not call pinsyscalls() */
if (interp == NULL)
     p->p_vmspace->vm_map.flags |= VM_MAP_PINSYSCALL_ONCE;

But this is set *before* the new process vmspace is created.

There's two cases when creating the vmspace.  If reusing the vmspace,
uvmspace_exec clears these two flags:

vm_map_modflags(map, 0, VM_MAP_WIREFUTURE |
   VM_MAP_PINSYSCALL_ONCE);

Otherwise it initializes the vmspace fresh, which I think ignores any
previous PINSYSCALL_ONCE settings.

I haven't gone through the exercise of creating a static binary that calls
pinsyscalls(2), so this is all speculation based on reading code.  Am I
missing something or should this flag be set later in sys_execve?

Thanks.

--david