mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3662] free(): invalid pointer with --ip=dhcp #2306
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2306
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kris7t on GitHub (Oct 10, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3662
Originally assigned to: @kris7t on GitHub.
Bug and expected behavior
When running Firejail with
--ip=dhcp, it dumps core after the jailed application exits normally (here/usr/bin/trueis used as an program that exits immediately):The core dump is caused by line 3088 of
firejail/main.c:Seems like we're trying to free a profile line that was already freed:
7fb7e4227e/src/firejail/main.c (L3083-L3093)Oddly enough, I don't have the same crash with
--ip6=dhcp(i.e. use ARP scanning to determine the IPv4 address, but usedhcpcdfor IPv6).According to
git bisect, the commit that introduced the crash is81b2c7aa07.Reproduce
Steps to reproduce the behavior:
firejailwith--ip=dhcp.Environment
Linux 5.8.13-arch1-1 #1 SMP PREEMPT Thu, 01 Oct 2020 20:40:35 +0000 x86_64 GNU/Linux9bf6e0ead189b924e5fca099b35d88be091bd009@kris7t commented on GitHub (Oct 11, 2020):
@netblue30 I have a bit of a hard time understanding this:
f373fe14e5/src/firejail/main.c (L1050-L1057)profile_addtake ownership of its argument? Maybe we'd need something likeprofile_add_dup, which first callsstrdupon its argument and then passes it toprofile_add(lest we try tofreea string literal later when the profile entries are freed).noblacklist /sbinbefore parsing the rest of the arguments? I am on Arch where/sbinand/usr/sbinare just symlinks to/usr/bin, so I can't really test this.--ip6=dhcp? What aboutip dhcpandip6 dhcpin profiles?@rusty-snake commented on GitHub (Oct 12, 2020):
blacklistfollows symliks. Test withfirejail --noprofile --blacklist=/sbin ls -ld /usr/sbin.@netblue30 commented on GitHub (Oct 13, 2020):
The profile free code is 6 years old, the original intent was long lost. We put it in to keep tools like valgrind quiet, but on the way valgind got broken. I commented it out for now, it doesn't make sense in this moment since the sandbox is already closed.