[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dfffd3ab-d607-9b1f-92a5-24a798807849@rivosinc.com>
Date: Tue, 10 Jan 2023 14:16:58 -0800
From: Vineet Gupta <vineetg@...osinc.com>
To: Conor Dooley <conor@...nel.org>
Cc: linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
palmer@...osinc.com, Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Eric Biederman <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>, Guo Ren <guoren@...nel.org>,
Greentime Hu <greentime.hu@...ive.com>,
Conor Dooley <conor.dooley@...rochip.com>, linux@...osinc.com,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] riscv: elf: add .riscv.attributes parsing
On 1/10/23 14:04, Conor Dooley wrote:
> Hey Vineet,
>
> While you're at it with Jess' concerns, couple nitpicks for you.
> May as well say them now rather than while a v2 comes around.
Thx for quick peek.
> On Tue, Jan 10, 2023 at 12:18:41PM -0800, Vineet Gupta wrote:
>
>> Reported-by: kernel test robot <lkp@...el.com> # code under CONFIG_COMPAT
> You can drop this, even if it reported against a private branch AFAIU,
> just like its complaints about patches. As Greg would say, LKP didn't
> report a feature!
OK. Personally I tend to add Tested-by (vs. Reported-by for the same
reasons) to still give them the credit for finding some issue.
I can certainly drop it.
>
>> diff --git a/arch/riscv/kernel/elf-attr.c b/arch/riscv/kernel/elf-attr.c
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (C) 2023-24 Rivos Inc.
> s/-24//
Fixed.
>
>> +static u64
>> +decode_uleb128(unsigned char **dpp)
> Surely that fits inside 80?
Fixed.
>> +static int rv_parse_elf_attributes(struct file *f, const struct elf_phdr *phdr,
>> + struct arch_elf_state *state)
>> +{
>> + unsigned char buf[RV_ATTR_SEC_SZ];
>> + unsigned char *p;
>> + ssize_t n;
>> + int ret = 0;
>> + loff_t pos;
>> +
>> + pr_debug("Section .riscv.attributes found\n");
>> +
>> + /* Assume a reasonable size for now */
>> + if (phdr->p_filesz > sizeof(buf))
>> + return -ENOEXEC;
>> +
>> + memset(buf, 0, RV_ATTR_SEC_SZ);
>> + pos = phdr->p_offset;
>> + n = kernel_read(f, &buf, phdr->p_filesz, &pos);
>> +
>> + if (n < 0)
>> + return -EIO;
>> +
>> + p = buf;
>> + p++; /* format-version (1B) */
>> +
>> + while ((p - buf) < n) {
>> +
> While I'm already passing through, checkpatch isn't the biggest fan of
> your whitespace after open braces:
>
> https://gist.github.com/conor-pwbot/a572e395763916c7716cab9c870df4f3
I swear this patch was checkpatch clean. Fixed now anyways.
>
>> + unsigned char *vendor_start;
>> + u32 len;
>> +
>> + /*
>> + * Organized as "vendor" sub-section(s).
>> + * Current only 1 specified "riscv"
> Is it worth having a comment like this that may rapidly go out of date?
Rapid may be an overstatement given this is a psABI thing. Besides for a
new vendor subsection, more code will need to be added to sanity check etc.
But I can drop this from comment and instead mention this in the changelog.
Thx,
-Vineet
Powered by blists - more mailing lists