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

Segmentation fault at fixup_reloc #115

Open
tiagoporsch opened this issue Oct 17, 2022 · 3 comments
Open

Segmentation fault at fixup_reloc #115

tiagoporsch opened this issue Oct 17, 2022 · 3 comments

Comments

@tiagoporsch
Copy link

Hello, I'm trying to load a very simple DLL that just contains some string manipulation functions, however when I attempt to run my program it segfaults with

pelinker (fixup_reloc:390): fixup_block=0xf7f4c000, image=0xf7f48000
pelinker (fixup_reloc:391): fixup_block info: 1000 84
Segmentation fault

This is the all the code that runs before the segmentation fault:

struct pe_image image = {
    .entry  = NULL,
    .name   = "engine/SeedNKeyXcp.dll",
};
if (!pe_load_library(image.name, &image.image, &image.size))
    return 1;
link_pe_images(&image, 1);

How could I go about debugging this?
Thank you.

@cube0x8
Copy link
Collaborator

cube0x8 commented Oct 17, 2022 via email

@tiagoporsch
Copy link
Author

Of course. Here it is.
SeedNKeyXcp.zip

@tiagoporsch
Copy link
Author

I've fixed this issue by opening the DLL as O_RDWR and mapping it as PROT_READ | PROT_WRITE, in the function pe_load_library.
However, I don't think this is the correct solution, as a segfault now occurs when I attempt to call a function from this DLL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants