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

Signature to track memory allocations by wrapper functions #8062

Merged
merged 2 commits into from Oct 15, 2018

Conversation

Projects
None yet
8 participants
@deepikabhavnani
Contributor

deepikabhavnani commented Sep 10, 2018

Description

Compilers allocate some section of memory without using wrapper function, which is later freed when wrappers were initialized. Since the allocate memory didn;t contain wrapper header the pointer got corrupt when calling to free.

This implementation of signature addition during malloc and signature check during free helps in freeing the memory allocated by wrapper functions properly and also the internal memory allocated by compilers (without malloc wrappers).

Resolves: #7912

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

@cmonr cmonr requested review from 0xc0170 and ARMmbed/team-nuvoton and removed request for 0xc0170 Sep 10, 2018

@cmonr cmonr added the needs: review label Sep 10, 2018

@deepikabhavnani deepikabhavnani force-pushed the deepikabhavnani:heap_fix_7912 branch from cf22ce9 to f949892 Sep 11, 2018

@deepikabhavnani

This comment has been minimized.

Contributor

deepikabhavnani commented Sep 12, 2018

@ccli8 @cyliangtw - Please review

@deepikabhavnani deepikabhavnani requested a review from c1728p9 Sep 12, 2018

@ccli8

ccli8 approved these changes Sep 13, 2018

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Sep 24, 2018

@NirSonnenschein

This comment has been minimized.

Contributor

NirSonnenschein commented Oct 3, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Oct 3, 2018

Build : SUCCESS

Build number : 3226
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8062/

Triggering tests

/morph test
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@NirSonnenschein

This comment has been minimized.

Contributor

NirSonnenschein commented Oct 4, 2018

/morph export-build

@mbed-ci

This comment has been minimized.

@deepikabhavnani

This comment has been minimized.

Contributor

deepikabhavnani commented Oct 4, 2018

/morph export-build

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added needs: work and removed needs: CI labels Oct 6, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Oct 6, 2018

Please rebase, will restart testing

deepikabhavnani added some commits Sep 5, 2018

Alignment of 8 is not required for additional header
malloc guarantees aligned memory. If we add an alignment here, we are adding
additonal unused 4 bytes. Each allocator has its own 4/8 byte header
(GGC / ARM have 4 bytes).

So if user request for 8 bytes of memory stats will add 8 + allocator 8.
However if we remove the alignment in stats header, allocator will consider
add 4 bytes to 12 byte request and zero padding.

It will be beneficial to leave the padding to allocator.
Signature to track memory allocations by wrapper functions.
Compilers allocate some section of memory without using wrapper function,
which is later freed when wrappers were initialized. Since the allocated
memory didn;t contain wrapper header the pointer got corrupt when calling to free.

This implementation of signature addition during malloc and signature check during
free helps in freeing the memory allocated by wrapper functions properly and
also the internal memory allocated by compilers (without malloc wrappers).

@deepikabhavnani deepikabhavnani force-pushed the deepikabhavnani:heap_fix_7912 branch from f949892 to 0e75879 Oct 8, 2018

@deepikabhavnani

This comment has been minimized.

Contributor

deepikabhavnani commented Oct 8, 2018

Please rebase, will restart testing

@0xc0170 - Rebase done. Thanks

@cmonr cmonr merged commit 0e75879 into ARMmbed:master Oct 15, 2018

11 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Passed, 652 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 10246 cycles (+1037 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8372B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment