From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 462FB406286 for ; Tue, 5 May 2026 12:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777982533; cv=none; b=JN7lhsymebyMHnATMeW3fv7JP4Upmo0/vFv7ZQrduvV2GXaYI5IgJmbFofVSGrSVcd7kSxxi9B5fjj/4Lb4QO4PRIWYf9zuHc1Gw4YafG/b+4LRGiiNEf6oUmiZ0reDuorcH6b7VQKBNDTsmC2Gp3a9F8s6m9MTcSYEEguS0OaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777982533; c=relaxed/simple; bh=LsAUKqaB+d0b9QKqXAkWuYwV2h73mUGFhIiDE82aK2M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=H8iFjNDoEotQFOuYkv+lQEoEA/JzmgET42vZFM/nkGmIjoTj5fI5QWn5cUZZmTH7ecld0ATJSrDmZ7CE4k/cOBnJyXsEmauQb7Kmfhl1+iAhaPhprtJbPkR5Xa4f6hs6HF5LfCWNciXgmBEqG2CZuIvd64HTScX4lQSsz6WscaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HGoqc6z8; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HGoqc6z8" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48d035e8593so14403115e9.0 for ; Tue, 05 May 2026 05:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777982531; x=1778587331; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LsAUKqaB+d0b9QKqXAkWuYwV2h73mUGFhIiDE82aK2M=; b=HGoqc6z8XMuLbAiD1qw00ryVYRXD3Vry2H9wT95+81a1Jen9dG6UQ5IwWX7WuxvEDe E2tr8Ci7uIF8NnMQ7bD7oZDvm1J8hTq+9TJfMjFp2tHx2o1tn2Wj7Vq/mIon/ape0eIw Sv36XNdKQaXMnB9u6uW02EXayCNH1OqGrtCYmPUkWHX0JFtbyHfLrmvak0W9HMdg2hpA dZNvLwJ3mlSQwisnc9oKJmwVjPLLx2SPL6tXsZ6pqsXKqM54BUD6QxDJsjxRRgktw6ae Kux148icuc3BPMSWOkUSnKnM0VIFkiOwIKPpDcMQhpafJ+BqcGo60OTwmuN1RF8tEfJD tSJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777982531; x=1778587331; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LsAUKqaB+d0b9QKqXAkWuYwV2h73mUGFhIiDE82aK2M=; b=SxbgjY8n5JYkPkTSm6ztPvOX8j1hHnUG72WNzaz3EquVbKRwHsYLDtdMt8RTgivIym hesQr3L7AVAAib3OPJxiIcKouz2EX5/BSBbVMQtLELZ2WnG0KruPxj/godhWuG+DVRuq EH12DkjOQlMOuvDiBBkXSGcxS/U3jyurEKpxDUdSfFE1SBn2ve2RyDSWUbny4MOB/DFG ERNIyN+wh4Y79NAnynRIrrdQZb1jJIKTrUQz8hx924DStR60btZUCHSTeqfuyktipUWk TyxXqApqKfthS/lJ4Mb8NobieJNhklXKXETBYQ462G9rSeqtOl2E0uanLCHJ+jsJtfz8 Lm3g== X-Forwarded-Encrypted: i=1; AFNElJ8gwA9ZP+5Shz+4ZeAozP9EAKhpuz6O+kQxGrDFJ7GcsYIaAl6C2uNotfLq9J4WhbyvHBI3QQRyoQwH1WA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyd2XmlbOYmjPDP5GD2eH8WwiaX+aC0yhRRp2iXzf3r27ODvq2a fgC3y/zYnoy5aP+GOqXweKYsmpT/dCUCa76IzWQ6IexUrPfwhq/YE0QzNL2JCvSk+Y2FJ/z6WO8 j9Bq29v/utW+pXY138Q== X-Received: from wmkz26.prod.google.com ([2002:a7b:c7da:0:b0:487:37f2:47bf]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8903:b0:489:e696:8362 with SMTP id 5b1f17b1804b1-48a98894fe0mr157507635e9.13.1777982530471; Tue, 05 May 2026 05:02:10 -0700 (PDT) Date: Tue, 5 May 2026 12:02:09 +0000 In-Reply-To: <20260504-rustc-option-cross-v1-1-09f2726b680f@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260504-rustc-option-cross-v1-1-09f2726b680f@google.com> Message-ID: Subject: Re: [PATCH] rust: kasan/kbuild: fix rustc-option when cross-compiling From: Alice Ryhl To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nathan Chancellor , Nicolas Schier , Miguel Ojeda Cc: Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Mon, May 04, 2026 at 12:57:37PM +0000, Alice Ryhl wrote: > The above scenario actually also fails without -Zfixed-x18 since the > SW_TAGS sanitizer itself is aarch64-specific. But it's a problem with > normal KASAN too because of -Zfixed-x18. Correction: No, this is not actually the case. Despite being aarch64-specific, the SW_TAGS option does work correctly here. When rustc-option is invoked by Makefile.kasan, the -Zsanitizer=kernel-hwaddress flag is present only in RUSTFLAGS_KASAN and not in KBUILD_RUSTFLAGS, so it does not get included in the RUSTC invocation. Therefore, even though KASAN_SW_TAGS is aarch64-specific, it will correctly check the -Cllvm-args flags. I got this wrong because when checking it because I disabled -Zfixed-x18 but not CONFIG_ARM64_BTI_KERNEL, which adds -Zbranch-protection. This option causes the same problem. Alice