Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6105360pxv; Thu, 29 Jul 2021 06:39:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNvvGy7KuDfMH6Nu0X0imRyrvN704Oy1LCZV5l6n+63J8bGkXUbPtyRXTpf7pfDZnQDwqN X-Received: by 2002:a05:6e02:1c88:: with SMTP id w8mr3783931ill.154.1627565984226; Thu, 29 Jul 2021 06:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627565984; cv=none; d=google.com; s=arc-20160816; b=06wjUxicZee3L8r7rneTdUYYgSbCPhyMYqTJiFz+wSbukehddmgO8+q5CR8MZX/oTN AB+RMjiet2febtV8YEizwN7AJOukB0bX6u1QOoNfkyKabS4Ylr6J+ggGLNtL/UzGy+0u CGyDslxNPCzLYdbyvqynaUUjV+5l+iwr9aWvXCr7JAukL/3u+kER4bmmNJl4kiwI8GkZ FdqsI3fr2q1u+Sfzh6nQ5+vlEP+QqifhBDsvZogiLdBXt0Pkrmzow/y2crUrJEp337Ry aanRinSYLlTwd1kz3DB8p0OrWaRHHwHSgDidgxYAK/tDypruApjkoIA2fkYAVLcahXLq Bbqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=W8x69J6Q09I5gZNXo9ZYxmS76YuV1xVnU5m8ij7pP8E=; b=LeLGjpKgkLWTRIo3iKHvV7f7W6lfloT19VDORlgu27iQjCwMv5UTtft2PpsjZfrLQ8 anJ1ryLI/SBPF8gEMb1BhDTIZC9OeI9d0b4606R9GkZ0+2d0Aa0tGCqqUyH7NJkIh1dS G8SGlIabph+onlhv8uTgjfYG2fdUE22TLtGp8HjXccDTPF954/qZngnWmWvmQJ15le5w hWzch0QzPc+uDFQQO4qQdkfxCg/pI6ZelP66rcYv+sF3Ge4QK3A+HI/HxGvpD5Xgj96L b1vlX2xvC8tDnUjXX64IFcXbo47aMDm8zB4SXfCCRrDuOTp62ZjIus5Jr+5GTQhSFI4x B6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b="DA/R4+iv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si3520827iot.18.2021.07.29.06.39.31; Thu, 29 Jul 2021 06:39:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b="DA/R4+iv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237620AbhG2Nh6 (ORCPT + 99 others); Thu, 29 Jul 2021 09:37:58 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:12225 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237427AbhG2Nh5 (ORCPT ); Thu, 29 Jul 2021 09:37:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1627565875; x=1659101875; h=from:to:cc:subject:date:message-id:mime-version; bh=W8x69J6Q09I5gZNXo9ZYxmS76YuV1xVnU5m8ij7pP8E=; b=DA/R4+ivRRUBpi/GbJS/qOXt6GM09Av6NvTj4S/kPy5Nze2cGHSXEP4o Gjer0bUCKLkolr2viJNkUadg8HStssynuBy7rudQl+D33q5IVNLlanZiK wA7NroVoOxAvTBBudtoJaUhAs2MwxVK8+TmKuqAXnXEQJNUVkVe/7zdIp g=; X-IronPort-AV: E=Sophos;i="5.84,278,1620691200"; d="scan'208";a="128788947" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-67b371d8.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 29 Jul 2021 13:37:45 +0000 Received: from EX13D28EUC003.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-67b371d8.us-east-1.amazon.com (Postfix) with ESMTPS id DAB04A0379; Thu, 29 Jul 2021 13:37:43 +0000 (UTC) Received: from uc8bbc9586ea454.ant.amazon.com (10.43.161.175) by EX13D28EUC003.ant.amazon.com (10.43.164.43) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 29 Jul 2021 13:37:38 +0000 From: Siddharth Chandrasekaran To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Arnd Bergmann CC: Siddharth Chandrasekaran , Liran Alon , Ioannis Aslanidis , , , , Siddharth Chandrasekaran Subject: [PATCH] asm-generic/hyperv: Fix struct hv_message_header ordering Date: Thu, 29 Jul 2021 15:37:02 +0200 Message-ID: <20210729133702.11383-1-sidcha@amazon.de> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.175] X-ClientProxiedBy: EX13D15UWA003.ant.amazon.com (10.43.160.182) To EX13D28EUC003.ant.amazon.com (10.43.164.43) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to Hyper-V TLFS Version 6.0b, struct hv_message_header members should be defined in the order: message_type, reserved, message_flags, payload_size but we have it defined in the order: message_type, payload_size, message_flags, reserved that is, the payload_size and reserved members swapped. Due to this mix up, we were inadvertently causing two issues: - The payload_size field has invalid data; it didn't cause an issue so far because we are delivering only timer messages which has fixed size payloads the guest probably did a sizeof(payload) instead relying on the value of payload_size member. - The message_flags was always delivered as 0 to the guest; fortunately, according to section 13.3.1 message_flags is also treated as a reserved field. Although this is not causing an issue now, it might in future (we are adding more message types in our VSM implementation) so fix it to reflect the specification. Signed-off-by: Siddharth Chandrasekaran --- include/asm-generic/hyperv-tlfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h index 56348a541c50..a5540e9b171f 100644 --- a/include/asm-generic/hyperv-tlfs.h +++ b/include/asm-generic/hyperv-tlfs.h @@ -284,9 +284,9 @@ union hv_port_id { /* Define synthetic interrupt controller message header. */ struct hv_message_header { __u32 message_type; - __u8 payload_size; - union hv_message_flags message_flags; __u8 reserved[2]; + union hv_message_flags message_flags; + __u8 payload_size; union { __u64 sender; union hv_port_id port; -- 2.17.1 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879