From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Roger Pau Monne <roger.pau@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org,
Stefano Stabellini <sstabellini@kernel.org>,
consulting@bugseng.com
Subject: Re: [PATCH v2 1/2] x86/uaccess: rework user access speculative harden guards
Date: Wed, 27 Nov 2024 12:01:55 +0100 [thread overview]
Message-ID: <e3ec3dad28dc94436c0b330b2f995120@bugseng.com> (raw)
In-Reply-To: <cf1f87d1-f616-4944-94fa-69a777249072@suse.com>
On 2024-11-26 10:58, Jan Beulich wrote:
> On 26.11.2024 10:35, Roger Pau Monne wrote:
>> The current guards to select whether user accesses should be
>> speculative
>> hardened violate Misra rule 20.7, as the UA_KEEP() macro doesn't (and
>> can't)
>> parenthesize the 'args' argument.
>
> For my own education: This definitely isn't the only place where we use
> a
> macro with variable arguments, and where the use of the respective
> macro
> parameter can't be parenthesized. Given patch 2, why is e.g.
>
> #define emulate_fpu_insn_stub(bytes...)
> \
> do {
> \
> unsigned int nr_ = sizeof((uint8_t[]){ bytes });
> \
> memcpy(get_stub(stub), ((uint8_t[]){ bytes, 0xc3 }), nr_ + 1);
> \
> invoke_stub("", "", "=m" (dummy) : "i" (0));
> \
> put_stub(stub);
> \
> } while (0)
>
> not an issue? The first use of "bytes" is in figure braces, so probably
> fine. Yet the second use is followed by a comma, so unlikely to be
> okay.
>
I didn't look at it in detail, but if bytes is expanded inside an
initialization list, the configuration allows it iirc. I'll need to
double check, though.
> Somewhat similarly for
>
> #define AMD_OSVW_ERRATUM(osvw_id, ...) osvw_id, __VA_ARGS__, 0
>
> where we're using the C99 form rather than the GNU extension, and where
> hence __VA_ARGS__ would - by extrapolation of the Misra rule - need
> parenthesizing, when it isn't and can't be.
>
> Isn't it rather the case that variable argument macros need a more
> general
> deviation, if not an adjustment to the Misra rule? Extending the Cc
> list
> some ...
>
> Jan
--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)
next prev parent reply other threads:[~2024-11-27 11:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-26 9:35 [PATCH v2 0/2] x86/misra: fix remaining violation of rule 20.7 Roger Pau Monne
2024-11-26 9:35 ` [PATCH v2 1/2] x86/uaccess: rework user access speculative harden guards Roger Pau Monne
2024-11-26 9:58 ` Jan Beulich
2024-11-27 11:01 ` Nicola Vetrini [this message]
2025-01-04 0:20 ` Stefano Stabellini
2025-01-09 7:58 ` Nicola Vetrini
2025-01-09 23:57 ` Stefano Stabellini
2025-01-10 8:29 ` Roger Pau Monné
2025-01-10 8:56 ` Nicola Vetrini
2025-01-14 8:03 ` Nicola Vetrini
2024-11-26 9:35 ` [PATCH v2 2/2] automation/eclair: make Misra rule 20.7 blocking for x86 also Roger Pau Monne
2025-01-14 11:22 ` Roger Pau Monné
2025-01-14 11:24 ` Nicola Vetrini
2025-01-14 11:39 ` Roger Pau Monné
2025-01-14 11:51 ` Oleksii Kurochko
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=e3ec3dad28dc94436c0b330b2f995120@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=andrew.cooper3@citrix.com \
--cc=consulting@bugseng.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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 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.