Skip to content

ildasm fails to read ni file with a specific option (Segmentation fault) #7644

@hqueue

Description

@hqueue

I faced Segementation fault when reading ni file using ildasm with -nat option.
It seems that other options pretty works well.
Same behavior observed on x64/Ubuntu 14.04 and arm/Ubuntu16.04.

Environment

Host environment: x64/Ubuntu 14.04
coreclr/corefx are built for x64/Ubuntu 14.04 with Debug
coreclr: 19e1cd2
corefx: 808c9de

Example

Following example is from JIT/CodeGenBringUpTests/Add1/Add1.exe .

$ ./corerun Add1.exe 
$ echo $?
100
$ ./crossgen /ReadyToRun /Platform_Assemblies_Paths `pwd` Add1.exe
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Native image /home/hk0110/work/dxl/dotnet/mywork/device/x64_albireo/unittests/coreoverlays/coreoverlay.test20170315debug/Add1.ni.exe generated successfully.
$ ./corerun Add1.ni.exe
$ echo $?
100
$ ./ildasm -nat Add1.ni.exe 

//  Microsoft (R) .NET Framework IL Disassembler.  Version 4.5.22220.0

Segmentation fault (core dumped)
$
Long log of ildasm working with other options

$ ./ildasm -headers -noil Add1.ni.exe

// Microsoft (R) .NET Framework IL Disassembler. Version 4.5.22220.0

// warning : THIS IS A PARTIAL DISASSEMBLY, NOT SUITABLE FOR RE-ASSEMBLING

// ----- DOS Header:
// Magic: 0x5a4d
// Bytes on last page: 0x0000
// Pages in file: 0x0000
// Relocations: 0x0000
// Size of header (paragraphs):0x0000
// Min extra paragraphs: 0x0000
// Max extra paragraphs: 0x0000
// Initial (relative) SS: 0x0000
// Initial SP: 0x0000
// Checksum: 0x0000
// Initial IP: 0x0000
// Initial (relative) CS: 0x0000
// File addr. of reloc table: 0x0040
// Overlay number: 0x0000
// OEM identifier: 0x0000
// OEM info: 0x0000
// File addr. of COFF header: 0x0080
// ----- COFF/PE Headers:
// Signature: 0x00004550
// ----- COFF Header:
// Machine: 0xfd1d
// Number of sections: 0x0003
// Time-date stamp: 0x58b70c75
// Ptr to symbol table: 0x00000000
// Number of symbols: 0x00000000
// Size of optional header: 0x00f0
// Characteristics: 0x2022
// ----- PE Optional Header (64 bit):
// Magic: 0x020b
// Major linker version: 0x0b
// Minor linker version: 0x00
// Size of code: 0x00000000
// Size of init.data: 0x00000000
// Size of uninit.data: 0x00000000
// Addr. of entry point: 0x00000000
// Base of code: 0x00000000
// Image base: 0x0000000004000000
// Section alignment: 0x00001000
// File alignment: 0x00001000
// Major OS version: 0x0005
// Minor OS version: 0x0002
// Major image version: 0x0000
// Minor image version: 0x0000
// Major subsystem version: 0x0005
// Minor subsystem version: 0x0002
// Size of image: 0x00004000
// Size of headers: 0x00001000
// Checksum: 0x00000000
// Subsystem: 0x0003
// DLL characteristics: 0x8140
// Size of stack reserve: 0x0000000000100000

Is -nat option stilll valid for ildasm and is this a bug ? or not supported by ildasm anymore ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbughelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions