qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue
@ 2024-07-24  1:58 Song Gao
  2024-07-24  2:59 ` Richard Henderson
  2024-07-26 10:12 ` Michael Tokarev
  0 siblings, 2 replies; 4+ messages in thread
From: Song Gao @ 2024-07-24  1:58 UTC (permalink / raw)
  To: qemu-devel, lixianglai, maobibo; +Cc: richard.henderson, peter.maydell, philmd

When the lddir level is 4 and the base is a HugePage, we may try to put value 4
into a field in the TLBENTRY that is only 2 bits wide.

Fixes: Coverity CID 1547717
Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue")
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 target/loongarch/tcg/tlb_helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
index d6331f9b0b..97f38fc391 100644
--- a/target/loongarch/tcg/tlb_helper.c
+++ b/target/loongarch/tcg/tlb_helper.c
@@ -525,6 +525,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,
         if (unlikely(level == 4)) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "Attempted use of level 4 huge page\n");
+            return base;
         }
 
         if (FIELD_EX64(base, TLBENTRY, LEVEL)) {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue
  2024-07-24  1:58 [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue Song Gao
@ 2024-07-24  2:59 ` Richard Henderson
  2024-07-26 10:12 ` Michael Tokarev
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-07-24  2:59 UTC (permalink / raw)
  To: Song Gao, qemu-devel, lixianglai, maobibo; +Cc: peter.maydell, philmd

On 7/24/24 11:58, Song Gao wrote:
> When the lddir level is 4 and the base is a HugePage, we may try to put value 4
> into a field in the TLBENTRY that is only 2 bits wide.
> 
> Fixes: Coverity CID 1547717
> Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue")
> Signed-off-by: Song Gao<gaosong@loongson.cn>
> ---
>   target/loongarch/tcg/tlb_helper.c | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue
  2024-07-24  1:58 [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue Song Gao
  2024-07-24  2:59 ` Richard Henderson
@ 2024-07-26 10:12 ` Michael Tokarev
  2024-07-26 15:11   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2024-07-26 10:12 UTC (permalink / raw)
  To: Song Gao, qemu-devel, lixianglai, maobibo
  Cc: richard.henderson, peter.maydell, philmd, qemu-stable

24.07.2024 04:58, Song Gao wrote:
> When the lddir level is 4 and the base is a HugePage, we may try to put value 4
> into a field in the TLBENTRY that is only 2 bits wide.
> 
> Fixes: Coverity CID 1547717
> Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading issue")
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
>   target/loongarch/tcg/tlb_helper.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c
> index d6331f9b0b..97f38fc391 100644
> --- a/target/loongarch/tcg/tlb_helper.c
> +++ b/target/loongarch/tcg/tlb_helper.c
> @@ -525,6 +525,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base,
>           if (unlikely(level == 4)) {
>               qemu_log_mask(LOG_GUEST_ERROR,
>                             "Attempted use of level 4 huge page\n");
> +            return base;
>           }
>   
>           if (FIELD_EX64(base, TLBENTRY, LEVEL)) {


Is it qemu-stable material (for 9.0.x series)?

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue
  2024-07-26 10:12 ` Michael Tokarev
@ 2024-07-26 15:11   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-26 15:11 UTC (permalink / raw)
  To: Michael Tokarev, Song Gao, qemu-devel, lixianglai, maobibo
  Cc: richard.henderson, peter.maydell, philmd, qemu-stable

On 26/7/24 12:12, Michael Tokarev wrote:
> 24.07.2024 04:58, Song Gao wrote:
>> When the lddir level is 4 and the base is a HugePage, we may try to 
>> put value 4
>> into a field in the TLBENTRY that is only 2 bits wide.
>>
>> Fixes: Coverity CID 1547717
>> Fixes: 9c70db9a43388 ("target/loongarch: Fix tlb huge page loading 
>> issue")
>> Signed-off-by: Song Gao <gaosong@loongson.cn>
>> ---
>>   target/loongarch/tcg/tlb_helper.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/target/loongarch/tcg/tlb_helper.c 
>> b/target/loongarch/tcg/tlb_helper.c
>> index d6331f9b0b..97f38fc391 100644
>> --- a/target/loongarch/tcg/tlb_helper.c
>> +++ b/target/loongarch/tcg/tlb_helper.c
>> @@ -525,6 +525,7 @@ target_ulong helper_lddir(CPULoongArchState *env, 
>> target_ulong base,
>>           if (unlikely(level == 4)) {
>>               qemu_log_mask(LOG_GUEST_ERROR,
>>                             "Attempted use of level 4 huge page\n");
>> +            return base;
>>           }
>>           if (FIELD_EX64(base, TLBENTRY, LEVEL)) {
> 
> 
> Is it qemu-stable material (for 9.0.x series)?

If this applies cleanly, then yes.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-26 15:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24  1:58 [PATCH] target/loongarch: Fix helper_lddir() a CID INTEGER_OVERFLOW issue Song Gao
2024-07-24  2:59 ` Richard Henderson
2024-07-26 10:12 ` Michael Tokarev
2024-07-26 15:11   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).