Return-Path: Received: from aserp2120.oracle.com ([141.146.126.78]:51998 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751914AbeDJKT5 (ORCPT ); Tue, 10 Apr 2018 06:19:57 -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-2017-10-26; bh=dtvV8LZaYh5e8RzfIeVfdjBVj3yLrZEJyaIm/MRQEdg=; b=hYvqH3YNMgV712sSBEqkBqbP9nigpGOGaTFYRyXs30JDA8MqRk2WwGXSz7PJbmyZ27mS 24kSX4DAViN1TzdpwLXMIgMC0UbHw60oDXyBkFF1xDLhwkKbiajQsWncYF0iZSSg7644 Ntp5/fSIfJSANmYROyIeNTfR1AFIqYyJ6Idir8KApGiUtk7anRNSDuxCgpcDXH0wEp0U iqdCQgiAsSRknljDxGwO3Uu4vA2Vre+sc6wahMki95P1yezW9WlHvhU8tZoXGnROOBLR 3WqVRAsvvWLuDKC4thpTbrRzcMM0T7OTvkkirU//Holya2QH5vvIUE3Nattcuv+KS5d2 IA== Date: Tue, 10 Apr 2018 13:19:35 +0300 From: Dan Carpenter Subject: Re: tracing back a variable Message-ID: <20180410101934.iyvjf2mocbl65cgy@mwanda> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: smatch-owner@vger.kernel.org List-ID: To: "Gustavo A. R. Silva" Cc: smatch@vger.kernel.org On Mon, Apr 09, 2018 at 11:25:48AM -0500, Gustavo A. R. Silva wrote: > Hi all, > > I wonder if smatch can be used to trace back a particular variable in order > to determine if such variable is directly or indirectly controlled from any > syscall? > Of course, you *could* build something like that... There is the get_implied_rl() function. You give it a variable and it tells you if the variable can be controlled by the user. So it could be from a syscall, kstrtol() or from skb->data etc. So say you have something like: u8 foo = *(char *)skb->data; if (foo > 8) return; Then get_implied_rl() will say foo is 0-8 range. In theory there is enough information in the database so you could trace function parameters to find out where they come from, but no one has tested that so it probably doesn't work. What are you working on? Perhaps there is a different way to get the information you want. regards, dan carpenter