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

Re: [FuSa SIG] Static code analysis. some questions.


  • To: Francesco Brancati <francesco.brancati@xxxxxxxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
  • Date: Wed, 5 Feb 2020 12:52:07 -0800 (PST)
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=resiltech.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A6CEzz0q3SowPmyZZZ6RSRVLm94YoBRqk8pJXcULlFY=; b=H0AVukHn6fbr5aZUSO9yubwFnDuC+wL+F3EC0Pl3sIvRBecJ067j8DqkG54xKkBEYQidb0Arz4xEHPImes5mztdOYJtVlmt6GhIBKCS4X6kgv4WWXYesQUmL2Qn46d43+IQwsXi0ZwL1CkHf7UOR+8FPbzJcHzUOU4X35eAwi67e6ulEYpe7KhDDXkhGpu68lrmyJhT1J56Ooy8kVkHM8zJcZKE1Tz1SZ5x8mKO1t36/gdzObGgGYKhVwRct4y/FXveubiK5bwQIHc33iYdXWvKqDUVEAdThg3ZHrXR9Ye3m3qG90o5r2dsRQiwgbopWrQQ6iVxqmymiOXpGyMev2w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kw0HGtjLbzs+ii9JKBRWjjZf/wDf+sFrZpIdkPgJ+DPtAXEbpKuyUDA43BkiHMtTHrhoDmpPzHh3f/EWiQKp8D+TaxMAI8JwH+4iTqy+PvaZ/f8vOe1i0Bmjxi4FwOkxrQwoG51YUMnXEcs04e30BEUNwI4cmdPfhAgw64v1pb5uPYZTWaZvZiFcm6CuHAR2uKnebV2SRhSshbk+aBenQ/jLHLENVdbT5ymGy/m6qynfylqIJxyr650Zkxf5p70SySVDyTHjRp+nwt8kUgevaoquPjnrvQSnUy80O7dKs3VoqYpIr1HU20ECoa/I0/MllN67hjzBo+jX6HAe/Q1IdA==
  • Authentication-results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; resiltech.com; dkim=none (message not signed) header.d=none;resiltech.com; dmarc=bestguesspass action=none header.from=xilinx.com;
  • Cc: Lorenzo Falai <lorenzo.falai@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, Roberto Vanni <roberto.vanni@xxxxxxxxxxxxx>, "fusa-sig@xxxxxxxxxxxxxxxxxxxx" <fusa-sig@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 12 Feb 2020 15:24:03 +0000
  • List-id: This is a discussion list for members of the Xen Project FuSa SIG <fusa-sig.lists.xenproject.org>

On Tue, 28 Jan 2020, Francesco Brancati wrote:
> Dear Stefano,
> 
> I have a couple of question for you from the team working on static code
> analysis. please see below.

Hi Francesco,

Sorry for the late reply.

 
> - with the approach presented during last meeting we obtained intermediate
> results but for the analysis few decisions were done by us that needs
> confirmations and few errors/warning raised  by the understand tool:
> 1) since the file list provided had some errors (rows with double entries and
> file not identified in  the path specified) we tried to solve them as reported
> in the file list attached: could you confirm that this is a valid list for
> headers+source code files for Xen 4.13.0 tinyconfig project ? (see
> fileListRes.txt)

Sorry about the errors, and yes, your list looks valid, except for a
couple of missing headers, see below.


> 2) the tool raised the following warnings during the analysis with respect to
> .h files that we were unable to solve manually: could you please help us?

In regards to the warnings, they affect the following headers:

  asm/asm-offsets.h
  asm-arm/vpl011.h
  xen/compile.h
  asm/spec_ctrl.h
  asm/i387.h
  asm/xstate.h

Let's go over them one by one:

1) asm/asm-offsets.h
It looks like this is missing from your file list, you should have:
  
  include/asm/asm-offsets.h

2) asm-arm/vpl011.h
This one is present in your file list as include/asm-arm/vpl011.h, I
don't know why the tool is not able to find it. If you look at xen.git,
the file is certainly there:

http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/asm-arm/vpl011.h;h=e6c7ab738194a5759e796aa3b0e30be4133340f8;hb=a2e84d8e42c9e878fff17b738d8e5c5d83888f31

3) xen/compile.h
This one is missing from your file list, you should add:

  include/xen/compile.h

4) asm/spec_ctrl.h 
This one is interesting because it shouldn't be included at all. This is
a x86 header file: xen/include/asm-x86/spec_ctrl.h. The C file that is
supposed to include it is xen/common/efi/boot.c:

http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/common/efi/boot.c;h=3f1c330afec2c675636b73b00ee89c1734230d47;hb=a2e84d8e42c9e878fff17b738d8e5c5d83888f31

If you look at line 1410, you'll see that the include is actually right
after #ifndef CONFIG_ARM:

http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/common/efi/boot.c;h=3f1c330afec2c675636b73b00ee89c1734230d47;hb=a2e84d8e42c9e878fff17b738d8e5c5d83888f31#l1410

So this seems to be a genuine error in the tool that doesn't pick up the
meaning of #ifndef CONFIG_ARM?


5) asm/i387.h
Same as 4), the file is a x86 header file: xen/include/asm-x86/i387.h
It is supposed to be included by xen/common/efi/runtime.c, but the
#include is done right after a #ifndef CONFIG_ARM, see:

http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/common/efi/runtime.c;h=8c2ece468de97c7448b0ef0cad8b440de8cbae51;hb=a2e84d8e42c9e878fff17b738d8e5c5d83888f31#l32


6) asm/xstate.h
This is again like 4) and 5), probably an error by the tool. xstate.h is
a x86 header: xen/include/asm-x86/xstate.h, it is included by
xen/common/efi/runtime.c after a #ifndef CONFIG_ARM, give a look at the
same link as before.



> 3) in addition to this, we would like to try a new functionality of the
> Understand tool that should allow to automatically trace the building process
> in order to detect all the files (.c and .h) used for a certain build and
> parameters, allowing to analyze all and only the needed file with preprocessor
> config.

Sounds very useful


> in order to do this, we would like to have advices on the build process.
> you gave us as reference the following process:
> ---
> export XEN_TARGET_ARCH=arm64
> export CROSS_COMPILE=/path/to/cross-compiler
> cd xen/
> cp arch/arm/configs/tiny64.conf .config
> make
> (press Enter a few times)
> ---
> the question is: is it ok with Xen 4.13.0?

Yes, it is OK.


> Which is the cross-compiler for arm64 that you use?

Typically, I just use the one pre-built by Linaro:

https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

Unpack the tarball, lets say you end up with:

/local/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu

Then you need to set CROSS_COMPILE as follows:

export 
CROSS_COMPILE=/local/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
_______________________________________________
Fusa-sig mailing list
Fusa-sig@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/fusa-sig

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.