jart / jart/pledge

PLEDGE_DRM support

Open
#5 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
143
Forks
7
PR merge metrics
No merged PRs in 30d

Description

When attempting to sandbox arcan or sway using pledge we get an error like

```
socket(AF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT) = 31
> /nix/store/c0hkzndf6i162jymxmlirn9l6ypv7p3c-glibc-2.38-23/lib/libc.so.6(__socket+0x14) [0xefbf4]
> /nix/store/k6jc2ilmlr0g9k6qdkr5n96bmdj7xav1-arcan-0.6.2.1-unstable-2023-10-14/bin/arcan(platform_device_init+0x1a0) [0x981d0]
> /nix/store/k6jc2ilmlr0g9k6qdkr5n96bmdj7xav1-arcan-0.6.2.1-unstable-2023-10-14/bin/arcan(main+0x58) [0x25ad8]
> /nix/store/c0hkzndf6i162jymxmlirn9l6ypv7p3c-glibc-2.38-23/lib/libc.so.6(__libc_start_call_main+0x70) [0x2b580]
> /nix/store/c0hkzndf6i162jymxmlirn9l6ypv7p3c-glibc-2.38-23/lib/libc.so.6(__libc_start_main+0x98) [0x2b658]
> /nix/store/k6jc2ilmlr0g9k6qdkr5n96bmdj7xav1-arcan-0.6.2.1-unstable-2023-10-14/bin/arcan(_start+0x30) [0x26df0]
```

In arcan's case, OpenBSD is supported using pledge and the following flags:
if (-1 == pledge("stdio drm sendfd proc rpath wpath", NULL)){
https://github.com/letoram/arcan/blob/5d42727c03177adb3e499dfb3e6a656c88eaacdc/src/platform/posix/psep_open.c#L892C1-L892C63

It would be great to have this version of pledge support "drm" as well to sandbox graphical environments.

https://github.com/openbsd/src/blob/9eae2935d282032ec0783176a11757cdac4c15b1/sys/kern/kern_pledge.c#L1127

Thanks @tkchia for figuring most of this out.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the pledge implementation and compare its supported promises with OpenBSD's kern_pledge.c, especially the drm handling referenced in the issue. Use Arcan's psep_open.c example and the reported socket call as the compatibility case; done means graphical environments such as Arcan or sway can use the drm promise while sandboxed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.