diff mbox series

[Bionic] UBUNTU: [Packaging] retpoline-extract: flag *0xNNN(%reg) branches

Message ID 20180302075434.GA11600@nxnw.org
State New
Headers show
Series [Bionic] UBUNTU: [Packaging] retpoline-extract: flag *0xNNN(%reg) branches | expand

Commit Message

Steve Beattie March 2, 2018, 7:54 a.m. UTC
UBUNTU: [Packaging] retpoline-extract: flag *0xNNN(%reg) branches

Catch indirect jmps and calls of the form 'jmp  *0xNNNN(%reg)'.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
---
 debian/scripts/retpoline-extract | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Whitcroft March 5, 2018, 12:42 p.m. UTC | #1
On Thu, Mar 01, 2018 at 11:54:34PM -0800, Steve Beattie wrote:
> UBUNTU: [Packaging] retpoline-extract: flag *0xNNN(%reg) branches
> 
> Catch indirect jmps and calls of the form 'jmp  *0xNNNN(%reg)'.
> 
> Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
> ---
>  debian/scripts/retpoline-extract | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/scripts/retpoline-extract b/debian/scripts/retpoline-extract
> index 5baa35e74cc5..83cbc9e50211 100755
> --- a/debian/scripts/retpoline-extract
> +++ b/debian/scripts/retpoline-extract
> @@ -9,6 +9,6 @@ cd "$1" || exit 1
>  awk -F'	' '
>  	/^.\//				{ file=$1; sub(":.*", "", file); sub("^.*/", "", file); }
>  	/^[0-9a-f][0-9a-f]* <.*>:/	{ tag=$1; sub(".*<", "", tag); sub(">.*", "", tag); tag=file " " tag; }
> -	$3 ~ /(call|jmp)q?  *\*%/	{ print(tag " " $3); }
> +	$3 ~ /(call|jmp)q?  *\*(0x[a-f0-9]+\()?%/	{ print(tag " " $3); }
>  ' | \
>  	grep -v " \*%cs:0x"		# elide 32bit code-segment absolute offsets.
> -- 
> 2.15.1
> 
> -- 
> Steve Beattie
> <sbeattie@ubuntu.com>
> http://NxNW.org/~steve/

Good catch.

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Seth Forshee March 5, 2018, 1:23 p.m. UTC | #2
On Thu, Mar 01, 2018 at 11:54:34PM -0800, Steve Beattie wrote:
> UBUNTU: [Packaging] retpoline-extract: flag *0xNNN(%reg) branches
> 
> Catch indirect jmps and calls of the form 'jmp  *0xNNNN(%reg)'.
> 
> Signed-off-by: Steve Beattie <steve.beattie@canonical.com>

Applied to bionic/master-next and unstable/master, thanks!
diff mbox series

Patch

diff --git a/debian/scripts/retpoline-extract b/debian/scripts/retpoline-extract
index 5baa35e74cc5..83cbc9e50211 100755
--- a/debian/scripts/retpoline-extract
+++ b/debian/scripts/retpoline-extract
@@ -9,6 +9,6 @@  cd "$1" || exit 1
 awk -F'	' '
 	/^.\//				{ file=$1; sub(":.*", "", file); sub("^.*/", "", file); }
 	/^[0-9a-f][0-9a-f]* <.*>:/	{ tag=$1; sub(".*<", "", tag); sub(">.*", "", tag); tag=file " " tag; }
-	$3 ~ /(call|jmp)q?  *\*%/	{ print(tag " " $3); }
+	$3 ~ /(call|jmp)q?  *\*(0x[a-f0-9]+\()?%/	{ print(tag " " $3); }
 ' | \
 	grep -v " \*%cs:0x"		# elide 32bit code-segment absolute offsets.