Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jul 2024 12:28:11 +0530
From:      Reshad Patuck <reshadpatuck1@gmail.com>
To:        freebsd-questions@freebsd.org, freebsd-pkgbase@freebsd.org
Subject:   Re: SemLock as user permission denied after update to 14.1
Message-ID:  <CADaJeD2o-ocYz-Yvbb-CBo1ToRZFLBByrcuoHu-NBHGfYB21EQ@mail.gmail.com>
In-Reply-To: <CADaJeD2Brma9UJqbJC7VjQf=V4Aq8n%2BURgy9q0F1B09RKQvCPw@mail.gmail.com>
References:  <CADaJeD2Brma9UJqbJC7VjQf=V4Aq8n%2BURgy9q0F1B09RKQvCPw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Half answering my own question - it seems like for some reason the
permissions on /tmp have changed after the upgrade.
Running truss on the minimal python command `truss python3.11 -c
"import multiprocessing; multiprocessing.Queue()"` let me to the error
`open("/tmp/SEMDmp-g_lyusv5",O_RDWR|O_EXLOCK|O_CREAT|O_EXCL|O_CLOEXEC,0600)
ERR#13 'Permission denied'`
The permissions for 14.0 seem to allow group and other write (and
append) access to /tmp but write (and append) access is denied for
these two on 14.1.
Running `chmod o+w /tmp` fixes the issue for me, but it would be nice
to know why this happened to begin with.
Any insight as to why this would have changed when updating the system
would be really helpful.

I've been stuck on this for a day, looks like posting a question to
the mailing list is a catalyst for figuring things out myself :)
Hope this is at least helpful for someone else who gets stuck with
something similar.

##### Output from FreeBSD 14.1 #####
# uname -iKmoprU
FreeBSD 14.1-RELEASE-p2 amd64 amd64 GENERIC 1401000 1401000
# getfacl /tmp/
# file: /tmp/
# owner: root
# group: wheel
            owner@:rwxp--aARWcCos:-------:allow
            group@:r-x---a-R-c--s:-------:allow
         everyone@:r-x---a-R-c--s:-------:allow
# ls -al /tmp/
total 48
drwxr-xr-x   7 root         wheel 15 Jul 12 03:01 .
drwxr-xr-x  21 root         wheel 30 Jul 11 05:14 ..

##### Output from FreeBSD 14.0 #####
# uname -iKmoprU
FreeBSD 14.0-RELEASE-p5 amd64 amd64 GENERIC 1400097 1400097
# getfacl /tmp/
# file: /tmp/
# owner: root
# group: wheel
            owner@:rwxp--aARWcCos:-------:allow
            group@:rwxp--a-R-c--s:-------:allow
         everyone@:rwxp--a-R-c--s:-------:allow
# ls -al /tmp/
total 92
drwxrwxrwt   7 root         wheel      16 Jul 12 03:01 .
drwxr-xr-x  21 root         wheel      30 Jul  9 11:53 ..

On Fri, 12 Jul 2024 at 11:00, Reshad Patuck <reshadpatuck1@gmail.com> wrote:
>
> Hi,
>
> I have just updated one of my systems from FreeBSD 14.0 to 14.1 (using
> pkg-base).
> One of my python programs that runs as a non-root user fails to get a
> SemLock when running as a non-root user.
> This works fine on my other FreeBSD 14.0 systems.
> Is there anything I am missing here or during my update?
> Any steps to find out what permissions are missing/what has changed
> will be really helpful.
>
> pkg base has been complied from git hash -
> 1eba659e2f689d4014136048a8e470e852bdc69b
> ports have been compiled via poudriere from git hash -
> 1d024a4a0a853573d8586dc097ee9762b41c671b
>
> ##### Output from FreeBSD 14.1 running as the admin user #####
> $ id
> uid=2000(admin) gid=2000(admin) groups=2000(admin),0(wheel)
> $ uname -iKmoprUv
> FreeBSD 14.1-RELEASE-p2 FreeBSD 14.1-RELEASE-p2 #0 1eba659e2-dirty:
> Thu Jul  4 14:46:15 UTC 2024
> root@freebsd-zfs:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64
> GENERIC 1401000 1401000
> $ python3.11
> Python 3.11.9 (main, Jul  4 2024, 09:04:54) [Clang 16.0.6
> (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a on
> freebsd14
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import multiprocessing
> >>> multiprocessing.Queue()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python3.11/multiprocessing/context.py", line
> 103, in Queue
>     return Queue(maxsize, ctx=self.get_context())
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.11/multiprocessing/queues.py", line 43,
> in __init__
>     self._rlock = ctx.Lock()
>                   ^^^^^^^^^^
>   File "/usr/local/lib/python3.11/multiprocessing/context.py", line 68, in Lock
>     return Lock(ctx=self.get_context())
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.11/multiprocessing/synchronize.py",
> line 169, in __init__
>     SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
>   File "/usr/local/lib/python3.11/multiprocessing/synchronize.py",
> line 57, in __init__
>     sl = self._semlock = _multiprocessing.SemLock(
>                          ^^^^^^^^^^^^^^^^^^^^^^^^^
> PermissionError: [Errno 13] Permission denied
> >>>
>
> ##### Output from FreeBSD 14.1 running as the root user #####
> # id
> uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
> # uname -iKmoprUv
> FreeBSD 14.1-RELEASE-p2 FreeBSD 14.1-RELEASE-p2 #0 1eba659e2-dirty:
> Thu Jul  4 14:46:15 UTC 2024
> root@freebsd-zfs:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64
> GENERIC 1401000 1401000
> # python3.11
> Python 3.11.9 (main, Jul  4 2024, 09:04:54) [Clang 16.0.6
> (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a on
> freebsd14
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import multiprocessing
> >>> multiprocessing.Queue()
> <multiprocessing.queues.Queue object at 0x1f9d8e0f4b10>
> >>>
>
> ##### Output from FreeBSD 14.0 running as the admin user #####
> $ id
> uid=2000(admin) gid=2000(admin) groups=2000(admin),0(wheel)
> $ uname -iKmoprUv
> FreeBSD 14.0-RELEASE-p8 FreeBSD 14.0-RELEASE-p8 #0 5e2380679-dirty:
> Thu Jul  4 08:31:06 UTC 2024
> root@freebsd-zfs:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64
> GENERIC 1400097 1400097
> $ python3.11
> Python 3.11.9 (main, Jul  4 2024, 09:04:54) [Clang 16.0.6
> (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a on
> freebsd14
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import multiprocessing
> >>> multiprocessing.Queue()
> <multiprocessing.queues.Queue object at 0x275315928f10>
> >>>
>
> Best,
> Reshad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADaJeD2o-ocYz-Yvbb-CBo1ToRZFLBByrcuoHu-NBHGfYB21EQ>