From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH for-9.1] target/i386: Fix tss access size in switch_tss_ra
Date: Tue, 20 Aug 2024 09:02:01 -0700 [thread overview]
Message-ID: <5fcf8fcb-c100-4d3b-aca0-a9a46a7b7040@linaro.org> (raw)
In-Reply-To: <20240819074052.207783-1-richard.henderson@linaro.org>
On 8/19/24 00:40, Richard Henderson wrote:
> The two limit_max variables represent size - 1, just like the
> encoding in the GDT, thus the 'old' access was off by one.
> Access the minimal size of the new tss: the complete tss contains
> the iopb, which may be a larger block than the access api expects,
> and irrelevant because the iopb is not accessed during the
> switch itself.
>
> Fixes: 8b131065080a ("target/i386/tcg: use X86Access for TSS access")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2511
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/i386/tcg/seg_helper.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
> index bab552cd53..3b8fd827e1 100644
> --- a/target/i386/tcg/seg_helper.c
> +++ b/target/i386/tcg/seg_helper.c
> @@ -378,7 +378,7 @@ static int switch_tss_ra(CPUX86State *env, int tss_selector,
>
> /* X86Access avoids memory exceptions during the task switch */
> mmu_index = cpu_mmu_index_kernel(env);
> - access_prepare_mmu(&old, env, env->tr.base, old_tss_limit_max,
> + access_prepare_mmu(&old, env, env->tr.base, old_tss_limit_max + 1,
> MMU_DATA_STORE, mmu_index, retaddr);
>
> if (source == SWITCH_TSS_CALL) {
> @@ -386,7 +386,8 @@ static int switch_tss_ra(CPUX86State *env, int tss_selector,
> probe_access(env, tss_base, 2, MMU_DATA_STORE,
> mmu_index, retaddr);
> }
> - access_prepare_mmu(&new, env, tss_base, tss_limit,
> + /* While true tss_limit may be larger, we don't access the iopb here. */
> + access_prepare_mmu(&new, env, tss_base, tss_limit_max + 1,
> MMU_DATA_LOAD, mmu_index, retaddr);
>
> /* save the current state in the old TSS */
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
prev parent reply other threads:[~2024-08-20 16:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 7:40 [PATCH for-9.1] target/i386: Fix tss access size in switch_tss_ra Richard Henderson
2024-08-20 15:56 ` Peter Maydell
2024-08-20 16:02 ` Pierrick Bouvier [this message]
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=5fcf8fcb-c100-4d3b-aca0-a9a46a7b7040@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 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).