`picotool seal` corrupts ELF files built with IAR toolchain

Open
#374 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
cli

Research direction

Start by locating the picotool seal implementation and how it reads and writes ELF program headers; compare that behavior with the before and after readelf -l output in the issue. Reproduce with an ELF built using the IAR toolchain and inspect the headers before and after sealing. Done when sealing preserves valid program headers for that input.

Written by the indexing model from the issue text.

Description

Illustrated by running readelf -l on the input and output ELF files:

Before
Elf file type is EXEC (Executable file)
Entry point 0x20000181
There is 1 program header, starting at offset 1742692

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000034 0x20000000 0x20000000 0x09040 0x0a584 RWE 0x8

 Section to Segment mapping:
  Segment Sections...
   00     P1 P1_2
After
Elf file type is EXEC (Executable file)
Entry point 0x20000181
There are 2 program headers, starting at offset 1742692

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  <unknown>: 100 0x1f6a0004 0x8ffc0001 0x00002000 0x100000 0x1f800004   E 0x2000
  <unknown>: 100 0x1ff50004 0x8ffc0001 0x00002000 0x100000 0x4ccf0004     0x42000

 Section to Segment mapping:
  Segment Sections...
   00
   01
Dominant language
C++
Stars
1k
Forks
199
Avg merge
7d 18h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/picotool

All issues in raspberrypi/picotool

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.