From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB811384AB5D; Tue, 21 May 2024 10:20:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB811384AB5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716286825; bh=4rYoUMC3Vso2Hzh/cOohq239uCxPRxctoSQSeqEhgCk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Li44YNb6HVK3TNTDwQe6sPyPAdy76Ikgz0A7d5RSDwqoz2fgF/wpGbjwxv42RugHA t0JQJItw6gzNbhI5GhVUdyV+7Yz7zR1W8YXFEbSWKpJHIhHyBbsr6VdJ3aLYQa98tR WLBExdkTu3uvT4UUwOLT2UL7COpEz7sakW/U3ahc= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/115172] Invalid -fsanitize=bool sanitization of variable from named address space Date: Tue, 21 May 2024 10:20:25 +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: 14.1.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D115172 --- Comment #3 from Uro=C5=A1 Bizjak --- (In reply to Jakub Jelinek from comment #1) > What the kernel does is terrible, why they just don't declare the extern > with __seg_gs attribute? This is how kernel currently handles percpu variables. They are redefined t= o a named address space just before use, because the percpu infrastructure can't handle AS qualified variables, mainly due to the extensive use of __typeof_= _, please see [1]. The solution is to use __typeof_unqual__ with gcc-14. The prototype patch at [2] declares percpu variables as __seg_gs during decl time, as you proposed above. [1] https://lore.kernel.org/lkml/87bk7ux4e9.ffs@tglx/ [2] https://lore.kernel.org/lkml/CAFULd4Z-stHtu2UWv02S+Nbx51QqytGUO8ZeW50Fc_Pbs= fF8BA@mail.gmail.com/=