From: tip-bot for Artem Savkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
torvalds@linux-foundation.org, mingo@kernel.org,
tglx@linutronix.de, hpa@zytor.com, jpoimboe@redhat.com,
asavkov@redhat.com
Subject: [tip:core/urgent] objtool: Fix double-free in .cold detection error path
Date: Tue, 20 Nov 2018 10:05:11 -0800 [thread overview]
Message-ID: <tip-0b9301fb632f7111a3293a30cc5b20f1b82ed08d@git.kernel.org> (raw)
In-Reply-To: <beac5a9b7da9e8be90223459dcbe07766ae437dd.1542736240.git.jpoimboe@redhat.com>
Commit-ID: 0b9301fb632f7111a3293a30cc5b20f1b82ed08d
Gitweb: https://git.kernel.org/tip/0b9301fb632f7111a3293a30cc5b20f1b82ed08d
Author: Artem Savkov <asavkov@redhat.com>
AuthorDate: Tue, 20 Nov 2018 11:52:15 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 20 Nov 2018 18:59:00 +0100
objtool: Fix double-free in .cold detection error path
If read_symbols() fails during second list traversal (the one dealing
with ".cold" subfunctions) it frees the symbol, but never deletes it
from the list/hash_table resulting in symbol being freed again in
elf_close(). Fix it by just returning an error, leaving cleanup to
elf_close().
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")
Link: http://lkml.kernel.org/r/beac5a9b7da9e8be90223459dcbe07766ae437dd.1542736240.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/objtool/elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 6dbb9fae0f9d..e7a7ac40e045 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -312,7 +312,7 @@ static int read_symbols(struct elf *elf)
if (!pfunc) {
WARN("%s(): can't find parent function",
sym->name);
- goto err;
+ return -1;
}
sym->pfunc = pfunc;
next prev parent reply other threads:[~2018-11-20 18:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 17:52 [PATCH 0/2] objtool: Fixes in .cold detection logic Josh Poimboeuf
2018-11-20 17:52 ` [PATCH 1/2] objtool: Fix double-free in .cold detection error path Josh Poimboeuf
2018-11-20 18:05 ` tip-bot for Artem Savkov [this message]
2018-11-20 17:52 ` [PATCH 2/2] objtool: Fix seg fault in .cold detection with -ffunction-sections Josh Poimboeuf
2018-11-20 18:05 ` [tip:core/urgent] objtool: Fix segfault " tip-bot for Artem Savkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-0b9301fb632f7111a3293a30cc5b20f1b82ed08d@git.kernel.org \
--to=tipbot@zytor.com \
--cc=asavkov@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).