GNU bug report logs - #70494
[PATCH 00/23] Groundwork for the Guile guix-daemon

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Sun, 21 Apr 2024 09:37:01 UTC

Severity: normal

Tags: patch

Full log


Message #77 received at 70494 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 70494 <at> debbugs.gnu.org
Subject: Re: [bug#70494] [PATCH 03/23] syscalls: Add missing pieces for
 derivation build environment.
Date: Tue, 07 May 2024 16:27:22 +0200
Hi!

(Starting to review this patch series, it might take a while…)

Christopher Baines <mail <at> cbaines.net> skribis:

> From: Caleb Ristvedt <caleb.ristvedt <at> cune.org>
>
> * guix/build/syscalls.scm (ADDR_NO_RANDOMIZE, UNAME26, PER_LINUX32): New
> variables.  Flags needed for improving determinism / impersonating a 32-bit
> machine on a 64-bit machine.
> (initialize-loopback, setdomainname, personality): New procedures.
> (octal-escaped): New procedure.
> (mount-points): Use octal-escaped to properly handle unusual characters in
> mount point filenames.
>
> Signed-off-by: Christopher Baines <mail <at> cbaines.net>
> Change-Id: I2f2aa38fe8f97f2565461d20331b95040a2d7539

[...]

> +(define (initialize-loopback)
> +  (let ((sock (socket PF_INET SOCK_DGRAM IPPROTO_IP)))
> +    (dynamic-wind
> +      (const #t)
> +      (lambda ()
> +        (set-network-interface-flags sock "lo"
> +                                     (logior IFF_UP IFF_LOOPBACK IFF_RUNNING)))
> +      (lambda ()
> +        (close sock)))))

Rather ‘set-loopback-interface-up’, by analogy with
‘set-network-interface-up’.  Also please add a docstring any maybe a
unit test, if possible.

> +;; TODO: verify these constants are correct on platforms other than x86-64
> +(define ADDR_NO_RANDOMIZE #x0040000)
> +(define UNAME26           #x0020000)
> +(define PER_LINUX32          #x0008)
> +
> +(define personality
> +  (let ((proc (syscall->procedure int "personality" `(,unsigned-long))))
> +    (lambda (persona)
> +      (let-values (((ret err) (proc persona)))
> +        (if (= -1 ret)
> +            (throw 'system-error "personality" "~A"
> +                   (list (strerror err))
> +                   (list err))
> +            ret)))))

Please add a docstring and basic unit test.

> +(define setdomainname
> +  (let ((proc (syscall->procedure int "setdomainname" (list '* int))))
> +    (lambda (domain-name)
> +      (let-values (((ret err) (proc (string->pointer/utf-8 domain-name)
> +                                    (bytevector-length (string->utf8
> +                                                        domain-name)))))
> +        (if (= -1 ret)
> +            (throw 'system-error "setdomainname" "~A"
> +                   (list (strerror err))
> +                   (list err))
> +            ret)))))

Ditto.

Ludo’.




This bug report was last modified 1 year and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.