From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 629BE3858D1E; Mon, 20 May 2024 19:53:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 629BE3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716234833; bh=FWPZ/WRKcOHr0ZzDvoUVOy2yIcZwZqGFqdOqg1SRpkc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JIrPeq2gt9tvuWU6kU+2ezBxsbhFOMsh3TnuygBaaOzorrwtbHZna1EkJPdQT9Tga Kna7QGNDZbgw5h+2APDfX75rTBUqBs7sVTGqD3MfmSOnL8RDI7Ie4zNRNdxD0v15gM v9cafwGOxNm9HHfoDjZHknK/FisN9XdK0QNr7VKs= From: "pchelkin at ispras dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/111736] Address sanitizer is not compatible with named address spaces Date: Mon, 20 May 2024 19:53:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: addr-space, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pchelkin at ispras dot ru X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111736 Fedor Pchelkin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pchelkin at ispras dot ru --- Comment #42 from Fedor Pchelkin --- Hi, I'm facing upstream Linux kernel boot failures with KASAN enabled after rec= ent x86/percpu updates. HEAD kernel commit is daa121128a2d2ac6006159e2c47676e4fcd21eab. The kernel is built with GCC 14.1.1 20240507. It's Arch Linux, package deta= ils here [1]. The failing Linux kernel commit is f61f02d1ff78 ("x86/percpu: Re-enable nam= ed address spaces with KASAN for GCC 13.3+") [2]. You see that the above kernel commit states that GCC 14 must be fixed with patches from this pull-request: Note that the patch considers GCC 14 to be fixed - if somebody is using snapshots of the GCC 14 before the fix, they should upgrade. I'm not familiar with GCC stable branches model but it seems to me that GCC 13.3 was fixed with patches from this pull-request while GCC 14.1 didn't get the fixes at the time. Or it did? frankly speaking, I haven't been able to figure it out for sure (and would be surprised if latest GCC 14 release did= n't get the fixes before the kernel received an x86/percpu update regarding this issue). If GCC 14.1 is fixed then there is probably another issue found. However, I still think that if it was a real widespread problem, then somebody would h= ave already reported it. So maybe my kernel-config is just weird :) I've attached a dmesg output and kernel config I use for testing. The failing code lines are decoded as following: __text_poke+0x493/0xd50: use_temporary_mm at arch/x86/kernel/alternative.c:1789 (discriminator 2) (inlined by) __text_poke at arch/x86/kernel/alternative.c:1904 (discriminat= or 2) This concerns a percpu variable access: static inline temp_mm_state_t use_temporary_mm(struct mm_struct *mm) { [...] /* * Make sure not to be in TLB lazy mode, as otherwise we'll end up * with a stale address space WITHOUT being in lazy mode after * restoring the previous mm. */ if (this_cpu_read(cpu_tlbstate_shared.is_lazy)) leave_mm(); [1]: https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/blob/main/P= KGBUILD?ref_type=3Dheads [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3Df61f02d1ff788ae5ad485ef8edd88d9c93557994=