Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp916325rdg; Fri, 13 Oct 2023 05:18:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+unNzMGuRvEOR4MqvhSqjSZk1KK2jk+LT4mQJK6zF3M0cvNt8OEmWbTW4w1AF/IyQZpp5 X-Received: by 2002:a17:902:bb84:b0:1c7:4334:6540 with SMTP id m4-20020a170902bb8400b001c743346540mr20494458pls.63.1697199500563; Fri, 13 Oct 2023 05:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697199500; cv=none; d=google.com; s=arc-20160816; b=UmDe+KGAswI/Kf0jLLF3UgQ5bScH6kvoeOTlfM0u4D8SrXL9Rz7KqzOaFSREn7VHBn wZjrXyDsDzsxlJliYzSoQYq80/moz/6E1e4nVT6GTbK4qIsLWvkqOEr8n4AGBqiKEuFY ILOSqSv3PPF5DWC4SKmyr5t1l1EP+dwdROVgh6e/2KFG86xbMEaDEGmkPwU/6e4D/LQ/ jd7FxqL/ZEPjm7RCv473OsvYa5Dod3tqfctnBFen7g2yp3fvI9ml7+wLfuU3DePmHaPe OssCNF1cVXdogfRcnJwNng33EtWMvMZzvzSrd3Ie/Xsa39C9wBqJ4/ouxYiLV5xwoe0v WioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kfMcaSPK1nNALi0ZL2/STHAwFBjikJyI73GljAs8CFY=; fh=BbfZJdhx3oDLFYmNrL06hj7PtlVGb9VaZLBEuktCRN4=; b=sHjM1e6QSPV5PJhPvmmOpux2HuqKrYZMAI8Nfzsdwwe0HxuaSRDsAV3IG9I/iNxk76 rjfOdGHn2im6xipdc7ZBtgxUjy2ppD2DOsZSu6DVG8yIGpS9YJRP5i15mjDDMjcKCEi5 EJuDxNY9cMO6EM6dsiN7/URvMO0qY9SDcDAfLUtkSXjRodD35DOZhajlfhWKswv/SlUP dmJRbm8fBZKngGTpygm7+Cq4xGTOoG+EU6QJBZtv9/SBedIf7c/qdMoAQ40oIvkEIZb0 MItAjnYb4ZcUpNQy0Ej59om42cXuye0VBZjvlv5iJNLQIbjhXXDXjQeSYyxGY1wm3yHO UgWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fN+CMP8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e7-20020a17090301c700b001c3411c9b83si672590plh.454.2023.10.13.05.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 05:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fN+CMP8c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 621FF834AFD1; Fri, 13 Oct 2023 05:18:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231409AbjJMMSI (ORCPT + 99 others); Fri, 13 Oct 2023 08:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbjJMMSG (ORCPT ); Fri, 13 Oct 2023 08:18:06 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A41BF for ; Fri, 13 Oct 2023 05:18:04 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9bdf5829000so20247266b.0 for ; Fri, 13 Oct 2023 05:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697199483; x=1697804283; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kfMcaSPK1nNALi0ZL2/STHAwFBjikJyI73GljAs8CFY=; b=fN+CMP8czqx+zKvehOpSezbKnn4yGuWRS59DGkEVqSyFoz54Ky9XBIOIEPcp4BIzCm 1f3e2MenjsQ/U9J3UwBGHV7ykr055TonK5NvMg81vNxUvgzs1EjkllLqMcT0pt6Gfp05 UN3FwUZLPzVCZM8a/ANAUDnIS4BQTjPPyx0/OYWMTvNXrhIkDo7REemt2mCRXCT2pRqp BXiFsBUEMlRCUoTBj0J7U4ZbLKQ95PrcP97yq8Ayf9H9/KWCbNG1POiFDoivyLgKlT93 j0mcTHDZ8yzHnH10kPWpuApqq+OuxtmXpCNvIe9V/ghixUb4yS+f+VrG5OSFboE5ACa8 +60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697199483; x=1697804283; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kfMcaSPK1nNALi0ZL2/STHAwFBjikJyI73GljAs8CFY=; b=WaX6zbyvryoruPo1641jjGF2T4M7cuzc1UaV/SyrT4nl/WlxVuirfLvXxQq9TfEoGH G+3J8Ut2bYAMe8gQz9AaZhbxu7zf0R+8ahtdjV/9vf6Lv6Hi9e1BCXvKzIuDN7hejCCW Gh7P/Fq1t99Lfo4lirrPxp9e373JDuBLVCqFpbUbFMN0FvEtRUjPmvE9Y2jj6kKmklAq SbVLydNbdIRDRqrulsos2c8eh9urmj7E+UqT/Ue8EdovuvUeqVhSgRccj5T0NFR8Yj+w MMSROJ10kzx4jDt+RKDAi53G7F+e42RFkAbSTaAeO2rrZiDUiOFaUMIu4VcWz1tCQuxJ +isA== X-Gm-Message-State: AOJu0YzLp8XaLkFX3YlqGC1+xg6naAE//5VsxwpuAZEgh0vGBySOCQE5 C5NtHpO2O0EW6Ih39PmyoVdTleqO+Ka+qLYCmHgSCQ== X-Received: by 2002:a17:906:fe07:b0:9bd:e036:387d with SMTP id wy7-20020a170906fe0700b009bde036387dmr587057ejb.21.1697199483200; Fri, 13 Oct 2023 05:18:03 -0700 (PDT) MIME-Version: 1.0 References: <20220927131518.30000-1-ojeda@kernel.org> <20220927131518.30000-26-ojeda@kernel.org> <20231012104741.GN6307@noisy.programming.kicks-ass.net> <202310121130.256F581823@keescook> <20231013075005.GB12118@noisy.programming.kicks-ass.net> In-Reply-To: <20231013075005.GB12118@noisy.programming.kicks-ass.net> From: Ramon de C Valle Date: Fri, 13 Oct 2023 05:17:50 -0700 Message-ID: Subject: Re: [PATCH v10 25/27] x86: enable initial Rust support To: Peter Zijlstra Cc: Kees Cook , Sami Tolvanen , Miguel Ojeda , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Alex Gaynor , Wedson Almeida Filho , David Gow , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 13 Oct 2023 05:18:18 -0700 (PDT) On Fri, Oct 13, 2023 at 12:50=E2=80=AFAM Peter Zijlstra wrote: > > On Thu, Oct 12, 2023 at 03:15:12PM -0700, Ramon de C Valle wrote: > > > [1]: > > https://doc.rust-lang.org/nightly/unstable-book/language-features/cfi-e= ncoding.html > > I'm sorry, but that looks like a comment from where I'm sitting :-( > Worst part is it being on a line of it's own and thus unrelated to > anything. > > This rust syntax is horrific.. I understand where you're coming from. I'm still getting used to Rust synta= x. > > > > [2]: > > https://doc.rust-lang.org/book/ch19-04-advanced-types.html#using-the-ne= wtype-pattern-for-type-safety-and-abstraction > > I don't speak enough rust to even begin following this :/ > > > [3]: Wrapping a type in a struct should achieve something similar even > > without using the cfi_encoding attribute since the encoding for structs= in > > both are , where is . > > You're not talking about C, right? Both C and repr(C) Rust structs have this encoding, but I understand the problems with doing this in C since it doesn't have repr(transparent) structs so there would be a lot of casting back and forth. Maybe there is an alternative or this could be done for less used function pairs?