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: <59abcb9262e97b76bfdf18d6de71c15eb2af8a6e.camel@debian.org>
Date: Wed, 23 Jul 2025 22:20:35 +0200
From: Ben Hutchings <benh@...ian.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] bootconfig: Fix unaligned access when building footer

On Thu, 2025-07-24 at 00:37 +0900, Masami Hiramatsu wrote:
> On Wed, 23 Jul 2025 12:49:25 +0200
> Ben Hutchings <benh@...ian.org> wrote:
[...]
> >  static int apply_xbc(const char *path, const char *xbc_path)
> >  {
> > -	char *buf, *data, *p;
> > +	struct {
> > +		uint32_t size;
> > +		uint32_t csum;
> > +		char magic[BOOTCONFIG_MAGIC_LEN];
> > +	} footer;
> 
> Don't we need __attribute__((__packed__)) for the footer?

I don't see any reason for there to be padding in this structure, since
it has an alignment of 4 and the size of each member is a multiple of 4.

I included an assertion that there is no padding:

[...]
> > +	memcpy(footer.magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN);
> > +	static_assert(sizeof(footer) == BOOTCONFIG_FOOTER_SIZE);
> > +	memcpy(data + size, &footer, BOOTCONFIG_FOOTER_SIZE);
[...]

Ben.

-- 
Ben Hutchings - Debian developer, member of kernel, installer and LTS
teams

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ