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, 2 Jan 2020 12:06:04 +0100
From:   Pali Rohár <pali.rohar@...il.com>
To:     Namjae Jeon <namjae.jeon@...sung.com>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        gregkh@...uxfoundation.org, valdis.kletnieks@...edu, hch@....de,
        sj1557.seo@...sung.com, linkinjeon@...il.com
Subject: Re: [PATCH v8 01/13] exfat: add in-memory and on-disk structures and
 headers

Hello, just remainder for question below, so it would not be lost.

I guess that if comment for structure says that it needs to have exact
size then structure should be marked as packed to prevent any unexpected
paddings added by compiler (as IIRC compiler is free to add any padding
between any structure members).

On Sunday 29 December 2019 15:11:08 Pali Rohár wrote:
> On Friday 20 December 2019 01:24:07 Namjae Jeon wrote:
> > +
> > +#define JUMP_BOOT_LEN			3
> > +#define OEM_NAME_LEN			8
> > +#define MUST_BE_ZERO_LEN		53
> > +#define EXFAT_FILE_NAME_LEN		15
> > +
> > +/* EXFAT BIOS parameter block (64 bytes) */
> > +struct bpb64 {
> > +	__u8 jmp_boot[JUMP_BOOT_LEN];
> > +	__u8 oem_name[OEM_NAME_LEN];
> > +	__u8 res_zero[MUST_BE_ZERO_LEN];
> > +};
> > +
> > +/* EXFAT EXTEND BIOS parameter block (56 bytes) */
> > +struct bsx64 {
> > +	__le64 vol_offset;
> > +	__le64 vol_length;
> > +	__le32 fat_offset;
> > +	__le32 fat_length;
> > +	__le32 clu_offset;
> > +	__le32 clu_count;
> > +	__le32 root_cluster;
> > +	__le32 vol_serial;
> > +	__u8 fs_version[2];
> > +	__le16 vol_flags;
> > +	__u8 sect_size_bits;
> > +	__u8 sect_per_clus_bits;
> > +	__u8 num_fats;
> > +	__u8 phy_drv_no;
> > +	__u8 perc_in_use;
> > +	__u8 reserved2[7];
> > +};
> 
> Should not be this structure marked as packed? Also those two below.
> 
> > +/* EXFAT PBR[BPB+BSX] (120 bytes) */
> > +struct pbr64 {
> > +	struct bpb64 bpb;
> > +	struct bsx64 bsx;
> > +};
> > +
> > +/* Common PBR[Partition Boot Record] (512 bytes) */
> > +struct pbr {
> > +	union {
> > +		__u8 raw[64];
> > +		struct bpb64 f64;
> > +	} bpb;
> > +	union {
> > +		__u8 raw[56];
> > +		struct bsx64 f64;
> > +	} bsx;
> > +	__u8 boot_code[390];
> > +	__le16 signature;
> > +};
> 

-- 
Pali Rohár
pali.rohar@...il.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ