Issue 46898 in oss-fuzz: elfutils:fuzz-libelf: Timeout in fuzz-libelf

2022-04-21 Thread ClusterFuzz-External via monorail via Elfutils-devel
Status: New
Owner: 
CC: elfut...@sourceware.org, da...@adalogics.com, evv...@gmail.com, 
izz...@google.com 
Labels: ClusterFuzz Reproducible Engine-libfuzzer OS-Linux Proj-elfutils 
Reported-2022-04-21
Type: Bug

New issue 46898 by ClusterFuzz-External: elfutils:fuzz-libelf: Timeout in 
fuzz-libelf
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46898

Detailed Report: https://oss-fuzz.com/testcase?key=6521986165112832

Project: elfutils
Fuzzing Engine: libFuzzer
Fuzz Target: fuzz-libelf
Job Type: libfuzzer_asan_i386_elfutils
Platform Id: linux

Crash Type: Timeout (exceeds 60 secs)
Crash Address: 
Crash State:
  fuzz-libelf
  
Sanitizer: address (ASAN)

Regressed: 
https://oss-fuzz.com/revisions?job=libfuzzer_asan_i386_elfutils&range=202203290604:202203291200

Reproducer Testcase: https://oss-fuzz.com/download?testcase_id=6521986165112832

Issue filed automatically.

See https://google.github.io/oss-fuzz/advanced-topics/reproducing for 
instructions to reproduce this bug locally.
When you fix this bug, please
  * mention the fix revision(s).
  * state whether the bug was a short-lived regression or an old bug in any 
stable releases.
  * add any other useful information.
This information can help downstream consumers.

If you need to contact the OSS-Fuzz team with a question, concern, or any other 
feedback, please file an issue at https://github.com/google/oss-fuzz/issues. 
Comments on individual Monorail issues are not monitored.

-- 
You received this message because:
  1. You were specifically CC'd on the issue

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Reply to this email to add a comment.


[Bug general/29082] New: Support GNU_PROPERTY_TYPE_0 in eu-readelf -n

2022-04-21 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29082

Bug ID: 29082
   Summary: Support GNU_PROPERTY_TYPE_0 in eu-readelf -n
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: general
  Assignee: unassigned at sourceware dot org
  Reporter: mliska at suse dot cz
CC: elfutils-devel at sourceware dot org, mark at klomp dot org
  Target Milestone: ---

Please support the following:

$ readelf -n a.o

Displaying notes found in: .note.gnu.property
  OwnerData sizeDescription
  GNU  0x0020   NT_GNU_PROPERTY_TYPE_0
  Properties: x86 ISA used: 
x86 feature used: x86

$ eu-readelf -n a.o

Note section [ 4] '.note.gnu.property' of 48 bytes at offset 0x1c0:
  Owner  Data size  Type
  GNU   32  GNU_PROPERTY_TYPE_0
X86 0xc0010002 data: 00 00 00 00
X86 0xc0010001 data: 01 00 00 00

So the data output can be parsed to 'x86'.

On the other hand, 'Properties: x86 feature' are printed quite fine:

$ echo '' | gcc -c -fcf-protection=full -x c - -o a.o && readelf -n a.o

Displaying notes found in: .note.gnu.property
  OwnerData sizeDescription
  GNU  0x0010   NT_GNU_PROPERTY_TYPE_0
  Properties: x86 feature: IBT, SHSTK
  GNU  0x0020   NT_GNU_PROPERTY_TYPE_0
  Properties: x86 ISA used: 
x86 feature used: x86

$ echo '' | gcc -c -fcf-protection=full -x c - -o a.o && eu-readelf -n a.o

Note section [ 6] '.note.gnu.property' of 80 bytes at offset 0x98:
  Owner  Data size  Type
  GNU   16  GNU_PROPERTY_TYPE_0
X86 FEATURE_1_AND: 0003 IBT SHSTK
  GNU   32  GNU_PROPERTY_TYPE_0
X86 0xc0010002 data: 00 00 00 00
X86 0xc0010001 data: 01 00 00 00

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug general/29082] Support GNU_PROPERTY_TYPE_0 in eu-readelf -n

2022-04-21 Thread mark at klomp dot org via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29082

--- Comment #1 from Mark Wielaard  ---
Do you have a spec for that?

The GNU PROPERTY constants seem to change from time to time.

See e.g. the last glibc elf.h sync:

commit 31d551ae4dd8cf307c68f86b6c1ecac2f92b522a
Author: Mark Wielaard 
Date:   Thu Mar 24 23:06:09 2022 +0100

libelf: Sync elf.h from glibc.

Adds EM_INTELGT, NT_ARM_TAGGED_ADDR_CTRL, NT_ARM_PAC_ENABLED_KEYS,
ELF_NOTE_FDO, NT_FDO_PACKAGING_METADATA and OpenRISC 1000 specific
relocs.

It also adds and renames some GNU_PROPERTY constants. But none of the
constants the elfutils code uses was renamed or given a different
constant value.

dwelf_elf_e_machine_string was updated to handle EM_INTELGT.

Signed-off-by: Mark Wielaard 

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Re: [PATCH] [PATCH] debuginfod: Use the debuginfod-size response header

2022-04-21 Thread Aaron Merey via Elfutils-devel
On Thu, Mar 31, 2022 at 1:44 PM Mark Wielaard  wrote:
> Just a question about this part:
>
> > +  /* If Content-Length is -1, try to get the size from
> > + X-Debuginfod-Size */
> > +  if (dl_size == -1 && c->winning_headers != NULL)
> > +{
> > +  double xdl;
> > +  char *hdr = strstr(c->winning_headers, "x-debuginfod-size");
> > +
> > +  if (hdr != NULL
> > +  && sscanf(hdr, "x-debuginfod-size: %lf", &xdl) == 1)
> > +dl_size = (xdl >= (double)(LONG_MAX+1UL) ? LONG_MAX : 
> > (long)xdl);
> > +}
> > +}
>
> In debuginfod.cxx the header is spelled all uppercase as "X-DEBUGINFOD-
> SIZE" which is also what is checked for in the run-debuginfod-response-
> headers.sh test. So shouldn't the above also be all uppercase or should
> you use strcasestr?

strcasestr is definitely better here. I meant to replace strstr with it
but it looks like I missed that.

> When using sscanf why are you using a double and %lf? Isn't it simpler
> to use a long and %ld?

It was done out of an (excessive) abundance of caution in case the
value from the header was greater than LONG_MAX. x-debuginfod-size is
derived from an off_t value so this currently isn't possible, so yes it
would be simpler to stick with long and %ld. Fixed.

> Is there a way to test this easily? When would Content-Length not be
> available?

AFAIK Content-Length isn't available only when a debuginfod server is
configured with an httpd proxy that compresses files on-the-fly. If the
response headers are finalized before compression is finished,
Content-Length won't be present.

Short of setting up an httpd-proxied server in the testsuite I'm not sure
exactly how to test this. We currently have tests that check for the
presence of x-debuginfod-size and we could add tests to at least verify
that the value in the header matches the uncompressed size of the file
being transferred.

Aaron