From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 5CADD342C9E for ; Wed, 17 Dec 2025 13:53:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765979619; cv=none; b=siWOcWK1klyRdntSxbwZi1jza3IqEpYyEG2bZ/fLAOn42iuBHBHECgGvy3bZoPJVoLCt7sgZOBssT/RM4eV/t/ANS8OyHcLalNSm7Cg8UsDjQ9noKw+gJO3P/LPBxtoJd6bq4+ab+CX2pawRuqkgPBvJoFvgRlCjCWg+5xW77wM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765979619; c=relaxed/simple; bh=CjnHJLYxh9NIWSmAW0oXG1F9NuoGVt1bcOhX0OTH3WA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VWnud9PhjXZC7P275frnTW0GUAHB4tsMDFfT/TFa3MN1u3ej93C3zr6oE9oDsGlHhhes6v6dJXxKT4hUaftPl+XiSDq7N3f6pC4B4jd7g7IAxb33wDZEMwBU5JBS9IwYym9Z5uU1bP5w3QN0bKJS13Joe/MJfM3LD11kVY+v1HE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=z7a+15Ic; arc=none smtp.client-ip=209.85.128.74 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--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="z7a+15Ic" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-47775585257so39812715e9.1 for ; Wed, 17 Dec 2025 05:53:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765979614; x=1766584414; 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=GwYQjUeDdM5Nle1IpM5e5V1FvMRCYFAI0uCKIrSa2SQ=; b=z7a+15IcM1OEs6mc5kthC3Li/29kZGliShaPBVFZnpTa/nqdndn4U1VbyjXcUE42/b RCn2GIfpbZrSW5xa5TRxFTHV0fZKoJ4EWu7YCnVcPl9cjEO9FHZWhduhrAWWxVagXFak v+cSJNEzEu0sR2br0lfrU2MBUh5kQm72aVGaWIIEE0TFYsnxsmS1H58Oc+QsVO2Ibbvf 4nJ+f4DvA5Wz5kO0gWP4u+avo4VOsaVZr8dnNG3zTyjcUsbcFxkdZjp+sg6t4xIa/aW9 9wSN6xOGKkcZ0DZ5MjUfHzEkULIfl1aBdt8uVeX2sG7HUy0X3yBJqpqTRMZE9055wYyT xdAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765979614; x=1766584414; 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=GwYQjUeDdM5Nle1IpM5e5V1FvMRCYFAI0uCKIrSa2SQ=; b=GB2Yh2eRnUNSBLeiitxprtSrAChDyPdV7noiO68njiyps/ybWVmP4dJ6Dka2pwNNYU QKizDcrLaV/lX3/5364panEmC6BGmv1q/3iEgtPYw8hl4espULcLffzE2KZY51wPcheD SCR0DhRkHMySiomVFS8QQxTSWSxYpMGrfy6lvqUuoHy6QhYUlnU4vCO7UpyyZZBWejG/ s9xa1+VXT97qASzpzmDVseKoljN7LQcCpNWDwWojRazix6oigq98ujHQb5lviJuz3kq6 xqhJIoPEP5/FNa6SI+2HrUbhJGir42/8a+/a5+bAHxyDIO2yAcm14cukFqPcvhjf4FXA aQXg== X-Forwarded-Encrypted: i=1; AJvYcCWVunooM1jdGfhjtCFyesrNbDpQl99SLq1CvP719eKBKP30RxqzbNnso6Y5LCmwqQ14s+QVBsVQHeiKbiw=@vger.kernel.org X-Gm-Message-State: AOJu0YxDJhjtipBH0ah0PPJMGMffUwdIkr3nbjMDWOLqTb1leoGbGq8T RDfg5kzYU9n7tPxWhqcwPs0qO9MuUYYjQdY/4Tfv8rKP6StFvIUOz0JOu3G4AUCatuQXwPPqzHg CKkNKwI5ZwMkhJw== X-Google-Smtp-Source: AGHT+IEY+zeplp7tJrsWxhjOhVbg/z9HJ2VKN9G1+nCVhTS+SXG8VbzCbUYGsr2pZOH8Zg/AWbnOXNkfLP8NnA== X-Received: from wmgp21.prod.google.com ([2002:a05:600c:2055:b0:477:afa:d217]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4f90:b0:477:b0b8:4dd0 with SMTP id 5b1f17b1804b1-47a8f905680mr190102895e9.17.1765979614010; Wed, 17 Dec 2025 05:53:34 -0800 (PST) Date: Wed, 17 Dec 2025 13:53:33 +0000 In-Reply-To: <20251216130155.GD3707891@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251216-gcov-inline-noinstr-v3-0-10244d154451@google.com> <20251216-gcov-inline-noinstr-v3-1-10244d154451@google.com> <20251216130155.GD3707891@noisy.programming.kicks-ass.net> X-Mailer: aerc 0.21.0 Message-ID: Subject: Re: [PATCH v3 1/3] kasan: mark !__SANITIZE_ADDRESS__ stubs __always_inline From: Brendan Jackman To: Peter Zijlstra , Brendan Jackman Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Marco Elver , Ard Biesheuvel , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , , , Content-Type: text/plain; charset="UTF-8" On Tue Dec 16, 2025 at 1:01 PM UTC, Peter Zijlstra wrote: > On Tue, Dec 16, 2025 at 10:16:34AM +0000, Brendan Jackman wrote: >> The x86 instrumented bitops in >> include/asm-generic/bitops/instrumented-non-atomic.h are >> KASAN-instrumented via explicit calls to instrument_* functions from >> include/linux/instrumented.h. >> >> This bitops are used from noinstr code in __sev_es_nmi_complete(). This >> code avoids noinstr violations by disabling __SANITIZE_ADDRESS__ etc for >> the compilation unit. > > Yeah, so don't do that? That's why we use raw_atomic_*() in things like > smp_text_poke_int3_handler(). Right, this was what Ard suggested in [0]: > For the short term, we could avoid this by using arch___set_bit() > directly in the SEV code that triggers this issue today. But for the > longer term, we should get write of those explicit calls to > instrumentation intrinsics, as this is fundamentally incompatible with > per-function overrides. But, I think the longer term solution is actually now coming from what Marco described in [1]. So in the meantime what's the cleanest fix? Going straight to the arch_* calls from SEV seems pretty yucky in its own right. Adding special un-instrumented wrappers in bitops.h seems overblown for a temporary workaround. Meanwhile, disabling __SANITIZE_ADDRESS__ is something the SEV code already relies on as a workaround, so if we can just make that workaround work for this case too, it seems like a reasonable way forward? Anyway, I don't feel too strongly about this, I'm only pushing back for the sake of hysteresis since I already flipflopped a couple of times on this fix. If Ard/Marco agree with just using the arch_ functions directly I'd be fine with that. And in the meantime, I guess patch 3/3 is OK? As it happens, that will already make the current error go away without needing the first 2 patches. So maybe we should just merge that and be done with it? There's probably a good chance no other issues will show up between now and whenever Marco's nice compiler support arrives. [0] https://lore.kernel.org/all/CAMj1kXHiA91hH80tHFCO9QjkkfzEGZ2GJgpHnuKrusKhOULMXA@mail.gmail.com/ [1] https://lore.kernel.org/all/CANpmjNNc9vRJbD2e5DPPR8SWNSYa=MqTzniARp4UWKBUEdhh_Q@mail.gmail.com/