unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Stefan <stefan-guix@vodafonemail.de>
Cc: 45716@debbugs.gnu.org
Subject: bug#45716: gnu: qemu: Fix ioclt(…,  SIOCGIFCONF, …) for emulated 64 bit architectures.
Date: Mon, 11 Jan 2021 14:28:21 +0100	[thread overview]
Message-ID: <87eeireh6y.fsf@gnu.org> (raw)
In-Reply-To: <4928FA00-C99D-4C66-877E-308D0B8F3228@vodafonemail.de> (Stefan's message of "Sat, 9 Jan 2021 19:01:39 +0100")

Hi Stefan,

Stefan <stefan-guix@vodafonemail.de> skribis:

> * gnu/packages/virtualization.scm (qemu): Add a snippet to fix a bug in the
> do_ioctl_ifconf() function of qemu to make ioclt(…, SIOCGIFCONF, …) work for
> emulated 64 bit architectures.
>
> The sizeof(struct ifreq) is 40 for 64 bit and 32 for 32 bit architectures.
> This structure contains a union of other structures, of which struct ifmap
> is the biggest for 64 bit architectures. Calling ioclt(…, SIOCGIFCONF, …)
> fills a struct sockaddr of that union, and do_ioctl_ifconf() only considered
> that struct sockaddr for the size of the union, which has the same size as
> struct ifmap on 32 bit architectures. So do_ioctl_ifconf() assumed a wrong
> size of 32 for struct ifreq instead of the correct size of 40 on 64 bit
> architectures.
>
> The fix makes do_ioctl_ifconf() handle struct ifmap as the biggest part of
> the union, treating struct ifreq with the correct size.
>
> This fixes (@ (guix build syscalls) network-interface-names) when used in
> emulated 64 bit architectures.

Woow, good catch!

> +              (modules '((guix build utils)))
> +              (snippet
> +               '(begin
> +                  (substitute* '("linux-user/syscall.c")
> +                    (("^([[:blank:]]*)const argtype ifreq_arg_type.*$" line indent)
> +                     (string-append line indent
> +                                    "const argtype ifreq_max_type[] = { MK_STRUCT(STRUCT_ifmap_ifreq) };\n"))
> +                    (("^([[:blank:]]*)target_ifreq_size[[:blank:]]=.*$" _ indent)
> +                     (string-append indent "target_ifreq_size = thunk_type_size(ifreq_max_type, 0);")))
> +                  #t))))

Could you move the explanation as a comment above the ‘substitute*’
form, and/or link to the upstream bug report/discussion/submission?

Thank you!

Ludo’.




  reply	other threads:[~2021-01-11 13:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 15:37 bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64 Stefan
2021-01-07 22:17 ` Stefan
2021-01-08  3:04   ` Danny Milosavljevic
2021-01-08 13:33     ` Stefan
2021-01-08 16:47     ` Stefan
2021-01-08 23:28       ` Stefan
2021-01-09 18:01         ` bug#45716: gnu: qemu: Fix ioclt(…, SIOCGIFCONF, …) for emulated 64 bit architectures Stefan
2021-01-11 13:28           ` Ludovic Courtès [this message]
2021-01-11 20:32             ` bug#45716: [PATCH 1/1] " Stefan
2021-01-14 13:39               ` Ludovic Courtès
2021-01-23 15:27                 ` bug#45716: Bug in ‘network-interface-names’ when building guix for aarch64 on x86_64 Stefan
2021-01-23 20:13                   ` Leo Famulari
2021-02-01 20:58                     ` Ludovic Courtès
2021-02-02  8:09                       ` Mathieu Othacehe
2021-02-06 12:59                         ` Stefan
2021-02-07 18:15                           ` Mathieu Othacehe
2021-02-08  7:44                             ` Stefan
2021-01-11 13:30     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeireh6y.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=45716@debbugs.gnu.org \
    --cc=stefan-guix@vodafonemail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).