Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4606785imu; Fri, 30 Nov 2018 22:23:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7S9Z27xAfFvjr2MKvi4tRMmfMVt/hCmB6AQZ3iTz6cFNlS0eik9rTSNUD5CkPsOhna2xh X-Received: by 2002:a17:902:346:: with SMTP id 64mr8557478pld.337.1543645384976; Fri, 30 Nov 2018 22:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543645384; cv=none; d=google.com; s=arc-20160816; b=qZ1RAoT9+1G4hYXGeboxAsyxuOqrvansP6nZ4Hq4RPwWVVngd9+yzn4s2+o1QqXJdM rGNPdIKcvtBbPvQF4pIRxuS2DYjqDjEBHkSG51MamMruEq0E49YOz2OtQNrmBNHSSaiQ QBpPjMPSh9jbQZY9Je2GV9tl/ijfcgXthLj7IHHW7yuxdm2O0k39RTjcm8UUvNFYIlWl BX5dhlfaqaMh2OkG2NVzibAjHSfzCBa+lXE7NFsWlpk/3YneAMIvwMIZE9MBN7MLuu4A D/VIf40snl1GjFyvC+oNTvVOpWujZ8QVY677O4E89w9KOrxTGLq1e1FzMFdB3t5o/RVa mVfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=X+/Miiw+HZl3PBTPXOya5567q84kd2r2b989Ug38Kz8=; b=jTtUPPfpU8wQBbJs6qCyBqvCm12sk3uf5Y/8FtXg04l35GawULwQ236HME7eFJ4qUv G6pWspSjZFQRCPvKwmOiF82uCYhm4sMLR7VJefydXF6lqFK1sJ2xJLzygzdwqPDbMqdX g5D3nvx/Ka9JqYaoHG6xCp1Ca3KdDk+bsKQqO2pS48vaYuzJ3DBxVF1wux6z+r1V+yLO R7SIe9gb73kmfYwdUbCK/GuOvPSLo7RulyXvLPC9YTCGH/Lyx98QTAt+fN7dPllngOKt J0IcP6x32CU7IUqBoaJ0+jMlXTvT3qCHN2hbDjv+00kGTjCz6AcWU0d6IEKs/+/qg0/B OXGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rKkiWZY8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si8680602pli.284.2018.11.30.22.22.37; Fri, 30 Nov 2018 22:23:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rKkiWZY8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbeLARd0 (ORCPT + 99 others); Sat, 1 Dec 2018 12:33:26 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46811 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbeLARd0 (ORCPT ); Sat, 1 Dec 2018 12:33:26 -0500 Received: by mail-pf1-f194.google.com with SMTP id c73so3849684pfe.13; Fri, 30 Nov 2018 22:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=X+/Miiw+HZl3PBTPXOya5567q84kd2r2b989Ug38Kz8=; b=rKkiWZY8+50CZcKmo5s9sEyj0fjxJ4VT6zKbmwdqzyTCKtjqy450TIBUxFW+4SLrrA 6pRE/MW06GpJ0wPC5HosRhg19YKSmgE0wMurOuWHWCDwn7ZEOCq7YkOTlkR9HG2RHCwL WKIZvpsJNMMjkvU7U5hMX5rFE6J7ZndindIIRA4lVHNkoMRxKVV0TKTACk+wrCwm/8Po 7X5azknQ8X65LPWqbqd6kCmayhhXEpVKIPSuIuL1vF2ffXTIQ+DirIaJwT4b1h6mCcSe qcllVGQTpdeCniuN7XwJGzWBSMi6ShiJl96X4Uc7rjbMaSepBWqu4y5OAU3Rb/UC/e8K erOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=X+/Miiw+HZl3PBTPXOya5567q84kd2r2b989Ug38Kz8=; b=ZV6CwBjmNTOwKYDrzP7gZQR8CJktCoinp+MIzl7uk/yIxXHQxU1WJMKCJai54hpmiS caxjjT/KxATZDpswKT9LvlX/JIoov9GkXc9SQ4IARUEfsbfEzVOITYfuOQGMuORd1+9q xddgq7FtY3O22S7g7Y7W5EKtK0U4pOyuvig8iyCfBWG9kKZhklAUZGbUWyZJpk201eeA 96MPfV5WcSW3tOec6HW+I9kPWPcr5VTAv0msmosQPDDKBrpOSaNj1FgyYZnbkASi3W2N M4FzIM7aYnD/9pFsZ+6+iw0cKl8iG1/Unutoqyhh4JOAEGV/ka/1aJckafIjSwpli9JL +MOA== X-Gm-Message-State: AA+aEWZvw7qHwaBDSlLNMciZXMcTCknxp0I/KorbCvc1jKAT+vgq3CjP q0UlVFKwR9E9eeu+iY9AvQ0= X-Received: by 2002:a63:2586:: with SMTP id l128mr7257069pgl.104.1543645298909; Fri, 30 Nov 2018 22:21:38 -0800 (PST) Received: from ?IPv6:2601:647:4580:b719:7176:5f0b:7fa8:674c? ([2601:647:4580:b719:7176:5f0b:7fa8:674c]) by smtp.gmail.com with ESMTPSA id e123sm8487254pgc.58.2018.11.30.22.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 22:21:37 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Subject: Re: [PATCH v2] x86/hyper-v: Mark TLFS structures packed From: Nadav Amit In-Reply-To: <20181130125422.21494-1-vkuznets@redhat.com> Date: Fri, 30 Nov 2018 22:21:35 -0800 Cc: kvm list , Paolo Bonzini , =?utf-8?B?UmFkaW0gS3LEjW3DocWZ?= , LKML , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , x86@kernel.org, "Michael Kelley (EOSG)" , Thomas Gleixner Content-Transfer-Encoding: 7bit Message-Id: References: <20181130125422.21494-1-vkuznets@redhat.com> To: Vitaly Kuznetsov X-Mailer: Apple Mail (2.3445.101.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Nov 30, 2018, at 4:54 AM, Vitaly Kuznetsov wrote: > > The TLFS structures are used for hypervisor-guest communication and must > exactly meet the specification. > > Compilers can add alignment padding to structures or reorder struct members > for randomization and optimization, which would break the hypervisor ABI. > > Mark the structures as packed to prevent this. Seems good to me (I made sure you remembered to set __packed for the nested structs ;-) ) If needed: Acked-by: Nadav Amit Having said that, something else is sort of strange in the TLFS definitions, I think (I really know little about this whole protocol). Look at the following definitions from hyperv-tlfs.h: > struct hv_vpset { > u64 format; > u64 valid_bank_mask; > u64 bank_contents[]; > }; > > struct hv_tlb_flush_ex { > u64 address_space; > u64 flags; > struct hv_vpset hv_vp_set; > u64 gva_list[]; > }; It seems you have two flexible array members at the end of hv_tlb_flush_ex. This causes bank_contents[x] and gva_list[x] to overlap. So unless they have the same meaning, this asks for trouble IMHO.