From patchwork Wed Nov 25 22:31:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Murray X-Patchwork-Id: 105746 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.3162.1795645897666796168 for ; Wed, 25 Nov 2026 14:31:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=rhDatsYS; spf=pass (domain: konsulko.com, ip: 209.85.160.180, mailfrom: scott.murray@konsulko.com) Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-5365d26ccbdso70310681cf.0 for ; Wed, 25 Nov 2026 14:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1795645896; x=1796250696; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=jBX+8198t6UlX/G2it2doIZGleMFhtySIZuRM2vtKCU=; b=rhDatsYSsQCcSdSRodonr/wVHww7bup6wWrCYQNm0ns0E+pf7q0RA7BDBLqSqRCL9E NC+YvZHozzQR6uAq74TWAj5iDsJoZC/k92KL0RcomoHCrRu60s5LdBLcEU3ccdnpHvtx j8yrfeqBFIZUfQtzlIvuYZCe8q1gCfAqenZWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795645896; x=1796250696; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=jBX+8198t6UlX/G2it2doIZGleMFhtySIZuRM2vtKCU=; b=RB8ePB0J/Oqti1PWHB0OnFWXcImgR0y/MZswzi3CQ7c4VOQrTTA6qK3x0OnNP3AaBH 8QdcscYMDJdyrdzFXHc4HmHp/Z5kMn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U uPblrzZnhZN9PHUOWMhUy8kBAaKcOQDsarS9nHDy9FMduQlJKRnW/CrmnXSxtUxZ3Kw== X-Received: by 2002:a05:622a:5ce:b0:536:72b4:b84a with SMTP id d75a77b69052e-55d76a218afmr369697081cf.42.1795645896421; Wed, 25 Nov 2026 14:31:36 -0800 (PST) Return-Path: Received: from ghidorah.spiteful.org (107-179-213-3.cpe.teksavvy.com. [107.179.213.3]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d78451407sm167717091cf.2.2026.11.25.14.31.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 14:31:36 -0800 (PST) From: Scott Murray To: yocto-patches@lists.yoctoproject.org Subject: [meta-lts-mixins][scarthgap/rust][PATCH 17/19] rust-common: Use 64-bit time_t libc layouts for riscv32 musl Date: Wed, 25 Nov 2026 17:31:08 -0500 Message-ID: <78d28e65bc74da2b9ad9797fb32c60250fc6fbde.1795645656.git.scott.murray@konsulko.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 25 Nov 2026 22:31:38 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5536 From: Khem Raj musl on riscv32 only has a 64-bit time_t. The libc crate before 0.2.190 still uses 32-bit time_t struct layouts for riscv32 musl unless asked otherwise, so e.g. std's stat() passes a struct stat that is about 24 bytes smaller than the 128 bytes musl writes. This corrupts the stack, and any Rust program calling std::thread::available_parallelism() or std::fs::metadata() crashes: qemu: uncaught target signal 11 (Segmentation fault) - core dumped This affects std, which uses the vendored libc 0.2.189 in Rust 1.99.0. Upstream fixed it in libc 0.2.190 by always using the musl 1.2 layouts on riscv32 [1]. Until then, opt into them for riscv32 musl targets with the libc_unstable_musl_v1_2_3 cfg, which libc 0.2.189 reads. Earlier versions are not opted in: 0.2.174 to 0.2.188 read the RUST_LIBC_UNSTABLE_MUSL_V1_2_3 environment variable instead, but their riscv32 time64 layouts lack the timespec padding (up to 0.2.182) or fail to build with duplicate __pad1/__pad2 fields (0.2.183 to 0.2.188), and older versions have no musl time64 support. [1] https://github.com/rust-lang/libc/pull/5508 Signed-off-by: Khem Raj Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie (adapted from oe-core commit e4a1edaade3fdf413074e2006bc33097a450f827) Signed-off-by: Scott Murray --- classes-recipe/rust-common.bbclass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes-recipe/rust-common.bbclass b/classes-recipe/rust-common.bbclass index a1d7dd2..efedbec 100644 --- a/classes-recipe/rust-common.bbclass +++ b/classes-recipe/rust-common.bbclass @@ -18,6 +18,9 @@ RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=${TARGET_DBGSRC_DIR} \ --remap-path-prefix=${TMPDIR}/work-shared=${TARGET_DBGSRC_DIR} \ " RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}" + +# Delete it when every crate moves to use libc > 0.2.190 crate +RUSTFLAGS:append:riscv32:libc-musl = " --cfg libc_unstable_musl_v1_2_3" RUSTLIB_DEP ??= "libstd-rs" RUST_PANIC_STRATEGY ??= "unwind"