All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v10 3/3] coredump02: Verify ELF structure and notes
Date: Thu, 10 Sep 2026 11:14:36 +0000	[thread overview]
Message-ID: <6aa2911d.1f4fdde7.c7afd.7a6b@mx.google.com> (raw)
In-Reply-To: <aqKEqxlsRHagH-z-@yuki.lan>

Hi Cyril,

> Hi!
> > +static void handle_note(uint32_t type, const void *desc, size_t descsz, pid_t pid)
> > +{
> > +	if (type == NT_PRPSINFO && descsz >= sizeof(struct elf_prpsinfo)) {
> > +		struct elf_prpsinfo info;
> > +
> > +		memcpy(&info, desc, sizeof(info));
> > +		TST_EXP_EQ_STR(info.pr_fname, "coredump02");
> 
> I still do not see a reason why this can't be:
> 
> 		struct elf_prpsinfo *info = desc;
> 
> 		TST_EXP_EQ_STR(info->pr_name, "coredump02");

because ELF notes in Linux are only 4-byte padded, desc pointers are not
guaranteed to be 8-byte aligned. Casting desc to struct elf_prpsinfo *
or struct elf_prstatus * creates a misaligned pointer, which is undefined
behavior in C.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-09-10 11:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 12:07 [LTP] [PATCH v10 0/3] coredump testing suite Andrea Cervesato
2026-09-09 12:07 ` [LTP] [PATCH v10 1/3] lib: Add SAFE_FILE_VPRINTF() Andrea Cervesato
2026-09-09 13:40   ` [LTP] " linuxtestproject.agent
2026-09-09 12:07 ` [LTP] [PATCH v10 2/3] coredump01: New core_pattern specifiers test Andrea Cervesato
2026-09-09 12:07 ` [LTP] [PATCH v10 3/3] coredump02: Verify ELF structure and notes Andrea Cervesato
2026-09-10 10:21   ` Cyril Hrubis
2026-09-10 11:14     ` Andrea Cervesato via ltp [this message]
2026-09-10 12:47       ` Cyril Hrubis
2026-09-10 13:00         ` Andrea Cervesato via ltp
2026-09-10 13:02           ` Cyril Hrubis
2026-09-10 13:26             ` Andrea Cervesato via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6aa2911d.1f4fdde7.c7afd.7a6b@mx.google.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=chrubis@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.