Re: [bug report] x86/sgx: Add SGX_IOC_ENCLAVE_CREATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 05, 2025 at 12:07:27AM +0200, Jarkko Sakkinen wrote:
> On Tue, Mar 04, 2025 at 04:05:45PM +0300, Dan Carpenter wrote:
> > Hello Jarkko Sakkinen,
> 
> Hi Dan, thanks for the report, it is very well put together with all the
> detail it has :-)
> 
> > 
> > Commit 888d24911787 ("x86/sgx: Add SGX_IOC_ENCLAVE_CREATE") from Nov
> > 13, 2020 (linux-next), leads to the following Smatch static checker
> > warning:
> > 
> > 	arch/x86/kernel/cpu/sgx/ioctl.c:75 sgx_encl_create()
> > 	warn: potential user controlled sizeof overflow 'secs->size + ((1) << 12)' '0-u64max + 4096'
> 
> 
> What I tried:
> 
> 1. Installed smatch package to Fedora.
> 2. Cloned git clone git://repo.or.cz/smatch.git
> 
> I get:
> 
> $ O=.clangd ~/work/staging/smatch/smatch_scripts/kchecker arch/x86/kernel/cpu/sgx/ioctl.c
> make[1]: Entering directory '/home/jarkko/work/kernel.org/jarkko/linux-tpmdd/.clangd'
>   SYNC    include/config/auto.conf
>   GEN     Makefile
>   GEN     Makefile
>   CHECK   ../scripts/mod/empty.c
>   CALL    ../scripts/checksyscalls.sh
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CHECK   ../arch/x86/kernel/cpu/sgx/ioctl.c
> make[7]: *** [../scripts/Makefile.build:208: arch/x86/kernel/cpu/sgx/ioctl.o] Error 139
> make[6]: *** [../scripts/Makefile.build:465: arch/x86/kernel/cpu/sgx] Error 2
> make[5]: *** [../scripts/Makefile.build:465: arch/x86/kernel/cpu] Error 2
> make[4]: *** [../scripts/Makefile.build:465: arch/x86/kernel] Error 2
> make[3]: *** [../scripts/Makefile.build:465: arch/x86] Error 2
> make[2]: *** [/home/jarkko/work/kernel.org/jarkko/linux-tpmdd/Makefile:1989: .] Error 2
> make[1]: *** [/home/jarkko/work/kernel.org/jarkko/linux-tpmdd/Makefile:251: __sub-make] Error 2
> make[1]: Leaving directory '/home/jarkko/work/kernel.org/jarkko/linux-tpmdd/.clangd'
> make: *** [Makefile:251: __sub-make] Error 2
> 
> Am I using smatch incorrectly?

You're doing it correctly.  I don't know what "Error 139" means...  I'm not
able reproduce this.

> I'd just love to learn how to use it in
> order to make sure that my fix will address the bug.

This is something I'm still working on so it's not published yet.

regards,
dan carpenter





[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux