From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1342E3857C51; Sat, 6 Jan 2024 22:26:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1342E3857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1704579980; bh=aM0jZCxPacFZ4T8N0sfv39qnts9pG9FfXt+unEdQKKo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vRaPTrlRdaMimygzfDhLD+ENaTIQpFIjfaXHcDu1jIKi2KfFhU7jlFgt0qMFdREzv udGqL0OAxBRkIpqPx4TbLI76di+V2LlA0XM+I+pMIACmAYIf3GP4nB822sN8k8aE/n Rx8KXA+KR5yA58eC9g0f7lmiuaCOH87Y37RfMT68= From: "cvs-commit at gcc dot gnu.org" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/31218] PLT rewrite overflows large displacement on x32 Date: Sat, 06 Jan 2024 22:26:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Version: 2.39 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31218 --- Comment #2 from Sourceware Commits --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=3Dglibc.git;h=3D0f9afc265a4a0f4ba65= 8d7f71c9602a3fda3538e commit 0f9afc265a4a0f4ba658d7f71c9602a3fda3538e Author: H.J. Lu Date: Sat Jan 6 14:03:37 2024 -0800 x32: Handle displacement overflow in PLT rewrite [BZ #31218] PLT rewrite calculated displacement with ElfW(Addr) disp =3D value - branch_start - JMP32_INSN_SIZE; On x32, displacement from 0xf7fbe060 to 0x401030 was calculated as unsigned int disp =3D 0x401030 - 0xf7fbe060 - 5; with disp =3D=3D 0x8442fcb and caused displacement overflow. The PLT en= try was changed to: 0xf7fbe060 <+0>: e9 cb 2f 44 08 jmp 0x401030 0xf7fbe065 <+5>: cc int3 0xf7fbe066 <+6>: cc int3 0xf7fbe067 <+7>: cc int3 0xf7fbe068 <+8>: cc int3 0xf7fbe069 <+9>: cc int3 0xf7fbe06a <+10>: cc int3 0xf7fbe06b <+11>: cc int3 0xf7fbe06c <+12>: cc int3 0xf7fbe06d <+13>: cc int3 0xf7fbe06e <+14>: cc int3 0xf7fbe06f <+15>: cc int3 x32 has 32-bit address range, but it doesn't wrap address around at 4GB, JMP target was changed to 0x100401030 (0xf7fbe060LL + 0x8442fcbLL + 5), which is above 4GB. Always use uint64_t to calculate displacement. This fixes BZ #31218. Reviewed-by: Noah Goldstein --=20 You are receiving this mail because: You are on the CC list for the bug.=