-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kpatch-build: remove localentry data from ppc64le symtab #973
kpatch-build: remove localentry data from ppc64le symtab #973
Conversation
joe-lawrence
commented
Jun 11, 2019
Hey @kamalesh-babulal ... I stumbled upon this when testing out a simple demo.patch.txt on RHEL-8.1. The error I got was:
and I noticed that the localentry data was in a different column:
This PR is very lightly tested, but let me know what you think of the change. |
kpatch-build/kpatch-build
Outdated
@@ -846,6 +846,9 @@ for i in $FILES; do | |||
fi | |||
|
|||
readelf -s --wide "$KOBJFILE_PATH" > "$SYMTAB" | |||
if [[ "$ARCH" = "ppc64le" ]]; then | |||
sed -i 's/\[<localentry>: 8\]//' "$SYMTAB" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sed -i 's/\[<localentry>: 8\]//' "$SYMTAB" | |
sed -ri 's/\s+\[<localentry>: 8\]//' "$SYMTAB" |
I think we might want to eat up preceding whitespaces as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the extra whitespace tab... I wasn't sure how to handle both RHEL-8 and @kamalesh-babulal 's originally reported format cases. One uses \t[<localentry>: 8\]
and the other (I think) [<localentry>: 8\]\t
. Can you think of a regex that handles both cases without concatenating columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only handling preceding tab case should be enough since we will never have [<localentry>: 8]
at the beginning of the line.
I tried reading the symtab using the readelf shipped with RHEL-8.1 and upstream readelf
Looks like some custom patch is breaking the order on RHEL. I liked the idea of the patch. |
commit f8213c8 ("lookup: Fix format string for symtab_read() on PPC64LE") fixed the symbol table lookup when readelf adds ppc64le "[<localentry>: 8]" info for functions like so: 23: 0000000000000008 96 FUNC LOCAL DEFAULT [<localentry>: 8] 4 cmdline_proc_show however, it seems that readelf 2.30-57.el8 displays this in a slightly different format: 24493: c000000000587970 96 FUNC LOCAL DEFAULT 2 cmdline_proc_show [<localentry>: 8] Instead of adding more cases to kpatch-build's lookup.c scanf format, let's just delete this information from the symtab file with a quick and dirty sed regex. This allows us to handle both observed cases (and perhaps others) while removing the arch-specific scanf formatting in lookup.c Fixes: f8213c8 ("lookup: Fix format string for symtab_read() on PPC64LE") Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
49cd5b9
to
ff78bad
Compare
v2 Also, @kamalesh-babulal was curious about the origins of the RHEL-specific behavior... as far as I can tell it was included with RHEL8's version of binutils (and will be carried forward) to move the "other" symbol information to the end of the line. The intent was to not break old scripts that expect to see readelf symbol format in particular columns.. ahem :) |