lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ac4ed35-212b-f7ad-55f4-937946ffec1a@intel.com>
Date:   Thu, 22 Apr 2021 18:21:07 -0700
From:   Dave Hansen <dave.hansen@...el.com>
To:     "Kuppuswamy, Sathyanarayanan" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Andy Lutomirski <luto@...nel.org>
Cc:     Andi Kleen <ak@...ux.intel.com>,
        Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
        Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Raj Ashok <ashok.raj@...el.com>,
        Sean Christopherson <seanjc@...gle.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] x86/tdx: Add __tdcall() and __tdvmcall() helper
 functions

On 4/22/21 6:09 PM, Kuppuswamy, Sathyanarayanan wrote:
> But let me try to explain it here. What I meant by complication is,
> for in/out instruction, we use alternative_io() to substitute in/out
> instructions with tdg_in()/tdg_out() assembly calls. So we have to ensure
> that we don't corrupt registers or stack from the substituted instructions
> 
> If you check the implementation of tdg_in()/tdg_out(), you will notice
> that we have added code to preserve the caller registers. So, if we use
> C wrapper for this use case, there is a chance that it might mess
> the caller registers or stack.
> 
>     alternative_io("in" #bwl " %w2, %" #bw "0",            \
>             "call tdg_in" #bwl, X86_FEATURE_TDX_GUEST,    \
>             "=a"(value), "d"(port))

Are you saying that calling C functions from inline assembly might
corrupt the stack or registers?  Are you suggesting that you simply
can't call C functions from inline assembly?  Or, that you can't express
the register clobbers of a function call in inline assembly?

You might want to check around the kernel to see how other folks do it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ