Re: s6-log can create current with 640?

From: Guillermo <gdiazhartusch_at_gmail.com>
Date: Fri, 25 Oct 2019 14:06:58 -0300

El vie., 25 oct. 2019 a las 5:22, Dewayne Geraghty escribió:
>
> Results for umask
> rm -f /tmp/t1 ; /usr/local/bin/execlineb -Pc 'redirfd -w 1 /tmp/t1 umask
> 037 echo hello' ; echo $? ; ls -l /tmp/t1
> [...]
> I've placed the ktrace's dumpfile in txt format so its readable for you at
> http://www.heuristicsystems.com/s6-umask/t1.kdump
 42180 execlineb CALL execve(0x7fffffffc770,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/sbin/redirfd"
 42180 execlineb RET execve -1 errno 2 No such file or directory
 42180 execlineb CALL execve(0x7fffffffc770,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/bin/redirfd"
 42180 execlineb RET execve -1 errno 2 No such file or directory
 42180 execlineb CALL execve(0x7fffffffc760,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/usr/sbin/redirfd"
 42180 execlineb RET execve -1 errno 2 No such file or directory
 42180 execlineb CALL execve(0x7fffffffc760,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/usr/bin/redirfd"
 42180 execlineb RET execve -1 errno 2 No such file or directory
 42180 execlineb CALL execve(0x7fffffffc760,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/usr/local/sbin/redirfd"
 42180 execlineb RET execve -1 errno 2 No such file or directory
 42180 execlineb CALL execve(0x7fffffffc760,0x7fffffffc830,0x7fffffffea40)
 42180 execlineb NAMI "/usr/local/bin/redirfd"
 42180 execlineb NAMI "/libexec/ld-elf.so.1"
 42180 redirfd RET execve JUSTRETURN

> I also tried what I thought was the more logical
> # rm -f /tmp/t1 ; /usr/local/bin/execlineb -Pc 'umask 033 redirfd -w 1
> /tmp/t1 echo hello' ; echo $? ; ls -l /tmp/t1
> [...]
> This ktrace is
> http://www.heuristicsystems.com/s6-umask/t1-umask-redirfd.kdump
   276 execlineb CALL execve(0x7fffffffc770,0x7fffffffc830,0x7fffffffea40)
   276 execlineb NAMI "/usr/bin/umask"
   276 execlineb NAMI "/bin/sh"
   276 execlineb NAMI "/libexec/ld-elf.so.1"
   276 sh RET execve JUSTRETURN
[...]
   276 sh CALL
openat(AT_FDCWD,0x7fffffffed10,0x100000<O_RDONLY|O_CLOEXEC>)
   276 sh NAMI "/usr/bin/umask"
   276 sh RET openat 3
   276 sh CALL fcntl(0x3,F_DUPFD_CLOEXEC,0xa)
   276 sh RET fcntl 10/0xa
   276 sh CALL close(0x3)
[...]
   276 sh CALL read(0xa,0x104c9d0,0x400)
   276 sh GIO fd 10 read 160 bytes
       "#!/bin/sh
        # $FreeBSD: stable/12/usr.bin/alias/generic.sh 151635
2005-10-24 22:32:19Z cperciva $
        # This file is in the public domain.
        builtin ${0##*/} ${1+"$_at_"}
       "
   276 sh RET read 160/0xa0

Let me guess: the value of PATH is
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin,
execline's chain loading umask is in /usr/local/bin, and FreeBSD
happens to have an 'umask' shell script in /usr/bin. If that is
correct, then you'll have to either use the absolute pathname
/usr/local/bin/umask in the execlineb chain, or run it with a PATH in
which /usr/local/bin comes before /usr/bin.

G.
Received on Fri Oct 25 2019 - 17:06:58 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC