public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>,
	Marcos Paulo de Souza <mpdesouza@suse.com>
Subject: Re: [PATCH v7 00/10] livepatch: klp-convert tool
Date: Thu, 30 Mar 2023 15:10:03 +0300	[thread overview]
Message-ID: <4ce29654-4e1e-4680-9c25-715823ff5e02@p183> (raw)

Joe Lawrence wrote:
> +static int update_strtab(struct elf *elf)
> +{
>
> +	buf = malloc(new_size);
> +	if (!buf) {
> +		WARN("malloc failed");
> +		return -1;
> +	}
> +	memcpy(buf, (void *)strtab->data, orig_size);

This code is called realloc(). :-)

> +static int write_file(struct elf *elf, const char *file)
> +{
>
> +	fd = creat(file, 0664);
> +	e = elf_begin(fd, ELF_C_WRITE, NULL);

elf_end() doesn't close descriptor, so there is potentially corrupted
data. There is no unlink() call if writes fail as well.

> +void elf_close(struct elf *elf)
> +{
> +
> +	if (elf->fd > 0)
> +		close(elf->fd);

Techically, it is "fd >= 0".

> +filechk_klp_map = \
> +	echo "klp-convert-symbol-data.0.1";		\
> +	echo "*vmlinux";				\
> +	$(NM) -f posix vmlinux | cut -d\  -f1;		\
> +	sort $(MODORDER) $(MODULES_LIVEPATCH) |		\

This probably should be "LC_ALL=C sort" for speed and reproducibility (?).

             reply	other threads:[~2023-03-30 12:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 12:10 Alexey Dobriyan [this message]
2023-03-30 17:04 ` [PATCH v7 00/10] livepatch: klp-convert tool Alexey Dobriyan
2023-03-31 16:03   ` Joe Lawrence
2023-04-01  9:59     ` Alexey Dobriyan
2023-03-31 15:58 ` Joe Lawrence
  -- strict thread matches above, loose matches on Subject: below --
2023-03-06 14:08 Joe Lawrence
2023-03-14 20:23 ` Marcos Paulo de Souza
2023-03-17 20:29   ` Joe Lawrence
2023-03-17 23:20     ` Josh Poimboeuf
2023-03-20 19:23       ` Joe Lawrence
2023-04-11 10:06       ` Nicolai Stange
2023-05-02 23:38         ` Marcos Paulo de Souza
2023-05-03 19:54         ` Joe Lawrence
2023-05-09 20:34           ` Marcos Paulo de Souza
2023-03-20 20:15     ` Marcos Paulo de Souza
2023-04-19 20:27 ` Marcos Paulo de Souza

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=4ce29654-4e1e-4680-9c25-715823ff5e02@p183 \
    --to=adobriyan@gmail.com \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mpdesouza@suse.com \
    --cc=pmladek@suse.com \
    /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