* [PATCH] scripts/mksysmap: Fix badly escaped '$'
@ 2023-06-06 17:35 Pierre-Clément Tosi
2023-06-07 12:26 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Clément Tosi @ 2023-06-06 17:35 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada, Nick Desaulniers, ptosi
The backslash characters escaping '$' in the command to sed (intended to
prevent it from interpreting '$' as "end-of-line") are currently being
consumed by the Shell (where they mean that sh should not evaluate what
follows '$' as a variable name). This means that
sed -e "/ \$/d"
executes the script
/ $/d
instead of the intended
/ \$/d
So escape twice in mksysmap any '$' that actually needs to reach sed
escaped so that the backslash survives the Shell.
Fixes: c4802044a0a7 ("scripts/mksysmap: use sed with in-line comments")
Fixes: 320e7c9d4494 ("scripts/kallsyms: move compiler-generated symbol patterns to mksysmap")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
---
scripts/mksysmap | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/mksysmap b/scripts/mksysmap
index cb3b1fff3eee..ec3338526102 100755
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -32,7 +32,7 @@ ${NM} -n ${1} | sed >${2} -e "
# (do not forget a space before each pattern)
# local symbols for ARM, MIPS, etc.
-/ \$/d
+/ \\$/d
# local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc.
/ \.L/d
@@ -41,7 +41,7 @@ ${NM} -n ${1} | sed >${2} -e "
/ __efistub_/d
# arm64 local symbols in non-VHE KVM namespace
-/ __kvm_nvhe_\$/d
+/ __kvm_nvhe_\\$/d
/ __kvm_nvhe_\.L/d
# arm64 lld
--
2.41.0.rc0.172.g3f132b7071-goog
--
Pierre
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] scripts/mksysmap: Fix badly escaped '$'
2023-06-06 17:35 [PATCH] scripts/mksysmap: Fix badly escaped '$' Pierre-Clément Tosi
@ 2023-06-07 12:26 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2023-06-07 12:26 UTC (permalink / raw)
To: Pierre-Clément Tosi; +Cc: linux-kbuild, linux-kernel, Nick Desaulniers
On Wed, Jun 7, 2023 at 2:36 AM Pierre-Clément Tosi <ptosi@google.com> wrote:
>
> The backslash characters escaping '$' in the command to sed (intended to
> prevent it from interpreting '$' as "end-of-line") are currently being
> consumed by the Shell (where they mean that sh should not evaluate what
> follows '$' as a variable name). This means that
>
> sed -e "/ \$/d"
>
> executes the script
>
> / $/d
>
> instead of the intended
>
> / \$/d
>
> So escape twice in mksysmap any '$' that actually needs to reach sed
> escaped so that the backslash survives the Shell.
You are right. Thanks for catching this bug.
Applied to linux-kbuild. Thanks.
>
> Fixes: c4802044a0a7 ("scripts/mksysmap: use sed with in-line comments")
> Fixes: 320e7c9d4494 ("scripts/kallsyms: move compiler-generated symbol patterns to mksysmap")
> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
> ---
> scripts/mksysmap | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/mksysmap b/scripts/mksysmap
> index cb3b1fff3eee..ec3338526102 100755
> --- a/scripts/mksysmap
> +++ b/scripts/mksysmap
> @@ -32,7 +32,7 @@ ${NM} -n ${1} | sed >${2} -e "
> # (do not forget a space before each pattern)
>
> # local symbols for ARM, MIPS, etc.
> -/ \$/d
> +/ \\$/d
>
> # local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc.
> / \.L/d
> @@ -41,7 +41,7 @@ ${NM} -n ${1} | sed >${2} -e "
> / __efistub_/d
>
> # arm64 local symbols in non-VHE KVM namespace
> -/ __kvm_nvhe_\$/d
> +/ __kvm_nvhe_\\$/d
> / __kvm_nvhe_\.L/d
>
> # arm64 lld
> --
> 2.41.0.rc0.172.g3f132b7071-goog
>
>
> --
> Pierre
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-07 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 17:35 [PATCH] scripts/mksysmap: Fix badly escaped '$' Pierre-Clément Tosi
2023-06-07 12:26 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®