[PATCH 0/1] tricore: fixed faulty conditions for extr and imask

David Brenken posted 1 patch 3 years, 2 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210210082650.5516-1-david.brenken@efs-auto.org
Maintainers: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
There is a newer version of this series
target/tricore/translate.c | 37 ++++++++++---------------------------
1 file changed, 10 insertions(+), 27 deletions(-)
[PATCH 0/1] tricore: fixed faulty conditions for extr and imask
Posted by David Brenken 3 years, 2 months ago
From: Andreas Konopik <andreas.konopik@efs-auto.de>

Hello together,

we have fixed a few conditions leading to incorrect intermediate code
generation. RCPW_IMASK, RRPW_EXTR, RRPW_EXTR_U and RRPW_IMASK invoke
undefined behavior for "pos + width > 32", which is also checked in
tcg_gen_extract_tl(). RRRW_EXTR_U invokes undefined behavior for
"width == 0", hence we removed that condition.

Andreas Konopik (1):
  tricore: fixed faulty conditions for extr and imask

 target/tricore/translate.c | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

-- 
2.30.0


Re: [PATCH 0/1] tricore: fixed faulty conditions for extr and imask
Posted by Richard Henderson 3 years, 2 months ago
On 2/10/21 12:26 AM, David Brenken wrote:
> From: Andreas Konopik <andreas.konopik@efs-auto.de>
> 
> Hello together,
> 
> we have fixed a few conditions leading to incorrect intermediate code
> generation. RCPW_IMASK, RRPW_EXTR, RRPW_EXTR_U and RRPW_IMASK invoke
> undefined behavior for "pos + width > 32", which is also checked in
> tcg_gen_extract_tl(). RRRW_EXTR_U invokes undefined behavior for
> "width == 0", hence we removed that condition.

This is incorrect, because "undefined behavior" should not include a qemu abort.

You could raise a guest exception, you could treat the faulty instruction as a
nop, you could truncate the inputs to avoid the abort, you could write
0xdeadbeef to the destination.

Or you could fix the couple of faulty conditions and leave the rest of the code
as-is.


r~

RE: [PATCH 0/1] tricore: fixed faulty conditions for extr and imask
Posted by Konopik, Andreas (EFS-GH2) 3 years, 2 months ago
Hi Richard,

thank you for your feedback.

> From: Richard Henderson <richard.henderson@linaro.org>
> Sent: Wednesday, February 10, 2021 20:02
> To: David Brenken <david.brenken@efs-auto.org> 
> On 2/10/21 12:26 AM, David Brenken wrote:
> > From: Andreas Konopik <andreas.konopik@efs-auto.de>
> >
> > Hello together,
> >
> > we have fixed a few conditions leading to incorrect intermediate code
> > generation. RCPW_IMASK, RRPW_EXTR, RRPW_EXTR_U and RRPW_IMASK
> invoke
> > undefined behavior for "pos + width > 32", which is also checked in
> > tcg_gen_extract_tl(). RRRW_EXTR_U invokes undefined behavior for
> > "width == 0", hence we removed that condition.
> 
> This is incorrect, because "undefined behavior" should not include a qemu
> abort.

I didn't notice that these checks terminated program execution.

> You could raise a guest exception, you could treat the faulty instruction as a
> nop, you could truncate the inputs to avoid the abort, you could write
> 0xdeadbeef to the destination.
> 
> Or you could fix the couple of faulty conditions and leave the rest of the code
> as-is.

We will submit the patch following your advice as soon as possible.

Kind regards,

Andreas

INTERNAL
Re: [PATCH 0/1] tricore: fixed faulty conditions for extr and imask
Posted by no-reply@patchew.org 3 years, 2 months ago
Patchew URL: https://patchew.org/QEMU/20210210082650.5516-1-david.brenken@efs-auto.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210210082650.5516-1-david.brenken@efs-auto.org
Subject: [PATCH 0/1] tricore: fixed faulty conditions for extr and imask

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
05ead58 tricore: fixed faulty conditions for extr and imask

=== OUTPUT BEGIN ===
ERROR: spaces required around that '-' (ctx:VxV)
#78: FILE: target/tricore/translate.c:8312:
+        tcg_gen_andi_tl(cpu_gpr_d[r4], cpu_gpr_d[r4], ~0u >> (32-width));
                                                                 ^

total: 1 errors, 0 warnings, 60 lines checked

Commit 05ead58660db (tricore: fixed faulty conditions for extr and imask) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210210082650.5516-1-david.brenken@efs-auto.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com