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: <20220221222856.c6b74b3n3fwqe6vy@black.fi.intel.com>
Date:   Tue, 22 Feb 2022 01:28:56 +0300
From:   "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
        luto@...nel.org, peterz@...radead.org,
        sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
        ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
        hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
        joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
        pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
        tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv3 02/32] x86/coco: Add API to handle encryption mask

On Mon, Feb 21, 2022 at 11:28:16AM -0800, Dave Hansen wrote:
> I'm just a bit confused why *this* was chosen as the cc_whatever() hook.
>  Just like the mask function, it has one spot where it gets used:
> 
> +#define pgprot_encrypted(prot)	__pgprot(cc_mkenc(pgprot_val(prot)))
> +#define pgprot_decrypted(prot)	__pgprot(cc_mkdec(pgprot_val(prot)))
> 
> So, why bother having another level of abstraction?
> 
> Why don't we just have:
> 
> 	pgprot_t cc_mkenc(pgprot prot)
> 	pgprot_t cc_mkenc(pgprot prot)
> 
> and *no* pgprot_{en,de}crypted()?

Okay. Let me try this.

> >>> +out:
> >>>  	physical_mask &= ~sme_me_mask;
> >>> +	if (sme_me_mask)
> >>> +		cc_init(CC_VENDOR_AMD, sme_me_mask);
> >>>  }
> >>
> >> I don't think you need to mop it up here, but where does this leave
> >> sme_me_mask?
> > 
> > I think sme_me_mask still can be useful to indicate that the code is only
> > relevant for AMD context.
> 
> Shouldn't we be able to tell that because something is in an
> AMD-specific file, function or #ifdef?

Sure. But for some code it is not immidiately obvious that it is
AMD-specific. Like from file name alone, mem_encrypt_identity.c doesn't
look like it is only AMD thing.

Anyway, I think getting rid of sme_me_mask is out of scope for the
patchset.

> Is there ever a time where sme_me_mask is populated by cc_mask is not?

Yes. Decompression code. (I know it doesn't affect bottom line much).

> This seems like it is just making a copy of sme_me_mask.
> 
> sme_me_mask does look quite AMD-specialized, like its assembly
> manipulation.  Even if it's just a copy of cc_mask, it would be nice to
> call that out so the relationship is crystal clear.

-- 
 Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ