Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3708588rwl; Tue, 27 Dec 2022 13:46:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsePlfy/d6iWI/jrdczejybuAR8ECFsFwrGhN185DvYyPW7/yt4bdLkqAVNo3I9Rb0MLazq X-Received: by 2002:a17:907:7ba6:b0:7c0:cfb2:40bc with SMTP id ne38-20020a1709077ba600b007c0cfb240bcmr24169347ejc.15.1672177618643; Tue, 27 Dec 2022 13:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672177618; cv=none; d=google.com; s=arc-20160816; b=bTzTAokEuJZXTCfinGh1jjWDkN0dU3tPOTlCN6RJ3seJDlw71IQiiX35NOWMCGFvr3 l6vUN1qniE06G+aV9BYrU/bkMe/6Cb1yll4qCUUYpdMNn9c3POu+fhHH9DcriMhTtkpN 9QeA7E6UOCgHxOiIP9cttXMNr9TqXJfnpeqwh/1rOv7HwTZ92iIkW5zc5BqwG4KBCI5A JppQ46WLG808NV/U2Amia77AyOd/ShksAyRJVVc99EJ4xiepQzw1C3uWOukLnftD2di3 9nb6Jtm3BpWOkWxvs1B1jMjX8Pb7yPg7HI4ioohJTu0Wbhe9cdLPV4N2FrwUkhvDtgGV KDow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PKizlkbenA5JgN5QTgafvGE7l5kd436bqvEmQmYM1p4=; b=jwq0Rl8rx1021GdcNZ/tIXqrWfv2367SpLmzVdQhrGBQ6XzvBfGq4mDRC030Sy3Xg7 38M+A19/9gkJ16fN2KzyCsZI6Lmmqstp63gMNqkvgmr5gLkgT7OJraoMRrea970RViqa /jF1gwnHygYMVQgwB7fNOKESibdad0YDI+oICVBiTojJ8WZEludKUAbVlGxbgS6MBiTv RiOJkZU44iwmnjfgjVPIKEOgXO6RdRAMMBlPM3rukpyTa/hHBeBreVtO88xCJAL5j53h Qna4WnxYYLQ1M1b3xc1NHsu068lTE2+pTyTqDmmAqcDHwGPe2HkWkDJLn/An3G61ODIU KUkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=SRe70gX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xd12-20020a170907078c00b0080a15fe49e8si11960352ejb.10.2022.12.27.13.46.42; Tue, 27 Dec 2022 13:46:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=SRe70gX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbiL0VOu (ORCPT + 67 others); Tue, 27 Dec 2022 16:14:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbiL0VOc (ORCPT ); Tue, 27 Dec 2022 16:14:32 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 119C6E3; Tue, 27 Dec 2022 13:14:31 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4D7A91EC0513; Tue, 27 Dec 2022 22:14:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1672175669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PKizlkbenA5JgN5QTgafvGE7l5kd436bqvEmQmYM1p4=; b=SRe70gX4tpSK0sk2zHwRnqiu4/ROwwU3/GEkPv160wW1tjH5dBjmai7+DuNKw5i8c9vpMG xAIpdsMRHPo3DYtyYdIqi8Uaf+yp1QkIvCylX3LrUyn503sV+oE1ibcYf8K9fl8UEIZqR9 1Tf9qNC4YvtnUcZoLU9bh8cEU9MKtPU= Date: Tue, 27 Dec 2022 22:14:24 +0100 From: Borislav Petkov To: Alexander Altman Cc: kernel test robot , llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, rust-for-linux@vger.kernel.org, lkml Subject: Re: [bp:tip-x86-alternatives 1/1] error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type Message-ID: References: <202212272003.rgQDX8DQ-lkp@intel.com> <76353487-736A-4470-AD31-77F47F8C08F6@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <76353487-736A-4470-AD31-77F47F8C08F6@me.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 On Tue, Dec 27, 2022 at 12:31:17PM -0800, Alexander Altman wrote: > That caused Rust’s bindgen (bindings generator) to generate a type for the > altered field that indirectly included a representation of the > bitfields...which have a greater-than-natural alignment because of their > encoding (they’re represented as an array of 4 8-bit unsigned integers, but > aligned as if they’re a single 16-bit unsigned integer). This interacts > badly with the top-level command to make the alt_instr struct packed, which > bindgen faithfully translates from C __packed to Rust #[repr(packed)]. This sounds like a rust problem to me. Because, AFAICT, this is perfectly valid C and both compilers haven't complained even with all the possible warnings turned on. > One way to resolve this temporarily would be to add the following line above > the offending struct: > ///
Nah, I don't think I'll accept a fix for the shortcomings of yet another tool. > This will cause bindgen to ignore the struct entirely and not translate it. If it’s > actually needed for Rust code, now or later, then we can’t do that and need > to actually replace it with something translatable, or else leave it hidden and > manually create its translation on the Rust side. For the latter, just using a > u32 for the entire bitfield-containing union would be sufficient. Yap, that sounds like the right thing to do. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette