From patchwork Mon Oct 21 11:48:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11202061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60B641390 for ; Mon, 21 Oct 2019 11:54:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 36387206C2 for ; Mon, 21 Oct 2019 11:54:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hw5E9q12" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36387206C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:39024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWG8-0002Sy-3V for patchwork-qemu-devel@patchwork.kernel.org; Mon, 21 Oct 2019 07:54:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52787) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMWBb-0005VS-KZ for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMWBX-0003B1-EE for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:19 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMWBR-00038j-Po for qemu-devel@nongnu.org; Mon, 21 Oct 2019 07:49:14 -0400 Received: by mail-wr1-x442.google.com with SMTP id v9so2350152wrq.5 for ; Mon, 21 Oct 2019 04:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L1ZRC5xfl7LAc8y7XcDjWKXdgHuMKTnYncwldrjeKoE=; b=Hw5E9q123R3Tvz1vaTdDmL8+/eQKpTsEt3Qgu1/klh48i+Z9puQ/jxBxlIBNIJiJAD XLSla8eh1r0PXmCUAlSDKSB3Q649GBdIXDqIl5V7M38uGtS0Jx+dHMXIdZ7ncLHqiqvq vaze0JZa9fANNtde143lXJ6Q466W87v1gwbL66k3R0gwaXdSRDjVj8+s0XS69PsnhixP H25q1qxm7MJ91L6OvN+BxG6cRDW+v9KbHR72tKnyW8wYTi/hIcMeJ2eo45ZyC+WYByyv ckqhtNyKw9fqVBx07N8LaqBvq+zrTNUVAORn+vFyKHYuZshJgLuccqAZWqcBeDjk/Vyb Dc0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=L1ZRC5xfl7LAc8y7XcDjWKXdgHuMKTnYncwldrjeKoE=; b=Xb54AYDarHtRqRvftP6qrTBBm1T+Zq+Tw89BXfwY9WJGEdiS3P5isCj0kYyWH4guGg cx4zslK2VMgPSWG9NexOOOiPT0ZN8Ellagkz+7dwVQzjYicsFSUshJsM0CqQ0ClIx6ND g53UoZlT+/YJ63Qkmci+VbhWvxLBCnhPdLvJqoRsn2c3i8U1dPgtEBtgOo+ipXfEN/Ca B4XhCKLC+SDcGYmOSDvxqd01HoI/EyCtVQX50ksrJ3x4mDDxi0QZK6A7k1dqgAYG/Fwa acj0YBiX3OpSnngKnR1jGR2ASFUUYoa7dLnn4LmgwQhuX+96RRVj0k5jiABIG5KudZQz sHfw== X-Gm-Message-State: APjAAAVUVAD8/SDbc5GcHtBjUfUkUlSwnOLozrLvzjAcnM4HKlg2RtSI ahSvpsdrUDF6kbUk3lacSrqnwPDR X-Google-Smtp-Source: APXvYqyhC2xqhen9lmC1sFAEfA0NBjNDe8SFmARNqljeJrKlGw0ydnjwfWaWvLqNIpG74ouKi+C2zA== X-Received: by 2002:adf:91e1:: with SMTP id 88mr7747800wri.16.1571658546821; Mon, 21 Oct 2019 04:49:06 -0700 (PDT) Received: from localhost.localdomain (129.red-83-57-174.dynamicip.rima-tde.net. [83.57.174.129]) by smtp.gmail.com with ESMTPSA id x5sm17156137wrt.75.2019.10.21.04.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 04:49:06 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v8 4/9] linux-user/syscall: Introduce target_sockaddr_nl Date: Mon, 21 Oct 2019 13:48:52 +0200 Message-Id: <20191021114857.20538-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191021114857.20538-1-f4bug@amsat.org> References: <20191021114857.20538-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Guido_G=C3=BCnther?= , Riku Voipio , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Tested-By: Guido Günther Reviewed-by: Laurent Vivier Signed-off-by: Philippe Mathieu-Daudé --- v7: use abi_ushort and abi_uint to keep alignments good (lvivier) --- 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 e2af3c1494..f1ab81b917 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1496,8 +1496,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 fa69c6ab8d..7694d72446 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 { + abi_ushort nl_family; /* AF_NETLINK */ + abi_ushort __pad; + abi_uint nl_pid; + abi_uint nl_groups; +}; + struct target_in_addr { uint32_t s_addr; /* big endian */ };