Linux Modules
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Tobias Stoeckmann <tobias@stoeckmann.org>
Cc: mcgrof@kernel.org, linux-modules@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module: .strtab must be null terminated
Date: Sat, 19 Oct 2024 18:25:25 +0300	[thread overview]
Message-ID: <abafecde-06b4-46ae-9249-2584f6610763@p183> (raw)

> +	strhdr = &info->sechdrs[info->index.str];
> +	if (strhdr->sh_size > 0 && info->strtab[strhdr->sh_size - 1] != '\0') {
> +		pr_err("module %s: string table isn't null terminated\n",
> +		       info->name ?: "(missing .modinfo section or name field)");
> +		goto no_exec;
> +	}

Reviewed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

The _very_ correct test is "there must be NUL between last index used
and the end of the section somewhere".

.shstrtab has the same overly restrictive test:

	if (info->secstrings[strhdr->sh_size - 1] != '\0') {

But, of course, it doesn't matter in practice.

             reply	other threads:[~2024-10-19 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-19 15:25 Alexey Dobriyan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-10-19 14:14 [PATCH] module: .strtab must be null terminated Tobias Stoeckmann
2024-10-21 19:54 ` Luis Chamberlain

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=abafecde-06b4-46ae-9249-2584f6610763@p183 \
    --to=adobriyan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=tobias@stoeckmann.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox