me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Build Xvfb and verify authenticated clients in the release kernel

diviocity committed 5 days ago · c3731b2aba091a48e212aa203a7b7926d9ba66b6 View patch
Unverified signature 5 files changed +116 -0
tests/x11/README.md +2 -0

@@ -32,3 +32,5 @@ v run tests/x11/release-elf.v "$release_assets" "$reference_apks" "$new_output"

3232The x86-64 client test booted Vinix with ten PGP-validated packages, including libX11, libfontenc and Pixman. `client.v` parsed a signed X geometry, mapped the Latin-9 euro character to Unicode and copied a one-pixel ARGB image through Pixman. All three checks passed. Its additional `--display` mode performs a pixmap readback against a running X server.

3333

3434The font test installed `mkfontscale` and both bitmap font packages by name. The cold install ran the pacman hook inside the target root and produced 766 owned file and link paths across twelve signed packages. Inside Vinix, `font-index.v` ran the installed hook’s command with the cursor font present, removed and restored. It verified the header count, the cursor entry and the fixed-font entry. Both QEMU runs used one vCPU and 384 MiB. Receipts and serial transcripts are under `~/.local/state/vinix/ports/musl-busybox-CqkBEA/xorg/worker/{x11-client-guest-04,font-index-guest-02}`.

35+

36+The headless server test installed `xvfb`, `xauth`, `xset`, `xrdb` and BusyBox by name. The x86-64 root contained 36 PGP-validated packages, 5,738 owned file and link paths and 68 target ELFs. On the release kernel, `headless.sh` started the packaged Xvfb with TCP disabled, authenticated a client, drew a pixmap and checked the returned pixel. The client also wrote and read back an X resource. A new connection with an empty authority file correctly failed. The 384 MiB, one-vCPU guest transcript and ISO checksum are under `~/.local/state/vinix/ports/musl-busybox-CqkBEA/xorg/worker/guest-xvfb-03`.

tests/x11/headless.sh new file +39 -0

@@ -0,0 +1,39 @@

1+#!/bin/sh

2+set -eu

3+export PATH=/bin:/usr/bin:/sbin:/usr/sbin HOME=/tmp

4+export DISPLAY=:71 XAUTHORITY=/tmp/vinix-x11.Xauthority

5+server=

6+finish() {

7+ status=$?

8+ if [ "$status" -ne 0 ]; then

9+ echo 'Vinix headless X11 guest check failed'

10+ if [ -f /tmp/xvfb.log ]; then cat /tmp/xvfb.log; fi

11+ fi

12+ if [ -n "$server" ]; then kill "$server" 2>/dev/null || true; fi

13+ /sbin/poweroff -f

14+}

15+trap finish EXIT

16+mkdir -p /tmp

17+# This fixed cookie belongs to an isolated guest display with TCP disabled.

18+xauth -q -f "$XAUTHORITY" add "$DISPLAY" MIT-MAGIC-COOKIE-1 0123456789abcdef0123456789abcdef

19+Xvfb "$DISPLAY" -auth "$XAUTHORITY" -nolisten tcp -noreset -screen 0 128x128x24 >/tmp/xvfb.log 2>&1 &

20+server=$!

21+attempt=0

22+until xset q >/tmp/xset.log 2>&1; do

23+ kill -0 "$server"

24+ attempt=$((attempt + 1))

25+ [ "$attempt" -lt 20 ]

26+ sleep 1

27+done

28+/x11-client --display

29+printf 'Vinix.sidecar: tested\n' >/tmp/xresources

30+xrdb -nocpp -load /tmp/xresources

31+xrdb -query >/tmp/xresources-query

32+grep -E '^Vinix\.sidecar:[[:space:]]*tested$' /tmp/xresources-query

33+: >/tmp/empty.Xauthority

34+if XAUTHORITY=/tmp/empty.Xauthority xset q >/tmp/unauthorized.log 2>&1; then

35+ echo 'Xvfb accepted an unauthenticated client'

36+ exit 1

37+fi

38+echo 'Packaged Xvfb, Xauth, Xlib, xset and xrdb guest checks passed.'

39+echo 'VPAC FIXTURE GUEST PASS'

xorg-server/configure.v new file +42 -0

@@ -0,0 +1,42 @@

1+// Configure the two X server profiles shipped in Vinix's X11 sidecar.

2+module main

3+

4+import os

5+

6+fn configure(profile string, source string, build string) ! {

7+ if profile !in ['headless', 'accelerated'] {

8+ return error('expected the headless or accelerated X server profile')

9+ }

10+ root := os.getenv('VPAC_MAKEPKG_ROOT')

11+ if !os.is_abs_path(root) {

12+ return error('set VPAC_MAKEPKG_ROOT to the staged target SDK')

13+ }

14+ script := os.abs_path(os.join_path(source, 'configure'))

15+ os.mkdir_all(build)!

16+ os.chdir(build)!

17+ os.setenv('CPPFLAGS', (os.getenv('CPPFLAGS') + ' -D__vinix__').trim_space(), true)

18+ os.setenv('LDFLAGS', (os.getenv('LDFLAGS') + ' -Wl,-rpath-link,' + root + '/usr/lib -rdynamic').trim_space(), true)

19+ mut args := [script, '--localstatedir=/var', '--with-xkb-bin-directory=/usr/bin',

20+ '--with-xkb-path=/usr/share/X11/xkb', '--with-xkb-output=/var/lib/xkb',

21+ '--with-fontrootdir=/usr/share/fonts/X11', '--enable-xvfb', '--disable-xephyr',

22+ '--disable-xnest', '--disable-suid-wrapper', '--disable-pciaccess', '--disable-dpms',

23+ '--disable-xres', '--disable-xvmc', '--disable-systemd-logind', '--disable-secure-rpc',

24+ '--disable-config-udev', '--disable-dri', '--disable-dri2', '--disable-int10-module',

25+ '--disable-vgahw', '--disable-xinerama', '--enable-screensaver']

26+ setting := if profile == 'accelerated' { '--enable-' } else { '--disable-' }

27+ for feature in ['xorg', 'dri3', 'libdrm', 'glamor', 'glx'] {

28+ args << setting + feature

29+ }

30+ os.execvp('vinix-configure', args)!

31+}

32+

33+fn main() {

34+ if os.args.len != 4 {

35+ eprintln('usage: configure.v PROFILE XORG_SOURCE BUILD_DIRECTORY')

36+ exit(2)

37+ }

38+ configure(os.args[1], os.args[2], os.args[3]) or {

39+ eprintln(err)

40+ exit(1)

41+ }

42+}

xvfb/PKGBUILD.vile new file +32 -0

@@ -0,0 +1,32 @@

1+defpkgbuild(xvfb,

2+ #:pkgname, "xvfb",

3+ #:pkgver, "21.1.16",

4+ #:pkgrel, 2,

5+ #:pkgdesc, "Vinix headless X server with a virtual framebuffer",

6+ #:arch, [#:x86-64, #:aarch64],

7+ #:license, "MIT",

8+ #:url, "https://www.x.org/",

9+ #:depends, ["musl", "libbsd", "libmd", "libxau", "libxdmcp", "libxfont2", "libxshmfence", "pixman", "xkbcomp", "xkeyboard-config", "font-misc-misc", "font-cursor-misc"],

10+ #:makedepends, ["xorgproto", "xtrans", "linux-headers", "libx11", "libxcb", "libxext", "libxkbfile"],

11+ #:source, ["https://xorg.freedesktop.org/archive/individual/xserver/xorg-server-21.1.16.tar.xz",

12+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/patches/xorg-server/jinx-working-patch.patch",

13+ "configure.v"],

14+ #:sha256sums, ["b14a116d2d805debc5b5b2aac505a279e69b217dae2fae2dfcb62400471a9970",

15+ "74929113283893aff082d39edfa4a39f6e4f68134572831ce55ad75ebbc47449",

16+ "9ac9cb2e6ae8e24833ba13c8cf6a34bfdf6ca49fa6e9f3bc16f2e876cbcbede5"],

17+ #:prepare, fn() {

18+ run("patch", "--batch", "--fuzz=0", "-d", "xorg-server-21.1.16", "-p1", "-i", "../jinx-working-patch.patch")

19+ },

20+ #:build, fn() {

21+ run("v", "run", "configure.v", "headless", "xorg-server-21.1.16", "headless")

22+ run("make", "-C", "headless")

23+ },

24+ #:check, fn() {

25+ run("readelf", "-d", "headless/hw/vfb/Xvfb")

26+ run("vinix-run", "headless/hw/vfb/Xvfb", "-help")

27+ },

28+ #:package, fn() {

29+ run("make", "-C", "headless/hw/vfb", "install", string-append("DESTDIR=", pkgdir()))

30+ run("install", "-d", "-m755", string-append(pkgdir(), "/var/lib/xkb"))

31+ run("install", "-Dm644", "xorg-server-21.1.16/COPYING", string-append(pkgdir(), "/usr/share/licenses/xvfb/COPYING"))

32+ })

xvfb/configure.v new file +1 -0

@@ -0,0 +1 @@

1+../xorg-server/configure.v