From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C677D3858296; Wed, 20 Mar 2024 20:04:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C677D3858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710965047; bh=L8G4VAPgROqDVvzKm10PG/czJ+LlT5Teoqe4rm0A4ho=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M9HCl8bWaEFH1WbZ9VU9HHTEOH9mgt5B/K2daZ+CJIRtxvaeqCuWkYlnt32SG8XDI Nnk6QJl3UTkIKgk4dDdf4Tw31H2bATKMG7sl6+QvKiZQKEg5KbnYrJ4rwWthyekKsf crP3ubW64V8nZdima+W/17ejCePLmZCQl2wXVx34= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/111736] Address sanitizer is not compatible with named address spaces Date: Wed, 20 Mar 2024 20:04:05 +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: ubizjak at gmail dot com X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status 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 Uro=C5=A1 Bizjak changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |--- Status|RESOLVED |REOPENED --- Comment #10 from Uro=C5=A1 Bizjak --- Huh, is this really fixed? --cut here-- extern int __seg_gs m; int foo (void) { return m; } extern __thread int n; int bar (void) { return n; } extern int o; int baz (void) { return o; } --cut here-- gcc -O2 -fsanitize=3Daddress: foo: .LASANPC0: .LFB0: .cfi_startproc movl $m, %eax movq %rax, %rdx andl $7, %eax shrq $3, %rdx addl $3, %eax movzbl 2147450880(%rdx), %edx cmpb %dl, %al jl .L2 testb %dl, %dl jne .L13 .L2: movl %gs:m(%rip), %eax ret .L13: pushq %rax .cfi_def_cfa_offset 16 movl $m, %edi call __asan_report_load4 .cfi_endproc .LFE0: .size foo, .-foo .p2align 4 .globl bar .type bar, @function The memory access is still annotated with asan code. I did test patched gcc by building a kernel with named address spaces, but = I'm not sure I did it correctly anymore - I was not able to boot recent -tip wi= th KASAN and enabled named address spaces.=