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]
Date:	Thu, 12 Dec 2013 14:19:20 +0000
From:	Ian Campbell <Ian.Campbell@...rix.com>
To:	Julien Grall <julien.grall@...aro.org>
CC:	<xen-devel@...ts.xenproject.org>,
	Stefano Stabellini <stefano.stabellini@...citrix.com>,
	<linux-kernel@...r.kernel.org>,
	"David Vrabel" <david.vrabel@...rix.com>, <patches@...aro.org>,
	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	<linux-arm-kernel@...ts.infradead.org>,
	"Roger Pau Monne" <roger.pau@...rix.com>
Subject: Re: [Xen-devel] [PATCH v2] xen/block: Correctly define structures
 in public headers on ARM32 and ARM64

On Tue, 2013-12-03 at 15:40 +0000, Julien Grall wrote:
> On ARM (32 bits and 64 bits), the double-word is 8-bytes aligned. This will
> result on different structure from Xen and Linux repositories.
> 
> As Linux is using __packed__ attribute, it must have a 4-bytes padding before
> each "id" field.
> 
> This change breaks guest block support with older kernel. IMHO, it's acceptable
> because Xen on ARM is still on Tech Preview and the hypercall ABI is not yet
> freezed.
> 
> Only one architecture (x86_32) doesn't have 64-bit ABI for the block interface.
> Don't add padding if Linux is compiled for this architecture.

Konrad asked for confirmation that this didn't change x86.

Using
http://stackoverflow.com/questions/9788679/how-to-get-the-relative-adress-of-a-field-in-a-structure-dump-c

I created offsets.py as described there then for i386, amd64, arm, arm64
before and after I built with CONFIG_DEBUG_INFO but not
CONFIG_DEBUG_INFO_REDUCED then:

        $ cat script
        python
        sys.path.insert(0, '')
        import offsets
        end
        
        offsets-of "struct blkif_request"
        offsets-of "struct blkif_request_rw"
        offsets-of "struct blkif_request_discard"
        offsets-of "struct blkif_request_other"
        offsets-of "struct blkif_request_indirect"
        $ gdb -x script --batch drivers/block/xen-blkfront.o
        struct blkif_request {
            operation => 0
            u => 1
        }
        struct blkif_request_rw {
            nr_segments => 0
            handle => 1
            _pad1 => 3
            id => 7
            sector_number => 15
            seg => 23
        }
        struct blkif_request_discard {
            flag => 0
            _pad1 => 1
            _pad2 => 3
            id => 7
            sector_number => 15
            nr_sectors => 23
            _pad3 => 31
        }
        struct blkif_request_other {
            _pad1 => 0
            _pad2 => 1
            _pad3 => 3
            id => 7
        }
        struct blkif_request_indirect {
            indirect_op => 0
            nr_segments => 1
            _pad1 => 3
            id => 7
            sector_number => 15
            handle => 23
            _pad2 => 25
            indirect_grefs => 27
            _pad3 => 59
        }

There is no difference to either x86 arch:
        $ diff -q x86_32.{before,after} && echo same
        same
        $ diff -q x86_64.{before,after} && echo same
        same
        $
And crucially:
        $ diff -q arm.after arm64.after && echo same
        same
        $ diff -q arm.after x86_64.after && echo same
        same
        $

Full results attached.

Ian.



View attachment "arm.after" of type "text/plain" (624 bytes)

View attachment "arm.before" of type "text/plain" (564 bytes)

View attachment "arm64.after" of type "text/plain" (624 bytes)

View attachment "arm64.before" of type "text/plain" (564 bytes)

View attachment "x86_32.after" of type "text/plain" (564 bytes)

View attachment "x86_32.before" of type "text/plain" (564 bytes)

View attachment "x86_64.after" of type "text/plain" (624 bytes)

View attachment "x86_64.before" of type "text/plain" (625 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ