Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp229534lqo; Thu, 16 May 2024 04:56:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX08LcnXtjcfJGwEy4OxzY69T7zG505PT0SKCa1eOso2isJB/BK/vVzejhXJEIpABY3N9A3avr+9g09RzbIRP9+xEGiAsTpSPqJNdTgUw== X-Google-Smtp-Source: AGHT+IEIRQG7882aeb17Z/WgFF0pw4YwIvKXI1lgK6aqzTX2DwftEgpitStVz03QmdcbM9Pi5+PF X-Received: by 2002:a17:906:fa1b:b0:a5a:8b8c:6203 with SMTP id a640c23a62f3a-a5a8b8c6341mr453494666b.45.1715860584468; Thu, 16 May 2024 04:56:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715860584; cv=pass; d=google.com; s=arc-20160816; b=q/n/LeXoMfAv5xfewN8DNb4aPhsfJn8nMTqTYVF5BcUiLMWcKidumVlykpNUxInP4L P8h0vzVIiAfbnMALf+qF171aY6SpYzWwOjvKZfIiq1m6bENnL5hTCNCNv6AjP1nPjs4j 1EYG0RKmRPiilVw6z+EUveBtEvDwzvw66mpxckSrrX1vx0CEJl3ckSLxFolWGVDJSOPz MC8kztlGWUsVbL4DITqhiok6R6trQUDBnrB4f9ADoOpM+1OlePoijZ7taBJtt5Hldp6u LLBaM5mMCyCXt2GydH72YnRS7Xz0F3hLrNPGVzkqGbg//9W0vfltQcF57DVvMLjRl44p flAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=OJk0VDLmJe2K6Dsn2f1ZTNRqPDlvCme3nV40CtZqDfw=; fh=m6agP2PxeXQXIg5IjrS0qtNCK4AGIn5lJtrhg1C0ZFo=; b=0aHzMP5KCzbPDy+jr1xCRKX2kyhTWI5ba4FQBdXJu22yhmZL1IUOn54dDW75RAbD7N doE03v7qgNXx3kKx1kfxM57U/yUiYiEeA5YHyXAsv2QgNtGOw7AGrDUr9vBEM5NTvq+V nEdNOSxnpn1j7l1EWvbwiav3mexp61vwrjJAPk2QRJhG7f/pNJlVbmLP897MdblRxT+Q fiKy/Nien2YHsbkmyKdSv+n82SR6c79FIhE1ysLursbz4oqOYC/T5LSgx63N/UhWieUn vBLvLm4s/zIeXveWVBm/5Syrrq/TasSx5yHDAc5J6zWlYmjYriMPEfkxbupx+D9ROrI2 NEdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@treblig.org header.s=bytemarkmx header.b=gMmQ2SmC; arc=pass (i=1 spf=pass spfdomain=treblig.org dkim=pass dkdomain=treblig.org dmarc=pass fromdomain=treblig.org); spf=pass (google.com: domain of linux-kernel+bounces-180961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=treblig.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba37fesi857811366b.523.2024.05.16.04.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@treblig.org header.s=bytemarkmx header.b=gMmQ2SmC; arc=pass (i=1 spf=pass spfdomain=treblig.org dkim=pass dkdomain=treblig.org dmarc=pass fromdomain=treblig.org); spf=pass (google.com: domain of linux-kernel+bounces-180961-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=treblig.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 286921F21E38 for ; Thu, 16 May 2024 11:56:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 639A4145A14; Thu, 16 May 2024 11:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=treblig.org header.i=@treblig.org header.b="gMmQ2SmC" Received: from mx.treblig.org (mx.treblig.org [46.235.229.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E22926AD0 for ; Thu, 16 May 2024 11:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.229.95 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715860577; cv=none; b=rfFVf5GgokZ26up/bM/BlhCZsy51v58u5yFast3jk8eKbS5yBNk5Jec7EdlPYQieyug+Zy14qBbwaFo9A48TPGwRBTPM/A3WKZP+c46u9MvvZKFUvizGMJ03718FvxxULWWSviUdXa8VTFd4rv7/CwQc7H4ViWmm86IgLD6mfYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715860577; c=relaxed/simple; bh=2B/fjBB4aYHf8t1LxfBe614e9dXmRNTwtbSxV5tvdmo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cpde7C6j5UMjF2E0MSljcitCSP8dK6x4dbQE6Qg+3vFD2Y6hy+B77uHExvc+dLe6EtNZVhEDpxb40PQM7vh+wVeLPo0253e8tizCniH7OY+kJhWPC9Zs9bKDaPw6GO64k3hZkBcrAUiEVBl55iCZWdjXLvYuiESbbJD9JiRBurw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=treblig.org; spf=pass smtp.mailfrom=treblig.org; dkim=pass (2048-bit key) header.d=treblig.org header.i=@treblig.org header.b=gMmQ2SmC; arc=none smtp.client-ip=46.235.229.95 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=treblig.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=treblig.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=Content-Type:MIME-Version:Message-ID:Subject:From:Date:From :Subject; bh=OJk0VDLmJe2K6Dsn2f1ZTNRqPDlvCme3nV40CtZqDfw=; b=gMmQ2SmCWlTGB51t mCMUNETpNHIctdAz6t6GvhJJNGhUnt+ug6N7TNvt++y189g6y9ZDFFj6WtUx4tczdrvHKs3w8mr0J pDvXjfYsfbXNOmqJcWtwOZDYALMEjjm43pL20grvRolQwkzTALKxeCibu5udrxmHRNWUb1WeCaVSt 7UZfS1K1etC06XvlE/7Ksza3qzO3srNJMWKzYlGD2SuAQVjOx6C17xEV2jmMHevRJzB1DXY3QH/87 0FeZaIIa2cypeEOxGl0CBh6QShg+yhJ5lIf1pJZHj9cA81PwF50OqX8K7wAivY2/7zAiJ0XJaOj7d X7/pFIi5AW0ZsZxkMQ==; Received: from dg by mx.treblig.org with local (Exim 4.96) (envelope-from ) id 1s7ZiW-001DAy-1G; Thu, 16 May 2024 11:56:12 +0000 Date: Thu, 16 May 2024 11:56:12 +0000 From: "Dr. David Alan Gilbert" To: Kees Cook Cc: linux-kernel@vger.kernel.org, nathan@kernel.org, luc.vanoostenryck@gmail.com Subject: Re: thoughts wanted on dead code hunting? Message-ID: References: <202405141706.1D5D26C@keescook> <202405152023.67ED1BD7@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <202405152023.67ED1BD7@keescook> X-Chocolate: 70 percent or better cocoa solids preferably X-Operating-System: Linux/6.1.0-21-amd64 (x86_64) X-Uptime: 11:52:45 up 7 days, 23:06, 2 users, load average: 0.00, 0.00, 0.00 User-Agent: Mutt/2.2.12 (2023-09-09) * Kees Cook (keescook@chromium.org) wrote: > On Thu, May 16, 2024 at 12:40:40AM +0000, Dr. David Alan Gilbert wrote: > > * Kees Cook (keescook@chromium.org) wrote: > > > // Options: --recursive-includes > > > @find@ > > > struct to_be_removed INSTANCE; > > > struct to_be_removed *POINTER; > > Oops, I missed this line: > > @@ > > > > > > > ( > > > * INSTANCE > > > | > > > * POINTER > > > ) > > > > > > > > > (I bet this could be improved, but it should be a usable example.) > > > > Hmm, now if I could use coccinelle it would be more tolerant of coding > > style and slight variations than my script. > > However, trying that tiny example, I get: > > File "play.cocci", line 10, column 1, charpos = 141 > > around = '', > > whole content = ) > > > > so it seems to be objecting to something at the end of the file? > > Sorry, yes, missed the "@@" between the identifiers and the code pattern > to match. Ah right, that's done it - I'd noticed there wasn't a @@ but couldn't figure out where to put them. After a bit of guessing, I also added a virtual context at the top and now: make coccicheck COCCI=play.cocci M=arch/x86 MODE=context works - thanks! I'll have a play. Dave > -- > Kees Cook > -- -----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/