Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1493590ybl; Sat, 25 Jan 2020 01:54:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwiIIoobKSZ14ieCTRrq1CbOgTPY+FbKxCNgBbWaHR3vRdl9tg0yOl92wgI+x7/4+/KCBbl X-Received: by 2002:aca:1b19:: with SMTP id b25mr2004974oib.24.1579946078395; Sat, 25 Jan 2020 01:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579946078; cv=none; d=google.com; s=arc-20160816; b=gqmoUFi+xB/3JASEX1c6Lx+xSNpYo7Q/UKYbQ0QE71neyQNS66NsD0UMfXAG9Kwfp6 GgQLxk9e9Dqf794Fi4JNLXa3BCwTVEb74EZt4XB392kO6KSq24AiecPz1hXVw6WAnDKu V8uu5W96wTmIpwr7KfzsdOkRwQfB35fX6Dh8+GCJdyFqrKcwEQP4NPbQy748cwrX7dAL Pby9D1OVPaXUQEnSfBwveoynEM0aftVkISbx/rvEcoDToL2kME4EbE/9yT7JC5+OVLf6 whWzRGHxm8uuAATkvqvhTRsTgXPojuzFmdf72ZPljSZX4QkgH6NYJGuEvoaECbfYHiTX NbIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=ur+tLkO4fhfDf0WnfaUxK+rCTShVNhGJT2NcyrsbKhk=; b=FIrwJIpJHG9u1dz+6MeNMEY5/WquHISEZE0ElgsQHEYCeSxeNzNQgPxyLol1iJihMn TyjDb/GMP+uIBew9i7269Nc3n8oVe9jwPafTaTgRWFRpBn1lW/G2vlWM9d4RlICUmGEe o+M4GmgXRwHNtkBJ4AHDajjhLCLQgKDAuox72DLTk3Aw2OLiYn+fix/SrwBruSn6h2Oq V7qu06vNdHMA3cwQwRCXK1Xb79r7N4fFbXcTbn9FA3NvYfby1iKO8rYoBcarn83R/3g4 iFZsTjF6dm5jjdDI82lv3EBiEQ5fowxui1Tj5fs9DkR2nyJRz9mNHrCZEpkMejt3jRCu vsPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si4564175otq.40.2020.01.25.01.54.24; Sat, 25 Jan 2020 01:54:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbgAYJxZ (ORCPT + 99 others); Sat, 25 Jan 2020 04:53:25 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:48850 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgAYJxZ (ORCPT ); Sat, 25 Jan 2020 04:53:25 -0500 Received: from localhost (unknown [147.229.117.36]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 43B4415A32105; Sat, 25 Jan 2020 01:53:23 -0800 (PST) Date: Sat, 25 Jan 2020 10:53:21 +0100 (CET) Message-Id: <20200125.105321.1408762540319080985.davem@davemloft.net> To: mpe@ellerman.id.au Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, security@kernel.org, ivansprundel@ioactive.com, vishal@chelsio.com Subject: Re: [PATCH] net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM From: David Miller In-Reply-To: <20200124094144.15831-1-mpe@ellerman.id.au> References: <20200124094144.15831-1-mpe@ellerman.id.au> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sat, 25 Jan 2020 01:53:24 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman Date: Fri, 24 Jan 2020 20:41:44 +1100 > The cxgb3 driver for "Chelsio T3-based gigabit and 10Gb Ethernet > adapters" implements a custom ioctl as SIOCCHIOCTL/SIOCDEVPRIVATE in > cxgb_extension_ioctl(). > > One of the subcommands of the ioctl is CHELSIO_GET_MEM, which appears > to read memory directly out of the adapter and return it to userspace. > It's not entirely clear what the contents of the adapter memory > contains, but the assumption is that it shouldn't be accessible to all > users. > > So add a CAP_NET_ADMIN check to the CHELSIO_GET_MEM case. Put it after > the is_offload() check, which matches two of the other subcommands in > the same function which also check for is_offload() and CAP_NET_ADMIN. > > Found by Ilja by code inspection, not tested as I don't have the > required hardware. > > Reported-by: Ilja Van Sprundel > Signed-off-by: Michael Ellerman Applied and queued up for -stable.