[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e37ff5de-f34c-bd86-be04-a21f82612a7e@redhat.com>
Date: Fri, 31 Mar 2023 11:58:20 -0400
From: Joe Lawrence <joe.lawrence@...hat.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, Josh Poimboeuf <jpoimboe@...nel.org>,
Miroslav Benes <mbenes@...e.cz>,
Petr Mladek <pmladek@...e.com>,
Marcos Paulo de Souza <mpdesouza@...e.com>
Subject: Re: [PATCH v7 00/10] livepatch: klp-convert tool
On 3/30/23 08:10, Alexey Dobriyan wrote:
> 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 (?).
>
Thanks, will incorporate these into the next version.
--
Joe
Powered by blists - more mailing lists