[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a484750-cf67-289c-78d1-2e1b764441e8@intel.com>
Date: Thu, 28 Apr 2022 11:04:59 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Wander Lairson Costa <wander@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kai Huang <kai.huang@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/3] x86/tdx: Add TDX Guest attestation interface
driver
On 4/28/22 10:56, Sathyanarayanan Kuppuswamy wrote:
> On 4/28/22 10:45 AM, Wander Lairson Costa wrote:
>> On Fri, Apr 22, 2022 at 04:34:16PM -0700, Kuppuswamy Sathyanarayanan
>> wrote:
>>> +static long tdx_get_tdreport(void __user *argp)
>>> +{
>>> + void *report_buf = NULL, *tdreport_buf = NULL;
>>> + long ret = 0, err;
>>> +
>>> + /* Allocate space for report data */
>>> + report_buf = kmalloc(TDX_REPORT_DATA_LEN, GFP_KERNEL);
>>> + if (!report_buf)
>>> + return -ENOMEM;
>>> +
>>> + /*
>>> + * Allocate space for TDREPORT buffer (1024-byte aligned).
>>> + * Full page alignment is more than enough.
>>> + */
>>> + tdreport_buf = (void *)get_zeroed_page(GFP_KERNEL);
>>
>> Maybe we should add BUILD_BUG_ON(TDX_TDREPORT_LEN > PAGE_SIZE)
>
> Currently, it is a constant value < PAGE_SIZE. But I can add the
> BUILD_BUG_ON check for it.
That's kinda silly. If it might ever be bigger than a page, you just do:
tdreport_buf = alloc_pages();
But, seriously, TDX_TDREPORT_LEN is part of the ABI and can't change.
kmalloc() would work too since TDX_TDREPORT_LEN is a power of 2.
Powered by blists - more mailing lists