UPSTREAM: objtool: Preserve special st_shndx indexes in elf_update_symbol

elf_update_symbol fails to preserve the special st_shndx values
between [SHN_LORESERVE, SHN_HIRESERVE], which results in it
converting SHN_ABS entries into SHN_UNDEF, for example. Explicitly
check for the special indexes and ensure these symbols are not
marked undefined.

Fixes: ead165fa1042 ("objtool: Fix symbol creation")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220908215504.3686827-17-samitolvanen@google.com
(cherry picked from commit 5141d3a06b2da1731ac82091298b766a1f95d3d8)

BUG=None
TEST=None

Signed-off-by: Linux Patches Robot <linux-patches-robot@chromeos-missing-patches.google.com.iam.gserviceaccount.com>
Change-Id: Ifb2d1193b6dd2805f636116587be177ed7b7ed7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3933952
Commit-Queue: Tzung-Bi Shih <tzungbi@chromium.org>
Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org>
Tested-by: Tzung-Bi Shih <tzungbi@chromium.org>
1 file changed