qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: "Guido Günther" <agx@sigxcpu.org>,
	"Riku Voipio" <riku.voipio@iki.fi>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v6 4/8] linux-user/syscall: Introduce target_sockaddr_nl
Date: Wed, 11 Sep 2019 21:34:21 +0200	[thread overview]
Message-ID: <CAAdtpL4ykZAinOZWWUc6jU90DvEijEjaGrAJaRJ_3-bx3tn_zA@mail.gmail.com> (raw)
In-Reply-To: <046c1718-f938-b16f-5100-36406281f040@vivier.eu>

On Mon, Sep 9, 2019 at 4:23 PM Laurent Vivier <laurent@vivier.eu> wrote:
> Le 08/09/2019 à 08:15, Philippe Mathieu-Daudé a écrit :
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > Tested-By: Guido Günther <agx@sigxcpu.org>
> > ---
> >  linux-user/syscall.c      | 6 ++++--
> >  linux-user/syscall_defs.h | 7 +++++++
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> > index 8b41a03901..5128312db5 100644
> > --- a/linux-user/syscall.c
> > +++ b/linux-user/syscall.c
> > @@ -1494,8 +1494,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr,
> >          sizeof(target_saddr->sa_family)) {
> >          target_saddr->sa_family = tswap16(addr->sa_family);
> >      }
> > -    if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) {
> > -        struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr;
> > +    if (addr->sa_family == AF_NETLINK &&
> > +        len >= sizeof(struct target_sockaddr_nl)) {
> > +        struct target_sockaddr_nl *target_nl =
> > +               (struct target_sockaddr_nl *)target_saddr;
> >          target_nl->nl_pid = tswap32(target_nl->nl_pid);
> >          target_nl->nl_groups = tswap32(target_nl->nl_groups);
> >      } else if (addr->sa_family == AF_PACKET) {
> > diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> > index 0662270300..fcedd0d0fb 100644
> > --- a/linux-user/syscall_defs.h
> > +++ b/linux-user/syscall_defs.h
> > @@ -153,6 +153,13 @@ struct target_sockaddr_un {
> >      uint8_t sun_path[108];
> >  };
> >
> > +struct target_sockaddr_nl {
> > +    uint16_t nl_family;     /* AF_NETLINK */
> > +    uint16_t __pad;
> > +    uint32_t nl_pid;
> > +    uint32_t nl_groups;
> > +};
>
> You should use abi_ushort and abi_uint to keep alignments good (for
> instance m68k aligns on 16bit whereas others on 32bit).

Are you sure? The other target_sockaddr don't use that...
Is this because netlink is a host-only structure? (while other are
serialized over some interface).

Thanks,

Phil.


  reply	other threads:[~2019-09-11 19:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08  6:15 [Qemu-devel] [PATCH v6 0/8] linux-user: strace improvements Philippe Mathieu-Daudé
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 1/8] linux-user/strace: Display invalid pointer in print_timeval() Philippe Mathieu-Daudé
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 2/8] linux-user/strace: Add print_timezone() Philippe Mathieu-Daudé
2019-09-10  8:51   ` Laurent Vivier
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 3/8] linux-user/strace: Improve settimeofday() Philippe Mathieu-Daudé
2019-09-10  8:30   ` Laurent Vivier
2019-09-10  8:52     ` Laurent Vivier
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 4/8] linux-user/syscall: Introduce target_sockaddr_nl Philippe Mathieu-Daudé
2019-09-09 14:22   ` Laurent Vivier
2019-09-11 19:34     ` Philippe Mathieu-Daudé [this message]
2019-09-12 17:05       ` Laurent Vivier
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 5/8] linux-user/strace: Dump AF_NETLINK sockaddr content Philippe Mathieu-Daudé
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 6/8] linux-user/strace: Add print_sockfd() Philippe Mathieu-Daudé
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 7/8] linux-user/strace: Improve bind() output Philippe Mathieu-Daudé
2019-09-08  6:15 ` [Qemu-devel] [PATCH v6 8/8] linux-user/strace: Let print_sockaddr() have a 'last' argument Philippe Mathieu-Daudé
2019-09-08  6:28 ` [Qemu-devel] [PATCH v6 0/8] linux-user: strace improvements no-reply

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

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

  git send-email \
    --in-reply-to=CAAdtpL4ykZAinOZWWUc6jU90DvEijEjaGrAJaRJ_3-bx3tn_zA@mail.gmail.com \
    --to=f4bug@amsat.org \
    --cc=agx@sigxcpu.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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.
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 NNTP newsgroup(s).