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]
Date:   Mon, 24 Oct 2022 00:17:27 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     "Kalra, Ashish" <ashish.kalra@....com>
Cc:     Borislav Petkov <bp@...en8.de>, x86@...nel.org,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        linux-coco@...ts.linux.dev, linux-mm@...ck.org,
        linux-crypto@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
        jroedel@...e.de, thomas.lendacky@....com, hpa@...or.com,
        ardb@...nel.org, pbonzini@...hat.com, seanjc@...gle.com,
        vkuznets@...hat.com, jmattson@...gle.com, luto@...nel.org,
        dave.hansen@...ux.intel.com, slp@...hat.com, pgonda@...gle.com,
        peterz@...radead.org, srinivas.pandruvada@...ux.intel.com,
        rientjes@...gle.com, dovmurik@...ux.ibm.com, tobin@....com,
        michael.roth@....com, vbabka@...e.cz, kirill@...temov.name,
        ak@...ux.intel.com, tony.luck@...el.com, marcorr@...gle.com,
        sathyanarayanan.kuppuswamy@...ux.intel.com, alpergun@...gle.com,
        dgilbert@...hat.com
Subject: Re: [PATCH Part2 v6 12/49] crypto: ccp: Add support to initialize
 the AMD-SP for SEV-SNP

On Wed, Oct 19, 2022 at 01:48:48PM -0500, Kalra, Ashish wrote:
> Another follow up:
> 
> > > >   int sev_platform_init(int *error);
> > > > +/**
> > > > + * sev_snp_init - perform SEV SNP_INIT command
> > > > + *
> > > > + * @error: SEV command return code
> > > > + *
> > > > + * Returns:
> > > > + * 0 if the SEV successfully processed the command
> > > > + * -%ENODEV    if the SEV device is not available
> > > > + * -%ENOTSUPP  if the SEV does not support SEV
> > > > + * -%ETIMEDOUT if the SEV command timed out
> > > > + * -%EIO       if the SEV returned a non-zero return code
> > > 
> > > Something's weird with those args. I think it should be
> > > 
> > >     %-ENODEV
> > > 
> > > and so on...
> > > 
> > 
> > Yes, off course %-<errno>
> > 
> 
> I see that other drivers are also using the same convention:
> 
> include/linux/regset.h:
> ..
> /**
>  * user_regset_set_fn - type of @set function in &struct user_regset
>  * @target:     thread being examined
>  * @regset:     regset being examined
>  * @pos:        offset into the regset data to access, in bytes
>  * @count:      amount of data to copy, in bytes
>  * @kbuf:       if not %NULL, a kernel-space pointer to copy from
>  * @ubuf:       if @kbuf is %NULL, a user-space pointer to copy from
>  *
>  * Store register values.  Return %0 on success; -%EIO or -%ENODEV
>  * are usual failure returns.  The @pos and @count values are in
> ...
> 
> include/linux/psp-tee.h:
> ..
> /**
>  * psp_tee_process_cmd() - Process command in Trusted Execution Environment
>  * @cmd_id:     TEE command ID (&enum tee_cmd_id)
>  * @buf:        Command buffer for TEE processing. On success, is updated
>  *              with the response
>  * @len:        Length of command buffer in bytes
>  * @status:     On success, holds the TEE command execution status
>  *
>  * This function submits a command to the Trusted OS for processing in the
>  * TEE environment and waits for a response or until the command times out.
>  *
>  * Returns:
>  * 0 if TEE successfully processed the command
>  * -%ENODEV    if PSP device not available
>  * -%EINVAL    if invalid input
>  * -%ETIMEDOUT if TEE command timed out
>  * -%EBUSY     if PSP device is not responsive
>  */
> ...
> 
> Thanks,
> Ashis

In SGX driver the convention is:

* Return:
* - -ENODEV  ...
* - -EINVAL  ...

"Return:" because this is what kernel-nanodoc-HOWTO.txt suggests.

The dashes are recognized by Sphinx as list so each return code
gets a newline when processed through "make htmldocs". Otherwise,
you get a mess because newlines will be removed.

I don't actually have idea of '%' and neither see it in the kernel
documenation.

BR, Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ