Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp591032rdb; Thu, 22 Feb 2024 13:01:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlcsBMdQJnAikjK9CupGckTg+HFeghV2p9e9KQ6G9ehgeCig7iSzLSwoZ7uG4gS4IBChkd44vc2Uko18+xxkJJswMtF1xV7H9b8jcslg== X-Google-Smtp-Source: AGHT+IFI12OK73C4PRXEUv44Mw0VtMw5gGVuHZF/NOOyh0gkzCUoUsnExsv1VJ8P9x/cs02VlXWn X-Received: by 2002:a05:6a21:6315:b0:1a0:785c:58c2 with SMTP id wu21-20020a056a21631500b001a0785c58c2mr19089766pzb.61.1708635685569; Thu, 22 Feb 2024 13:01:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708635685; cv=pass; d=google.com; s=arc-20160816; b=fgjbvDhYOQJfH/ZMfKsuNSPIqjYuUN7Bh9G99aRYqCD2FCHhd3wa+i6Nu70SHG2Bfd GZtcy3sara38uVR3TAOcrKqPvUXFmZxhGaeyIjx2TAWWs5HJe0Yqso7PuR8Kr/sIsJL2 Ptrgj/oUY8hCxLRl3qiu3RpqB/GMWvz1m7C4/SCJLVHoUEhg8LuYVZSONlWZ51V+QK5I awSNYLhFaXLg+xbEukPG0utBH4c+UXX2rhDSH2G2ixAqj5XDVDYyCzr6rGA6zCmmNn0e BXFS4nEEtEM/qZ9JH6u4VTrn6mT5kw7AL///bZxJkstRfinM+6xWLvGchXTLXXVyWIuX Vf2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=nwpFD5/+GTNERxZKsWUikWXT7ybqY7JIlXCpe9IyarY=; fh=eMAncE173GH6Z8vuzsiQEySX33ryyekLhTyd7QWOSn4=; b=LTcyixJDSx5KwcHl/QvvficnY5t1o341dGvOO0pcavMZOMH3766MoomFcUemchLyYB RQgepX6ajC1QhxjUcmCI1AxES7W/uvupZVC8kf61QK/bUNwADA5NoErWwGLV3f9YAh5N jQp6V/9H6NfYkBv90VhfyRr7/K7YvdGXPo9ONUHckSMC5W/M7QVpL2vDUn8H8ClHAqPU 30pxqChbacSb4DIwO/vjXjzHCuTf+sDHB5E2LvvnrBIJ0tGGfAr1Q6H+uU8bv1Np36xg Bv5AswnB8i8nAo141xKCrr8ts0TkuG79TrVzGacusFrqQE7fOoWRbjyViTtuUFRKZ/K5 TYpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VtCed+W0; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-77356-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y8-20020a17090a784800b002993349c774si4215016pjl.113.2024.02.22.13.01.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:01:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77356-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VtCed+W0; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-77356-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A3F582858D6 for ; Thu, 22 Feb 2024 21:00:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7587B73F05; Thu, 22 Feb 2024 21:00:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VtCed+W0" Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1116F6E5EC for ; Thu, 22 Feb 2024 21:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635643; cv=none; b=Ib+l+rKN6eQr5RPhYHLAuRlx+G+2K8o6CSvVa3NxnbJQIoqFH2A4r049TDvdyH/D/t3enIOinaCG8AQFERv9mZD9z1NVBJZCmT5B5DuZEim7+Kk2eQIsOXdKFhN8L41YvVNoIDU8EYRyskJsT/4/Ory63owI+gnfD+B0+MsJuyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635643; c=relaxed/simple; bh=HYirffWuREqInys6H1sJGnW444LN+8gm7IIzreiFbV8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OSOmqWhPQQT81MUbawIUG3VUABjs5vj8sZ/mpwU7htwHAqEBMQH3P9NzHhQpEL4fvKGRvmvSkfC1hoFhYkfbxWAUSEJ7zHyOkHVKdOk/n/rgOXoCxWV2ddv/KU7Rer0timkUIPr151tq6cChuTrzgGYzE5kcm8ARnwn5w2P6Pbk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=VtCed+W0; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e4751b97eeso74848b3a.1 for ; Thu, 22 Feb 2024 13:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708635641; x=1709240441; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nwpFD5/+GTNERxZKsWUikWXT7ybqY7JIlXCpe9IyarY=; b=VtCed+W0fGrXk2PMGyL5dqZwL4zC90lxa5dQQq3rqPcJtLiXw3hZ2Hp1vwgcu0Ilrb xFlqOLt/iND4nkLL692ezNq6zDwzc0cF6um2gErDKQJUjWTwYu0BB0MVBR2RUSFkjDxs qgzNP4AqfUaPwYt0BttOmjA7YTjxC9ImQOvsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635641; x=1709240441; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=nwpFD5/+GTNERxZKsWUikWXT7ybqY7JIlXCpe9IyarY=; b=nXYE9ODgXV4v/Qj5mu3cPH0DH1h57qZdhZA1i9L2sxZgxbqTznk6CGGoGykwzEQPSz luodNeKsjsh9oGzdUZ9L/FuxBHU0jthtUiLTe4L0LP8m32s+HajgN1c/84Q84682ztxK MRmYAgq2NCOND1QSmKEyD56IZK+TAqfDUvoA2P7bkDXwKyQPYpJmCvid38DbllyLzkcE AvUexohIh20Qj7z6Alx2vUpPyaugyXs6TyjIy0cZZ3ZzJdEXZzU+pEYVdM3QbDM98Sm1 EWeEsj9HrxryXUGimDaT8vwKDBfZNT04Pho6PDfjwJtTZ/2VSGGRKwl8TealXjC8rQ+W Xa/w== X-Forwarded-Encrypted: i=1; AJvYcCWpdTyTICS6eAfKY8V86v/rdRacyIpzuCJhSSbnQk8yBLbE2D2q9oGFJuQ8e5Zosjbj+/jIN8v8E93MhIimYqpZQK7TuaR81d9mJA0E X-Gm-Message-State: AOJu0Yy0FJjYgCuk/FNqJi5lDfnVUGw1O54QG8iHpuVVFeWz9mg6gN3b egVSNKvCpiZkI11m9qft85/Dc1PEzOIwonNfJzspSTCB2R/FVItLEQI3AfzjLw== X-Received: by 2002:a05:6a21:3945:b0:19e:cce1:ed7e with SMTP id ac5-20020a056a21394500b0019ecce1ed7emr25404565pzc.62.1708635641391; Thu, 22 Feb 2024 13:00:41 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id h2-20020a62b402000000b006e45c823660sm9172303pfn.122.2024.02.22.13.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:00:41 -0800 (PST) Date: Thu, 22 Feb 2024 13:00:40 -0800 From: Kees Cook To: Tycho Andersen Cc: "Tobin C. Harding" , Greg KH , Guixiong Wei , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] leaking_addresses: Provide mechanism to scan binary files Message-ID: <202402221249.FA17A8940@keescook> References: <20240218173809.work.286-kees@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Feb 22, 2024 at 08:24:02AM -0700, Tycho Andersen wrote: > Hi Kees, > > On Sun, Feb 18, 2024 at 09:38:12AM -0800, Kees Cook wrote: > > Introduce --kallsyms argument for scanning binary files for known symbol > > addresses. This would have found the exposure in /sys/kernel/notes: > > > > $ scripts/leaking_addresses.pl --kallsyms=<(sudo cat /proc/kallsyms) > > /sys/kernel/notes: hypercall_page @ 156 > > /sys/kernel/notes: xen_hypercall_set_trap_table @ 156 > > /sys/kernel/notes: startup_xen @ 132 > > > > Signed-off-by: Kees Cook > > Patch itself is > > Reviewed-by: Tycho Andersen > > And if you can carry it, that would be great (see below :). Sure! > This does bring up some interesting questions. From off-list > discussions with Tobin, I believe he is not particularly interested in > maintaining this script any more. I was never set up to do the PRs > myself, I agreed to be a reviewer to help Tobin out. I'm happy to > adopt it if that makes sense, but I'm curious about the future of the > script: > > 1. is it useful? (seems like yes if you're adding features) Yes, LKP runs it as part of 0-day, and it's found leaks in the past[1]. (Though its usage could be improved.) > 2. does it make sense to live here as a separate thing? should we > perhaps run it as part of kselftests or similar? I think that e.g. > 681ff0181bbf ("x86/mm/init/32: Stop printing the virtual memory > layout") was not discovered with this script, but maybe if we put it > inline with some other stuff people regularly run more of these would > fall out? Maybe it makes sense to live somewhere else entirely > (syzkaller)? I can probably set up some x86/arm64 infra to run it > regularly, but that won't catch other less popular arches. We could certainly do that. It would need some work to clean it up, though -- it seems like it wasn't designed to run as root (which is how LKP runs it, and likely how at least some CIs would run it). > 3. perl. I'm mostly not a perl programmer, but would be happy to > rewrite it in python pending the outcome of discussion above. I am not a Perl fan either. It does work as-is, though. Address leaks, while worth fixing, are relatively low priority over all, so I wouldn't prioritize a rewrite very highly. -Kees [1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/ -- Kees Cook