Project

General

Profile

Actions

Bug #3776

open

gcc can cause segfaults on ctfmerge

Added by Pedro Giffuni about 10 years ago. Updated almost 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2013-05-21
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

The issue was found initially in NetBSD:
https://github.com/jsonn/src/commit/924b243eee68869ee5ed48f2b2fab9815c4f4e82

GCC happens to use invalid ((unsigned)-1) value for DW_AT_byte_size to denote a variable size in an object.

I readapted the NetBSD patch for use in FreeBSD and in the process also unsigned some variables to clear some signed/unsigned comparison issues.


Files

patch-gcc-cvt.diff (4.39 KB) patch-gcc-cvt.diff Patch to avoid invalid values in DW_AT_byte_size Pedro Giffuni, 2013-05-21 12:18 AM
patch-gcc-cvt.diff (5.39 KB) patch-gcc-cvt.diff Updated patch with signed intr_nbits Pedro Giffuni, 2013-06-29 07:07 PM
patch-gcc-fix.diff (5.38 KB) patch-gcc-fix.diff Adjust ml_size too. Pedro Giffuni, 2013-06-29 07:26 PM
Actions #1

Updated by Andrew Stormont almost 10 years ago

The change to intr_nbits is causing a build failure on my environment. Changing it back to 'int' allows things to build.

Actions #2

Updated by Pedro Giffuni almost 10 years ago

Andrew Stormont wrote:

The change to intr_nbits is causing a build failure on my environment. Changing it back to 'int' allows things to build.

Hi Andrew;

It would be interesting to know the exact failure ;).

Perhaps changing it to "unsigned int" works?

Actions #3

Updated by Pedro Giffuni almost 10 years ago

The problem is that in my environment (gcc/clang) complains about comparing signed with unsigned values and, at least in principle, sizes should be unsigned, which is what is causing this patch.

I left intr_nbits signed but I made ml_size unsigned (uint64_t as in Illumos according to opengrok). In order to avoid the warnings I used casts. It is somewhat ugly but it just works.

Actions #4

Updated by Pedro Giffuni almost 10 years ago

Pedro Giffuni wrote:

I left intr_nbits signed but I made ml_size unsigned (uint64_t as in Illumos according to opengrok). In order to avoid the warnings I used casts. It is somewhat ugly but it just works.

On second thoughts, ml_size as a simple uint_t should be enough: the uint64_t ml_size that opengrok found is likely unrelated.

Actions #5

Updated by Pedro Giffuni almost 10 years ago

The patch has been committed with minor changes in FreeBSD:

http://svnweb.freebsd.org/changeset/base/253661

Actions

Also available in: Atom PDF