From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id qKPDMa5ucGdPqgAAe85BDQ:P1 (envelope-from ) for ; Sat, 28 Dec 2024 21:33:35 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id qKPDMa5ucGdPqgAAe85BDQ (envelope-from ) for ; Sat, 28 Dec 2024 22:33:34 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Vp1Xxk04; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Qd7zBbft; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735421614; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=U+QW9xvfHGKRthWS304bFy/IP6NvqFLQVgbkpB/UuO4=; b=Ewauimy83umoYwD0g94XFrUEWEe/a3hWSM2FR71l3TPEw0wGpmAxDc63x3ZJ33HYc/ezRo fCNayqE2Jntp1uOVzR+86X+CXvR58HUDXtsDyGGFIMnxG+sfLvDG+kZgdalSWGOi1+XAs8 UpfFDiLGNbh+M8LqQBkxyOmsDaZrAAJ/nI89H8Ud5nDsJBVvC8UeoAYeH+3zBaRUJL6u4+ uW4fRS94BgpzDAuMNVa6coOPJN4WOLZBExJnoNPxPf/JPy0tvnT0SMMKmG0wYAZx9QST47 DXC9+gO8QW4Eqa8lmllc3OaWdpMKFhqRkucNeWqbpgfT3mDdDJqbI4P5t6Gjbg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Vp1Xxk04; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Qd7zBbft; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735421614; a=rsa-sha256; cv=none; b=hIP6yZuiv4Mv14rUvzrGn+IuzK30Tcju/c7NXZ5+SpYBiydaNgIQdG0/c52T8PskbsVCZU 0FD90xPa0bytdA/niu4Vs88Mefao9yrrBLUfz4fAmnB8BdSlcIqlkfS2HGnesDpdT5f3Wc cRdMQykZGlJUw3trQDOLIqM9kA7bgIoAk4vkS+UCbxDWTsAKMUbixSvsip6pcPxcW+4N96 Dg4gp9Tg+PEkkVBNR/maMTiu7Kev0V1uortcqcMF28suRo8jPI30gBZQ0w9ocbgCrqVLX6 5OkGg94wR5lPG/0w4E7EeAu19TIu/Kwm9QPxENM/n2FBGDhx14R0LBri2HB+5w== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7653E18513 for ; Sat, 28 Dec 2024 22:33:34 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tReQj-0006OT-JY; Sat, 28 Dec 2024 16:33:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tReQh-0006OF-Lf for guix-patches@gnu.org; Sat, 28 Dec 2024 16:33:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tReQh-0000Mw-BD for guix-patches@gnu.org; Sat, 28 Dec 2024 16:33:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=U+QW9xvfHGKRthWS304bFy/IP6NvqFLQVgbkpB/UuO4=; b=Vp1Xxk04vszX/7qYfGSrca6jX9428cSFwZ1cPEZyLKpPGVqyZo2xYRxqLQ7zLwh2CEde5RAayf/5avr5QMSjYZreSWtUTdUZVgvag1Bp/LV5R8HXaz7f4k/6DiMwQ5rfLfVDu5T8sGb+w2cJ+g1TbMEPmHPD5KcytuKbVayAMhs7JuPAhHUhSOah5K51z9ygH/6gs4/25LiEwFBzBaAI47z+wEPZqz1SYSxABqdl4EoHAOWU7lnZiaPxtJGx2YINScWK1Fs55rfxZHXGvtkfToQFeqGWYQiscJuw0l+U6HHr7o6ysfqnZ9sgHZn7GSMMMnZBsKOpz6naDPyJJR16bA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tReQg-0002Mn-5N for guix-patches@gnu.org; Sat, 28 Dec 2024 16:33:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75027] [PATCH v2 1/3] syscalls: Add =?UTF-8?Q?=E2=80=98kexec-load-file=E2=80=99.?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 28 Dec 2024 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75027 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 75027@debbugs.gnu.org Received: via spool by 75027-submit@debbugs.gnu.org id=B75027.17354215549058 (code B ref 75027); Sat, 28 Dec 2024 21:33:02 +0000 Received: (at 75027) by debbugs.gnu.org; 28 Dec 2024 21:32:34 +0000 Received: from localhost ([127.0.0.1]:52858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tReQE-0002M1-21 for submit@debbugs.gnu.org; Sat, 28 Dec 2024 16:32:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tReQB-0002Ll-PR for 75027@debbugs.gnu.org; Sat, 28 Dec 2024 16:32:32 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tReQ6-0000Kv-HC; Sat, 28 Dec 2024 16:32:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=U+QW9xvfHGKRthWS304bFy/IP6NvqFLQVgbkpB/UuO4=; b=Qd7zBbftmB7MvAc7osvr XSOjSATEoBqGqBfKqRTESvnnx1JzN3nQZcmUW5FXGNjsl2Qq+nUbsu6B5LiEQN/KgXTi2nK8fF7OG nsJrkjIKx6n4xsyq14DV1uq0BLFN2iwLuLx0wRZ3u55Se6pG/Tm7SB3t4ROlmJGkK2A/z584zKX1p VrkULC1DgFSj0/LFxaUSZqz5tJR3x9DaTcpvONIYshjfTtp3fEuzaLbslXZL0OirG9ERzaVEB6kZz 5lmyLQgT3vH3Ts6RKJkNtIeucsXLSKp8YArDIfvfKh/9z7BsyMQyKoHyMz2gwbpSOBtMUABOfvVMo ezE2SPEK93isEg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87ikr4s5e5.fsf@gmail.com> (Maxim Cournoyer's message of "Sat, 28 Dec 2024 15:12:02 +0900") References: <87ikr4s5e5.fsf@gmail.com> Date: Sat, 28 Dec 2024 22:32:23 +0100 Message-ID: <8734i7trx4.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -4.70 X-Spam-Score: -4.70 X-Migadu-Queue-Id: 7653E18513 X-TUID: QmQNkLqPzL4p --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Maxim, Maxim Cournoyer skribis: >> +(define kexec-load-file >> + (let* ((proc (syscall->procedure int "syscall" >> + (list long ;sysno >> + int ;kernel fd >> + int ;initrd fd >> + unsigned-long ;cmdline leng= th >> + '* ;cmdline >> + unsigned-long))) ;flags >> + ;; TODO: Don't do this. > > Why this TODO? "Don't do this" is not explicit enough; what would be > preferable to do here, but can't be done now for some reason? The TODO is actually copy/pasted for a few lines above, but I agree it=E2= =80=99s not very clear nor helpful. Presumably it=E2=80=99s here to mean that usin= g the =E2=80=98syscall=E2=80=99 function and having to record syscall numbers of = each architecture is not great. There=E2=80=99s no alternative though, at this = time. > Could we instead detect the error as returned by the syscall when it's > not implemented, and throw/report the error accordingly? I see that's > kind of done below (a misc-error is raised) -- I think we can remove > this special handling already and let the error be throw if it's not > implemented -- this removes the need to remember to come back here to > edit the list of supported systems the day they gain support. Yes. Plus I got the magic numbers wrong it seems (protip: it=E2=80=99s eas= ier to grep glibc than Linux to get them), so this gives us this change: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index f8c9937f54..960339e8bf 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -793,20 +793,24 @@ (define kexec-load-file unsigned-long ;cmdline length '* ;cmdline unsigned-long))) ;flags - ;; TODO: Don't do this. (syscall-id (match (utsname:machine (uname)) ("i686" 320) ("x86_64" 320) ("armv7l" 401) - ("aarch64" 401) - ;; XXX: There's apparently no support for ppc64le and - ;; riscv64. + ("aarch64" 294) + ("ppc64le" 382) + ("riscv64" 294) (_ #f)))) (lambda* (kernel-fd initrd-fd command-line #:optional (flags 0)) "Load for eventual use of kexec(8) the Linux kernel from @var{kernel-fd}, its initial RAM disk from @var{initrd-fd}, with the given @var{command-line} (a string). Optionally, @var{flags} can be a bitwise or of the KEXEC_FILE_* constants." + (unless syscall-id + (throw 'system-error "kexec-load-file" "~A" + (list (strerror ENOSYS)) + (list ENOSYS))) + (let*-values (((command-line) (string->utf-8/nul-terminated command-line)) ((ret err) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=--