lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240723120741.2448050-1-zhengyejian@huaweicloud.com>
Date: Tue, 23 Jul 2024 20:07:41 +0800
From: Zheng Yejian <zhengyejian@...weicloud.com>
To: kees@...nel.org,
	arnd@...db.de,
	ndesaulniers@...gle.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	ardb@...nel.org,
	boqun.feng@...il.com,
	willy@...radead.org,
	wedsonaf@...gle.com,
	gary@...yguo.net
Cc: zhengyejian@...weicloud.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH] kallsyms: Fix wrong "big" kernel symbol type read from procfs

After commit 73bbb94466fd ("kallsyms: support "big" kernel symbols"),
ULEB128 was used to encode symbol name length. That is, for "big"
kernel symbols of which name length is longer than 0x7f characters,
the length info is encoded into 2 bytes.

kallsyms_get_symbol_type() expects to read the first char of the
symbol name which indicates the symbol type. However, due to the
"big" symbol case not being handled, the symbol type read from
/proc/kallsyms may be wrong, so handle it properly.

Fixes: 73bbb94466fd ("kallsyms: support "big" kernel symbols")
Signed-off-by: Zheng Yejian <zhengyejian@...weicloud.com>
---
 kernel/kallsyms.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 98b9622d372e..5de692ac4c26 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -103,8 +103,11 @@ static char kallsyms_get_symbol_type(unsigned int off)
 {
 	/*
 	 * Get just the first code, look it up in the token table,
-	 * and return the first char from this token.
+	 * and return the first char from this token. If MSB of length
+	 * is 1, it is a "big" symbol, so needs an additional byte.
 	 */
+	if (kallsyms_names[off] & 0x80)
+		off++;
 	return kallsyms_token_table[kallsyms_token_index[kallsyms_names[off + 1]]];
 }
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ