From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A7D253858D28; Tue, 21 May 2024 09:33:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7D253858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716284007; bh=BAjYT87673xgJecaRycg2Me+lRFJi59GYIZkaw+rsr4=; h=From:To:Subject:Date:From; b=aN7epoOzMwxCcf6Yjt+iQhmiu2IzcCjBi7JqxJlT1sp9r2oHwKg4eZM99+Nky6CgV GulsG/PTJKzGPGyO7eiHo+AByHwk6HC3So0q/ub+0IXUORmLq9TiHNdclG41eR6P9P ptQT0fOS+QmQlodXHt9OiClwH5sbx1aipC10214g= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/115172] New: Invalid -fsanitize=bool sanitization of variable from named address space Date: Tue, 21 May 2024 09:33:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: 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 Bug ID: 115172 Summary: Invalid -fsanitize=3Dbool sanitization of variable from named address space Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Target Milestone: --- Created attachment 58260 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D58260&action=3Dedit Preprocessed file Originally reported in PR 111736, comment 42. Compiling the attached preprocessed file with: gcc -O2 -fsanitize=3Dkernel-address -fasan-shadow-offset=3D0xdffffc00000000= 00 --param asan-instrumentation-with-call-threshold=3D10000 -fsanitize=3Dbool = -S alternative.i results in: movabsq $-2305847407260205056, %rdx movl $cpu_tlbstate_shared, %eax shrq $3, %rax movzbl (%rax,%rdx), %eax testb %al, %al je .L399 jle .L473 .L399: movzbl %gs:cpu_tlbstate_shared(%rip), %r14d cmpb $1, %r14b which is wrong. %gs: prefixed addresses should not be sanitized. Omitting -fsanitize=3Dbool from the above compiles the preprocessed file to: movzbl %gs:cpu_tlbstate_shared(%rip), %eax testb %al, %al where no sanitization is present with the above variable.=