lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070626105602.8bae494b.randy.dunlap@oracle.com>
Date:	Tue, 26 Jun 2007 10:56:02 -0700
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	"Julio M. Merino Vidal" <jmerino@...upc.edu>
Cc:	Arne Georg Gleditsch <argggh@...phinics.no>,
	Oleg Verych <olecom@...wer.upol.cz>, Andi Kleen <ak@...e.de>,
	lkml <linux-kernel@...r.kernel.org>, <akpm@...ux-foundation.org>
Subject: Re: NAK (bashizm in the /bin/sh script): [PATCH v3]
 doc/oops-tracing: add Code: decode info

On Tue, 26 Jun 2007 19:25:00 +0200 Julio M. Merino Vidal wrote:

> On 26/06/2007, at 19:19, Randy Dunlap wrote:
> >
> > Are these 2 line changes all that is needed?
> >
> > I sort of expected expressions like $((a + 2)) to need change also...
> > maybe not for dash, but for sh?
> 
> The correct expression could be $((${a} + 2)).  Tested under NetBSD's  
> sh, which is very POSIX-compliant.

Thanks.  Does anyone see other changes that are needed?


The diff currently looks like:

--- decodecode.~3~	2007-06-22 13:25:39.000000000 -0700
+++ decodecode	2007-06-26 10:40:28.000000000 -0700
@@ -28,7 +28,7 @@
 fi
 
 if [ $marker -ne 0 ]; then
-	beforemark=${code:0:$((marker - 1))}
+	beforemark=`echo "$code" | cut -c-$((${marker} - 1))`
 	echo -n "	.byte 0x" > $T.s
 	echo $beforemark | sed -e 's/ /,0x/g' >> $T.s
 	as -o $T.o $T.s
@@ -36,7 +36,7 @@
 	rm $T.o $T.s
 
 # and fix code at-and-after marker
-	code=${code:$marker}
+	code=`echo "$code" | cut -c$((${marker} + 1))-`
 fi
 
 code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'`




and the complete script is:

#!/bin/sh
# Disassemble the Code: line in Linux oopses
# usage: decodecode < oops.file

T=`mktemp`
code=

while read i ; do

case "$i" in
*Code:*)
	code=$i
	;;
esac

done

if [ -z "$code" ]; then
	exit
fi

echo $code
code=`echo $code | sed -e 's/.*Code: //'`

marker=`expr index "$code" "\<"`
if [ $marker -eq 0 ]; then
	marker=`expr index "$code" "\("`
fi

if [ $marker -ne 0 ]; then
	beforemark=`echo "$code" | cut -c-$((${marker} - 1))`
	echo -n "	.byte 0x" > $T.s
	echo $beforemark | sed -e 's/ /,0x/g' >> $T.s
	as -o $T.o $T.s
	objdump -S $T.o
	rm $T.o $T.s

# and fix code at-and-after marker
	code=`echo "$code" | cut -c$((${marker} + 1))-`
fi

code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g'`
echo -n "	.byte 0x" > $T.s
echo $code >> $T.s
as -o $T.o $T.s
objdump -S $T.o
rm $T.o $T.s
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ