From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com ([156.151.31.86]:44190 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732914AbeHNRIw (ORCPT ); Tue, 14 Aug 2018 13:08:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=apWpH8wnyu8jM1U60akVUW7qAJU+EhQzbRdELDmSjD4=; b=mnX+pleg2k5HfmLCGjfsUerEdFmEmXhc3h+WACcI4b8hpCRTZ5ZttOHQkrlrh5S13q5a kj/gjKjO6mtG+uGQInXZ3hmivoZwW6kKo2eN2p54tk02n++96/o64Y6GoTQ725xE9gcy n4x2FRzj5q5T8GncRBXo+/no5HTJqFit5tsLUJAtaixalZylB4GyiginlzRAtp1jGjEF f5WHij1ajnFU1lbZNcD51fAmDwAgbuv2cr4W+3lulL/agaqYGn6zMNpNifjNs+LhBKTe 4Kh2Xx5lz2nXt8iWcnLHrzdQRMSa2sKXj8ImWtP9IXkRxfQyylmdJKtZ++uZAOZkZHYd DQ== Date: Tue, 14 Aug 2018 17:21:17 +0300 From: Dan Carpenter Subject: Re: Smatch for Xen Message-ID: <20180814142117.v7tavkwisxcoel2f@mwanda> References: <32158e28-2ee8-f2b9-2d66-77c8eb43b5b5@amazon.de> <20180806103132.vzqmp2ns4ytj2aol@mwanda> <20180806112003.iyir4napbpn4q6z6@mwanda> <20180806131632.w4rd3ntfgoxwxb5l@mwanda> <20180806135409.r5xytcrffqi3ddco@mwanda> <20180813175845.muweaoh6s5rxcr57@mwanda> <20180813183132.suxab5gfub5uig2k@mwanda> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="coxbgqwraeejan5r" Content-Disposition: inline In-Reply-To: Sender: smatch-owner@vger.kernel.org List-ID: To: Norbert Manthey Cc: Norbert Manthey , smatch@vger.kernel.org, jsteckli@amazon.com, tautschn@amazon.co.uk --coxbgqwraeejan5r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Aug 14, 2018 at 03:27:43PM +0200, Norbert Manthey wrote: > Thanks a lot! I used your scripts and compiled Xen now, as well as > created the data base for it. As I am interested in analysis that is run > for the kernel, I also asked the tool to name the project "kernel", as > that enabled this analysis (e.g. the spectre analysis). > > I called the build_xen_data.sh scripts multiple times on an upstream Xen > release branch, and the number of warnings did not increase, while for > the Linux kernel the number of warnings would increase, e.g. warnings > that depend on the taint analysis like the spectre analysis. Is that > expected, and is there a way to improve that for Xen? > Yeah. I just noticed that as well. I've added the --db-file= option. See the new attached build scripts. I'm going to make xen it's own project for the purposes of check_user_data2.c. Which functions should set the data as tainted? Like copy_from_user() in the kernel. Is it really just the same functions? I wish I could figure out which version of GCC smatch is saying it is so I could sort out why the build fails. It's parsing compiler.h wrong. regards, dan carpenter --coxbgqwraeejan5r Content-Type: application/x-sh Content-Disposition: attachment; filename="build_xen_data.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash=0A=0A# This is a generic script to parse --info output. For th= e kernel, don't use=0A# this script, use build_kernel_data.sh instead.=0A= =0ANR_CPU=3D$(cat /proc/cpuinfo | grep ^processor | wc -l)=0ASCRIPT_DIR=3D/= home/dcarpenter/progs/smatch/devel/smatch_scripts/=0ADATA_DIR=3Dsmatch_data= =0APROJECT=3Dxen=0A=0Afunction usage {=0A echo=0A echo "Usage: $0"= =0A echo "Updates the smatch_data/ directory and builds the smatch datab= ase"=0A echo " -p (default =3D $PROJECT)"=0A echo=0A exi= t 1=0A}=0A=0Awhile true ; do=0A if [ "$1" =3D=3D "-p" ] || [ "$1" =3D=3D= "--project" ] ; then=0A shift=0A PROJECT=3D"$1"=0A sh= ift=0A elif [ "$1" =3D=3D "--help" ] || [ "$1" =3D "-h" ] ; then=0A = usage=0A else=0A break=0A fi=0Adone=0A=0Aif [ -e $SCRIPT_DI= R/../smatch ] ; then=0A BIN_DIR=3D$SCRIPT_DIR/../=0Aelse=0A echo "Thi= s script should be located in the smatch_scripts/ subdirectory of the smatc= h source."=0A exit 1=0Afi=0A=0A# If someone is building the database for= the first time then make sure all the=0A# required packages are installed= =0Aif [ ! -e smatch_db.sqlite ] ; then=0A [ -e smatch_warns.txt ] || tou= ch smatch_warns.txt=0A if ! $SCRIPT_DIR/../smatch_data/db/create_db.sh -= p=3D$PROJECT smatch_warns.txt ; then=0A echo "Hm... Not working. Ma= ke sure you have all the sqlite3 packages"=0A echo "And the sqlite3 = libraries for Perl and Python"=0A exit 1=0A fi=0Afi=0A=0A=0Amake = -j${NR_CPU} clean=0Arm SMATCH/ -rf=0A=0Aexport SMATCH_EXTRA_ARG=3D"-p=3Dxen= --full-path --info --data=3D$DATA_DIR --db-file=3D$(pwd)/smatch_db.sqlite"= =0A../one-line-scan/one-line-scan -o SMATCH --smatch --no-gotocc --no-analy= sis -- make xen -j${NR_CPU} -B=0Acat SMATCH/smatch/results/*.c > smatch_war= ns.txt=0A=0Afor i in $SCRIPT_DIR/gen_* ; do=0A $i smatch_warns.txt -= p=3D${PROJECT}=0Adone=0A=0Amkdir -p $DATA_DIR=0Amv $PROJECT.* $DATA_DIR=0A= =0A$SCRIPT_DIR/../smatch_data/db/create_db.sh -p=3D$PROJECT smatch_warns.tx= t=0A=0A --coxbgqwraeejan5r Content-Type: application/x-sh Content-Disposition: attachment; filename="check.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash=0A=0APWD=3D$(pwd)=0ADATA_DIR=3D$PWD/smatch_data=0ANR_CPU=3D$(ca= t /proc/cpuinfo | grep ^processor | wc -l)=0A=0Amake -j${NR_CPU} clean=0Arm= SMATCH/ -rf=0A=0Aexport SMATCH_EXTRA_ARG=3D"-p=3Dxen --full-path --data=3D= $DATA_DIR --db-file=3D$(pwd)/smatch_db.sqlite"=0A../one-line-scan/one-line-= scan -o SMATCH --smatch --no-gotocc --no-analysis -- make xen -j${NR_CPU} -= B=0Acat SMATCH/smatch/results/*.c > smatch_warns.txt=0A=0A=0A=0A --coxbgqwraeejan5r--