[ldv-project] [PATCH] objtool, x86: Remove unneeded code in special_get_alts()

Alexey Khoroshilov khoroshilov at ispras.ru
Sat Jul 23 22:31:13 MSK 2022


Commit 134ab5bd1883 ("objtool,x86: Replace alternatives with .retpoline_sites")
basically reverts
commit 50e7b4a1a1b2 ("objtool: Skip magical retpoline .altinstr_replacement"),
but it is an incomplete revert. As a result an unreachable code is left in
special_get_alts() that was intended to skip magical special sections.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 134ab5bd1883 ("objtool,x86: Replace alternatives with .retpoline_sites")
Signed-off-by: Alexey Khoroshilov <khoroshilov at ispras.ru>
---
 tools/objtool/special.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index e2223dd91c37..6e84cb4d6774 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -168,8 +168,6 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
 			memset(alt, 0, sizeof(*alt));
 
 			ret = get_alt_entry(elf, entry, sec, idx, alt);
-			if (ret > 0)
-				continue;
 			if (ret < 0)
 				return ret;
 
-- 
2.7.4




More information about the ldv-project mailing list