Re: [PATCH v7 3/5] virt: Add efi_secret module to expose confidential computing secrets

Dov Murik
2022-02-02T10:55:42Z

On 02/02/2022 10:45, Gerd Hoffmann wrote:
> Hi,
>
>> + s->coco_dir = NULL;
>> + s->fs_dir = NULL;
>> + memset(s->fs_files, 0, sizeof(s->fs_files));
>> +
>> + dent = securityfs_create_dir("coco", NULL);
>> + if (IS_ERR(dent)) {
>> + pr_err("Error creating coco securityfs directory entry err=%ld\n", PTR_ERR(dent));
>> + return PTR_ERR(dent);
>> + }
>> + s->coco_dir = dent;
>> +
>> + dent = securityfs_create_dir("efi_secret", s->coco_dir);
>> + if (IS_ERR(dent)) {
>> + pr_err("Error creating efi_secret securityfs directory entry err=%ld\n",
>> + PTR_ERR(dent));
>> + return PTR_ERR(dent);
>> + }
>> + d_inode(dent)->i_op = &efi_secret_dir_inode_operations;
>> + s->fs_dir = dent;
>
> Why have two levels of subdirectories here? Do we expect more users for
> the coco/ directory?
>

In the RFCv2 of this series Borislav Petkov suggested [1] adding a
"coco/" directory (originally it was "<securityfs>/sev_secret"); he
envisioned that other coco platforms (SNP, TDX) might want to expose
something to userspace via filesystem.

[1] https://lore.kernel.org/linux-coco/YNoiydeow+ftvfYX@zn.tnic/

> See also the naming discussion in the cover letter sub-thread.

Yep, following.

Thanks,
Dov