From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com ([156.151.31.86]:54238 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729835AbeHMUmM (ORCPT ); Mon, 13 Aug 2018 16:42:12 -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=JJVeO/gWSmURohIMpv//so4pLLHWT0daue94wawW8Eg=; b=TDU5X5h9B8pBvfO0pfZ1ginQa/Kv8DUxyN3hu29nwOnbIIUrGTf2WqCPBcUq5iOzXCAG Xhv0RZrclezmh1ZN3yEVuFyvE5njJzsh63DWoggUFNpNiRlepd4fbfBsbWn0kBV0PDtK WFjr/HVTHnW+GYCX79uPpI2AGem+zEaGdteec2AL8UQxpOkLn6/RsNIixrpAJwlDsaEz l+4Vsz9vzR+qC2fC4oRoROq0vv0DZtFMtCTeW0VhVU70C3qzNksuzCaQMaV966NyVaZX e+TsQH3Qbs7LM/k/iOR85MIbz9nehiNjR9SUHj5fAX2EQWmQI29Gg+gisxFoTiyPd4P9 Hw== Date: Mon, 13 Aug 2018 20:58:45 +0300 From: Dan Carpenter Subject: Re: Smatch for Xen Message-ID: <20180813175845.muweaoh6s5rxcr57@mwanda> References: <32158e28-2ee8-f2b9-2d66-77c8eb43b5b5@amazon.de> <20180806103132.vzqmp2ns4ytj2aol@mwanda> <20180806112003.iyir4napbpn4q6z6@mwanda> <20180806131632.w4rd3ntfgoxwxb5l@mwanda> <20180806135409.r5xytcrffqi3ddco@mwanda> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="m4jcdmtf553jjxln" 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 --m4jcdmtf553jjxln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 13, 2018 at 04:25:46PM +0200, Norbert Manthey wrote: > Dear Dan, > > I just split the output in one-line-scan, and also use your cgcc wrapper > by now. Furthermore, I log all calls to cgcc so that replaying single > calls is easy now. The relevant info is logged in the file > > SMATCH/smatch/smatch-preprocess.log > > However, I do not see a reason not to use the --file-output flag, in > case you are more used to that. That should simply result in my output > files being empty, but that's fine. This way, your tooling should work, > i.e. collecting all the .smatch files should behave as in case of > working with the kernel. > > If there is anything else I can help with, please let me know. I would > love to use your taint analysis for Xen as well. > Sorry for all this headache. Yeah. You don't need --fileoutput if you're using one-line-scan. But one-line-scan mixes stdout and stderr which doesn't work for Smatch. We only want stdout. I've just pushed some changes which should help a bit. And I'm attaching some scripts to run Smatch on xen. You're going to want to change the SCRIPT_DIR in build_xen_data.sh and it assumes that one-line-scan is in the ../one-line-scan/. Also you need to save the script in path/to/xen/../ Sorry, it's not very beautiful. regards, dan carpenter --m4jcdmtf553jjxln 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/= path/to/smatch/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 database"=0A echo " -p = (default =3D $PROJECT)"=0A echo=0A exit 1=0A}=0A=0Awhile tr= ue ; do=0A if [ "$1" =3D=3D "-p" ] || [ "$1" =3D=3D "--project" ] ; then= =0A shift=0A PROJECT=3D"$1"=0A shift=0A elif [ "$1"= =3D=3D "--help" ] || [ "$1" =3D "-h" ] ; then=0A usage=0A else= =0A break=0A fi=0Adone=0A=0Aif [ -e $SCRIPT_DIR/../smatch ] ; the= n=0A BIN_DIR=3D$SCRIPT_DIR/../=0Aelse=0A echo "This script should be = located in the smatch_scripts/ subdirectory of the smatch source."=0A ex= it 1=0Afi=0A=0A# If someone is building the database for the first time the= n make sure all the=0A# required packages are installed=0Aif [ ! -e smatch_= db.sqlite ] ; then=0A [ -e smatch_warns.txt ] || touch 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. Make sure you have al= l 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 --in= fo"=0A../one-line-scan/one-line-scan -o SMATCH --smatch --no-gotocc --no-an= alysis -- make xen -j${NR_CPU} -B=0Acat SMATCH/smatch/results/* > smatch_wa= rns.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 --m4jcdmtf553jjxln 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"=0A../one-line-scan/one-line-scan -o SMATCH --smatch --no-gotocc = --no-analysis -- make xen -j${NR_CPU} -B=0Acat SMATCH/smatch/results/* > sm= atch_warns.txt=0A=0A=0A=0A --m4jcdmtf553jjxln--