From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13447 invoked by alias); 2 Oct 2010 13:40:46 -0000 Received: (qmail 13434 invoked by uid 22791); 2 Oct 2010 13:40:46 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID,TW_CL X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 02 Oct 2010 13:40:41 +0000 From: "ebotcazou at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/45867] reference to %g4 in code generated for sparc64-elf X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ebotcazou at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Target Status CC Resolution Summary In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sat, 02 Oct 2010 13:40:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg00214.txt.bz2 Message-ID: <20101002134000.-eHmi66kfQ6WqQAenbT6QkfZusZBhYvoe-AY1Bc2i3U@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45867 Eric Botcazou changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |sparc64-elf Status|UNCONFIRMED |RESOLVED CC| |ebotcazou at gcc dot | |gnu.org Resolution| |WORKSFORME Summary|Sparc64: bogus %g4 |reference to %g4 in code |reference in libgcc |generated for sparc64-elf |__udivti3() | --- Comment #1 from Eric Botcazou 2010-10-02 13:40:39 UTC --- > As can be seen in the output, there is a strange extra instruction, 'add > %g1, %g4, %g1'. %g4 is not initialized anywhere in the function but any > previous value will be used. Thus the __clz_tab table access can lead to > crashes. This may in theory even have some security implications if %g4 value > could be feasibly controlled by an attacker. The attacker is supposed to be you here. The sparc64-elf compiler defaults to the CM_EMBMEDANY memory model: TARGET_CM_EMBMEDANY: 64-bit address space. The text and data segments have a maximum size of 2GB (31-bit span) and may be located anywhere in memory. The global register %g4 contains the start address of the data segment. Programs are statically linked and PIC is not supported.