Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for sections to have duplicate names #6411

Open
WeiN76LQh opened this issue Feb 11, 2025 · 0 comments
Open

Allow for sections to have duplicate names #6411

WeiN76LQh opened this issue Feb 11, 2025 · 0 comments
Assignees
Labels
File Format: SharedCache Issue with the dyld_shared_cache plugin State: Awaiting Triage Issue is waiting for more in-depth triage from a developer
Milestone

Comments

@WeiN76LQh
Copy link

What is the feature you'd like to have?
Sections with the same name should be allowed.

Is your feature request related to a problem?
Currently if multiple sections are added to a binary view with the same name only the first instance is displayed in the UI. This means that only 1 will appear in the sections list at the top of the linear view. This applies to the sections table under the Memory Map panel. Also there should be text where a section starts and ends in the linear view, as well as a sticky header showing the current section name as you scroll through it. This is not the case for sections with duplicate names (except for the first instance).

Loading libsystem_c.dylib from the DYLD Shared Cache in IDA provides the following sections:

Name	Start	End	R	W	X	D	L	Align	Base	Type	Class	AD	T	DS
libsystem_c:HEADER	000000018AB60000	000000018AB61A5C	R	.	X	.	L	byte	07	public	DATA	64	00	07
libsystem_c:__text	000000018AB61A5C	000000018ABD8300	R	.	X	.	L	dword	01	public	CODE	64	00	01
libsystem_c:__auth_stubs	000000018ABD8300	000000018ABD9300	R	.	X	.	L	dword	02	public	CODE	64	00	02
libsystem_c:__const	000000018ABD9300	000000018ABDB968	R	.	X	.	L	para	03	public	DATA	64	00	03
libsystem_c:__cstring	000000018ABDB968	000000018ABDEBD6	R	.	X	.	L	byte	04	public	DATA	64	00	04
libsystem_c:__oslogstring	000000018ABDEBD6	000000018ABDEC34	R	.	X	.	L	byte	05	public	DATA	64	00	05
libsystem_c:__unwind_info	000000018ABDEC34	000000018ABDFFF4	R	.	X	.	L	dword	06	public		64	00	06
libsystem_c:__got	00000001E1209578	00000001E12095B8	R	.	.	.	L	qword	08	public	DATA	64	00	08
libsystem_c:__const	00000001E12095B8	00000001E120AEC8	R	.	.	.	L	qword	09	public	DATA	64	00	09
libsystem_c:__data	00000001E4DBA558	00000001E4DBAA28	R	W	.	.	L	qword	0F	public	DATA	64	00	0F
libsystem_c:__crash_info	00000001E4DBAA28	00000001E4DBAA68	R	W	.	.	L	qword	10	public		64	00	10
libsystem_c:__constrw	00000001E4DBAA68	00000001E4DBB6F0	R	W	.	.	L	qword	11	public		64	00	11
libsystem_c:__bss	00000001E4DBB6F0	00000001E4DBC3A0	R	W	.	.	L	qword	12	public	BSS	64	00	12
libsystem_c:__common	00000001E4DBC3A0	00000001E4DBC428	R	W	.	.	L	qword	13	public	BSS	64	00	13
libsystem_c:__data	00000001E6BEB460	00000001E6BEC770	R	W	.	.	L	qword	14	public	DATA	64	00	14
libsystem_c:__bss	00000001E6BEC770	00000001E6BECA60	R	W	.	.	L	qword	15	public	BSS	64	00	15
libsystem_c:__common	00000001E6BECA60	00000001E6BECAF0	R	W	.	.	L	qword	16	public	BSS	64	00	16
libsystem_c:__data	00000001E7A9EB30	00000001E7A9EB60	R	W	.	.	L	qword	0D	public	DATA	64	00	0D
libsystem_c:__constrw	00000001E7A9EB60	00000001E7A9EBE0	R	W	.	.	L	qword	0E	public		64	00	0E
libsystem_c:__auth_got	00000001E8FF62D8	00000001E8FF6AD8	R	W	.	.	L	qword	0A	public	DATA	64	00	0A
libsystem_c:__auth_ptr	00000001E8FF6AD8	00000001E8FF6B58	R	W	.	.	L	qword	0B	public		64	00	0B
libsystem_c:__const	00000001E8FF6B58	00000001E8FF6C58	R	W	.	.	L	qword	0C	public	DATA	64	00	0C

As you can see there are a number of duplicate sections like __data and __const.

Doing the same in Binary Ninja you get much less:

Sections:
0x180000000-0x180000208  __dsc_header  {Read-only data}
0x180000210-0x180000238  .synthetic_builtins  {External}
0x18ab61a5c-0x18abd8300  libsystem_c.dylib::__text (PURE_CODE)  {Code}
0x18abd8300-0x18abd9300  libsystem_c.dylib::__auth_stubs (SYMBOL_STUBS)  {Code}
0x18abdb968-0x18abdebd6  libsystem_c.dylib::__cstring (CSTRING_LITERALS)  {Read-only data}
0x18abdebd6-0x18abdec32  libsystem_c.dylib::__oslogstring (CSTRING_LITERALS)  {Read-only data}
0x18abdec34-0x18abdfff4  libsystem_c.dylib::__unwind_info (REGULAR)
0x1e1209578-0x1e12095b8  libsystem_c.dylib::__got (REGULAR)  {Read-only data}
0x1e4dbaa28-0x1e4dbaa68  libsystem_c.dylib::__crash_info (REGULAR)
0x1e4dbaa68-0x1e4dbb6f0  libsystem_c.dylib::__constrw (REGULAR)
0x1e6beb460-0x1e6bec770  libsystem_c.dylib::__data (REGULAR)  {Writable data}
0x1e6bec770-0x1e6beca60  libsystem_c.dylib::__bss (ZEROFILL)  {Writable data}
0x1e6beca60-0x1e6becaf0  libsystem_c.dylib::__common (ZEROFILL)  {Writable data}
0x1e7a9eb30-0x1e8ff62d8  libsystem_c.dylib::__data(2)
0x1e7a9eb30-0x1e8ff62d8  libsystem_c.dylib::__data2
0x1e8ff62d8-0x1e8ff6ad8  libsystem_c.dylib::__auth_got (REGULAR)
0x1e8ff6ad8-0x1e8ff6b58  libsystem_c.dylib::__auth_ptr (REGULAR)
0x1e8ff6b58-0x1e8ff6c58  libsystem_c.dylib::__const (REGULAR)  {Read-only data}

The Binary Ninja DYLD Shared Cache plugin is aware of the sections and does try to add them but the core API disallows the duplicate named sections. When scrolling through the linear view the data in the duplicate sections is viewable, just not marked as a section.

Are any alternative solutions acceptable?
Probably not, duplicate section names appears to be intended and supported behaviour for executables (at least for Mach-O) so it would make sense for Binary Ninja to accurately reflect that.

Additional Information:
I wasn't sure to whether to file this as a bug or a feature request. It seems the behaviour is intended so I figured this should be a feature request.

@plafosse plafosse added File Format: SharedCache Issue with the dyld_shared_cache plugin State: Awaiting Triage Issue is waiting for more in-depth triage from a developer labels Feb 12, 2025
@plafosse plafosse added this to the Gallifrey milestone Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
File Format: SharedCache Issue with the dyld_shared_cache plugin State: Awaiting Triage Issue is waiting for more in-depth triage from a developer
Projects
None yet
Development

No branches or pull requests

3 participants