Skip to content

Fix mmap logic on MAP_FIXED#979

Merged
xwings merged 1 commit intoqilingframework:devfrom
bet4it:mmap
Nov 13, 2021
Merged

Fix mmap logic on MAP_FIXED#979
xwings merged 1 commit intoqilingframework:devfrom
bet4it:mmap

Conversation

@bet4it
Copy link
Contributor

@bet4it bet4it commented Nov 3, 2021

Checklist

Which kind of PR do you create?

  • This PR only contains minor fixes.
  • This PR contains major feature update.
  • This PR introduces a new function/api for Qiling Framework.

Coding convention?

  • The new code conforms to Qiling Framework naming convention.
  • The imports are arranged properly.
  • Essential comments are added.
  • The reference of the new code is pointed out.

Extra tests?

  • No extra tests are needed for this PR.
  • I have added enough tests for this PR.
  • Tests will be added after some discussion and review.

Changelog?

  • This PR doesn't need to update Changelog.
  • Changelog will be updated after some proper review.
  • Changelog has been updated in my PR.

Target branch?

  • The target branch is dev branch.

One last thing


If addr is NULL, then the kernel chooses the (page-aligned) address at which to create the mapping; this is the most portable method of creating a new mapping. If addr is not NULL, then the kernel takes it as a hint about where to place the mapping; on Linux, the kernel will pick a nearby page boundary (but always above or equal to the value specified by /proc/sys/vm/mmap_min_addr) and attempt to create the mapping there. If another mapping already exists there, the kernel picks a new address that may or may not depend on the hint. The address of the new mapping is returned as the result of the call.

If addr is not NULL, we need to map on this address even if MAP_FIXED is not set, except this address is already mapped.

@cla7aye15I4nd
Copy link
Member

may be you can provide some test?

@bet4it
Copy link
Contributor Author

bet4it commented Nov 7, 2021

I can't find any existing tests about mmap😅
And mmap is used in almost all programs, so we can test it base on the real usage of it.
I will send a PR of a realworld program which will trigger this bug lately. ( hope in this year😅 )

@xwings
Copy link
Member

xwings commented Nov 10, 2021

cool, waiting :)

@bet4it
Copy link
Contributor Author

bet4it commented Nov 10, 2021

That will be another PR, hope this can be merged.

@xwings
Copy link
Member

xwings commented Nov 10, 2021

will you be able to solve the conflict?

@bet4it
Copy link
Contributor Author

bet4it commented Nov 13, 2021

@xwings Done

@xwings xwings merged commit c44dbae into qilingframework:dev Nov 13, 2021
@bet4it bet4it deleted the mmap branch November 13, 2021 12:02
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

Successfully merging this pull request may close these issues.

3 participants