Re: [PATCH 1/1] x86/sev: Fix potential sign extension in amd_enc_status_change_finish()
From: Wencheng Yang
Date: Sun Apr 26 2026 - 22:41:26 EST
Hi, Dave
Thank you very much for your reply.
I think it's not easy to fix the API for me, at the point of view of
the bug, the most
direct way and also the quickest way is converting the type of pages to ulong.
On Fri, Apr 24, 2026 at 1:07 AM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 4/22/26 19:10, YangWencheng wrote:
> > When npages (int) is left-shifted by PAGE_SHIFT to calculate the size
> > in bytes, the operation is performed on a signed integer. If npages is
> > large enough, this can cause:
>
> I kinda think the whole API around encryption is busted. The majority of
> the callers have a virtual address and a bytes-based length argument and
> convert it to pages.
>
> Shouldn't we fix the API instead of hacking around it in a billion
> little places?