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

Invalid free on import #173

Closed
nvzoll opened this issue Jun 2, 2021 · 3 comments · Fixed by #212
Closed

Invalid free on import #173

nvzoll opened this issue Jun 2, 2021 · 3 comments · Fixed by #212

Comments

@nvzoll
Copy link

nvzoll commented Jun 2, 2021

Build environment: Linux Mint 20, gcc 9.3.0
Revision: cff88dd

>./efivar -n <GUID-Name> -e var.bin
> ./efivar -i var.bin
free(): invalid pointer
[1]    2482 abort (core dumped)    ./efivar -i var.bin

From what I understand, this free tries to free the memory allocated with mmap here.

@frozencemetery
Copy link
Member

Links are very dead at this point. Does this still happen, and if so can you point at where the code is (by functionname)?

@nvzoll
Copy link
Author

nvzoll commented Apr 1, 2022

Sorry, here are the links on the particular commit.
This free:

free(data);

tries to free the memory allocated with mmap here:
buf = mmap(NULL, buflen, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0);

@frozencemetery
Copy link
Member

free(data) in main() IMPORT non-EXPORT case.

Allocation the mmap() in prepare_data().

rpurdie pushed a commit to yoctoproject/poky that referenced this issue Jul 23, 2022
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

(From OE-Core rev: 27f263a)

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Jul 23, 2022
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this issue Aug 4, 2022
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 27f263a)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
splitice pushed a commit to HalleyAssist/poky that referenced this issue Aug 4, 2022
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

(From OE-Core rev: 7d63a9d4f482276a4431c47cc4407ac2ad855b42)

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 27f263a9c69b711f39287c0dc8970ad41758fbb9)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

(From OE-Core rev: 27f263a9c69b711f39287c0dc8970ad41758fbb9)

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
"efivar --import" is broken in v38:

 # efivar -i /8be4df61-93ca-11d2-aa0d-00e098032b8c-Timeout
free(): invalid pointer
Aborted

Backport upstream patch to fix it.

Upstream issue:
rhboot/efivar#173

(From OE-Core rev: 27f263a9c69b711f39287c0dc8970ad41758fbb9)

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 a pull request may close this issue.

2 participants