Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2136801rdb; Mon, 20 Nov 2023 03:09:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqM8UOM1H7dxJ6aYdc0Ke8DQEDRhTv3l5JXydal+04l8sqD3rHOzQcRUhiUbaB0c3lY/VG X-Received: by 2002:a05:6a21:1508:b0:187:200a:713f with SMTP id nq8-20020a056a21150800b00187200a713fmr5253689pzb.23.1700478562487; Mon, 20 Nov 2023 03:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700478562; cv=none; d=google.com; s=arc-20160816; b=K2hwnF7M8hQ7wCxS46l4Adh1dYDZtF4j5H5vDE6GkfU4k5hJMX8jR7CiAqj06nU5cx 0LsORh0KEmDfiYuoLPlaUwKgAEbAw1xvU1/Jejhf3h9ZLuB157/Vq9zxLiVrdaM9zC22 1OvJc5hxSWdrqnh1LTeCtJIiIlreQXxk4C2dVCV4IeZ5ftkn2HslvZX1o/JjBVwZeoe3 Z3yHA8YJv52Qkygj+Ml4qDrCsmpDFjbYaHHRs6ZolmoFFSzYhM94WEzDTROQILQICfIH QcRj4ArJo3cM03bdTpPik7+WaEY6IrmpSfSva0WRiRVT/Z4k5E3fBh9A3HVT5IN/JrHP sBUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Vm1HwT5DR4IJofIUMyPRScfRp936nGn+krIYXRU3nt8=; fh=rmg8xeI9vw1PQ8jdXAzEDbJMea0z0TmkNkabsLOTSxQ=; b=gT/uWrrg+YU1bPsmC/7lLNHAKfexqgIGYM7e/3egMVDYaNROkPapSyKE/Jf07zjaaR fWEc4LEzCWE17hOSqftXyJ0m9Il4sLUP14k2u0ODhTfjXyXN9+zJ/opWYNlURiz4QxyH OEII08cCp7ZDUd5U8O3Iq6HInhUKL6FQh3joPb/QsIfgEqtokKB+8XvSUxaVKs3QBI3k l0JLI7Ea3sv6uaQSA6+EU+1EG5M0o653slC3XCtmeKhKPZ+TRaL7+Id9iId3MEJBOMoq zX4NCctczp89NGdVeCTqDys572iQVO5/AO+gMriko2T0e+muRJG+sI4ctxGKiUn1b+zi M4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=YRsk6Jkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f20-20020a056a00229400b006cba887e119si1438399pfe.145.2023.11.20.03.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:09:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=YRsk6Jkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1DF9280775BA; Mon, 20 Nov 2023 03:09:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233290AbjKTLJT (ORCPT + 99 others); Mon, 20 Nov 2023 06:09:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbjKTLI6 (ORCPT ); Mon, 20 Nov 2023 06:08:58 -0500 Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [178.154.239.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF0F110C8; Mon, 20 Nov 2023 03:08:07 -0800 (PST) Received: from mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:1094:0:640:693f:0]) by forward103c.mail.yandex.net (Yandex) with ESMTP id 5347160AF3; Mon, 20 Nov 2023 14:08:05 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 48KPEc2OmeA0-RYr1IvyC; Mon, 20 Nov 2023 14:08:04 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1700478484; bh=Vm1HwT5DR4IJofIUMyPRScfRp936nGn+krIYXRU3nt8=; h=Message-ID:Date:Cc:Subject:To:From; b=YRsk6JklS+6fFl1O4jC2rNNAsNaddU148WlG7k1YvTnhzMO9NuCla9IOcN81ZMNyA N9bJ+oKQGmHhGkjoKf8f7oWfAqOKrB/Fx92Io7iLp/XoMyZbB9onrYykDdbml/uJRt ZngDwnuYpRHnjRFv+Hab3jRJXEgbKxKG50Avst1I= Authentication-Results: mail-nwsmtp-smtp-production-main-46.myt.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Kees Cook Cc: Alexey Dobriyan , Will Deacon , Kalle Valo , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Antipov , kernel test robot Subject: [PATCH] uapi: propagate __struct_group() attributes to the container union Date: Mon, 20 Nov 2023 14:05:08 +0300 Message-ID: <20231120110607.98956-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 03:09:21 -0800 (PST) Recently the kernel test robot has reported an ARM-specific BUILD_BUG_ON() in an old and unmaintained wil6210 wireless driver. The problem comes from the structure packing rules of old ARM ABI ('-mabi=apcs-gnu'). For example, the following structure is packed to 18 bytes instead of 16: struct poorly_packed { unsigned int a; unsigned int b; unsigned short c; union { struct { unsigned short d; unsigned int e; } __attribute__((packed)); struct { unsigned short d; unsigned int e; } __attribute__((packed)) inner; }; } __attribute__((packed)); To fit it into 16 bytes, it's required to add packed attribute to the container union as well: struct poorly_packed { unsigned int a; unsigned int b; unsigned short c; union { struct { unsigned short d; unsigned int e; } __attribute__((packed)); struct { unsigned short d; unsigned int e; } __attribute__((packed)) inner; } __attribute__((packed)); } __attribute__((packed)); Thanks to Andrew Pinski of GCC team for sorting the things out at https://gcc.gnu.org/pipermail/gcc/2023-November/242888.html. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202311150821.cI4yciFE-lkp@intel.com Signed-off-by: Dmitry Antipov --- include/uapi/linux/stddef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h index 5c6c4269f7ef..2ec6f35cda32 100644 --- a/include/uapi/linux/stddef.h +++ b/include/uapi/linux/stddef.h @@ -27,7 +27,7 @@ union { \ struct { MEMBERS } ATTRS; \ struct TAG { MEMBERS } ATTRS NAME; \ - } + } ATTRS #ifdef __cplusplus /* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */ -- 2.42.0