- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Extracting raw data from an ELF .EXE file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 02:00 PM
тАО12-04-2007 02:00 PM
On I64 I can link with /BASE=0 but there is no equivalent to /NOHEADER. The resulting executable has a 1 block ELF header, several blocks of raw data that matches the VAX .exe exactly, then several more blocks of ELF image info. I need to extract the raw binary data. I could just chop off block 1 and the last 5 blocks, but this is largely guessing. Is there some code that can tell me for certain that the program segment corresponding to the data starts at Block A and is B blocks long?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 02:04 PM
тАО12-04-2007 02:04 PM
Re: Extracting raw data from an ELF .EXE file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 02:52 PM
тАО12-04-2007 02:52 PM
Re: Extracting raw data from an ELF .EXE file
I'm not sure I understand how this image is used. Do the callers "activate" it? Is it just opened and read as a data file? Is it mapped somehow?
Can you modify your input or mapping routine to skip the ELF header if it's found? If not, maybe you need a post process program to trim off the header. Rather than just blindly chopping off the first block, I'd code something that does at least skeletal confirmation of the ELF header and finds the end of it) Can your I64 programs read the file linked on VAX?
Does it work on Alpha?
If I'm on completely the wrong track, perhaps you could post a very simple, cut down version of what you're doing - include both code to produce your decapitated image, and the consumer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 03:12 PM
тАО12-04-2007 03:12 PM
Re: Extracting raw data from an ELF .EXE file
The I64 does work with VAX-generated files. There is no Alpha version, customer is going from museum-quality VAXes straight to I64.
Current decapitation program is trivial: Get size in blocks of the .EXE. Read in (size-6) blocks starting at block 2 and write them to a new file. This works, but I know that someday there will be a new version of the linker that generates 2 block headers or 4 block trailers or something, which will cause things to break. I'd like to know just enough of the ELF image format to know where the raw data starts and its size in blocks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 04:33 PM
тАО12-04-2007 04:33 PM
Re: Extracting raw data from an ELF .EXE file
>The image is just data, although it is mapped in via $CRMPSC
Interesting! (and I thought I'd done some weird stuff with OpenVMS images ;-)
> I'd like to know just enough of the ELF
>image format to know where the raw data
>starts and its size in blocks.
Yes, you should definitely check the header is where you expect it to be.
One of the reasons OpenVMS engineering decided to change the image format was because ELF is a standard. As such the specification is freely available. A quick Google search found:
http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
which contains many links to more detailed information. I'm sure you should be able to find what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2007 08:35 PM
тАО12-04-2007 08:35 PM
Re: Extracting raw data from an ELF .EXE file
I cannot agree more with John. Reading, and then complying with the ELF specification (not what one happens to see, but the real specification) is important.
It is a fairly safe bet that the OpenVMS team will stay in compliance with the specification. This may, however, lead to the use of features that are not apparent from a casual analysis of an image.
Also, validating that an ELF file has the expected identification fields in the expected places would be an excellent idea.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 08:33 AM
тАО12-05-2007 08:33 AM
Re: Extracting raw data from an ELF .EXE file
A little reading and I'll quickly code up a little program to do what I want.
As to:
>>The image is just data, although it is mapped in via $CRMPSC
>Interesting! (and I thought I'd done some weird stuff with OpenVMS images ;-)
Let me tell you, this is just the tip of the iceberg of weirdness with this project!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 08:51 AM
тАО12-05-2007 08:51 AM
Re: Extracting raw data from an ELF .EXE file
--
You can't tease us like that . . . :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 09:08 AM
тАО12-05-2007 09:08 AM
Re: Extracting raw data from an ELF .EXE file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 12:59 PM
тАО12-05-2007 12:59 PM
Re: Extracting raw data from an ELF .EXE file
where do I start? I brought some of this code to VMS Engineering's Porting to Itanium seminar, and some of the VMS Engineers started reaching for crosses and garlic, or just hiding under their desks. Absolute addressing. Strange stack manipulation. Ponder these two macro-32 statements for a bit and you'll get an idea...
movzwl @#CMRTFP,fp
MOVW -6(SP),R0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2007 01:03 PM
тАО12-05-2007 01:03 PM
Re: Extracting raw data from an ELF .EXE file
So far I've been working with elf.c that comes with the gnv kit as a starting point. It parses object files for symbols. But more can't hurt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2007 07:04 AM
тАО12-06-2007 07:04 AM
Re: Extracting raw data from an ELF .EXE file
I've attached something that Hartmut wrote.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2007 01:39 PM
тАО12-06-2007 01:39 PM
Re: Extracting raw data from an ELF .EXE file
In the sense that it's unlikely to ACCVIO, true, but how can it return a predictable result? Anything above the current SP is volatile - it could be written at any time by an AST or other interrupt. I'd call it a timing bug waiting for a place to happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2007 04:40 PM
тАО12-06-2007 04:40 PM
Re: Extracting raw data from an ELF .EXE file
Exactly. Try that code with ASTs enabled. (try finding that kind of bug!)
The FP instruction is an example of how twisted this code gets. They essentially invented their own stack frames/traceback stuff between routines, via JSB/RSB, ignoring all the useful stuff provided by CALLx/RET. Also note it's a 16 bit move with an absolute address.... Yes, the Itanium MACRO-32 compiler does not like that one bit, nor does it like all the other manipulation of the FP and SP..
John R, thanks for the code, it's easier to adapt than the other code.