Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936281AbdCJMC7 (ORCPT ); Fri, 10 Mar 2017 07:02:59 -0500 Received: from mail-ua0-f170.google.com ([209.85.217.170]:32835 "EHLO mail-ua0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936009AbdCJMC2 (ORCPT ); Fri, 10 Mar 2017 07:02:28 -0500 MIME-Version: 1.0 X-Originating-IP: [108.49.102.27] In-Reply-To: <20170308.231208.1651420232093147373.davem@davemloft.net> References: <20170306184614.20056-1-glider@google.com> <20170308.231208.1651420232093147373.davem@davemloft.net> From: Paul Moore Date: Fri, 10 Mar 2017 07:01:47 -0500 Message-ID: Subject: Re: [PATCH v2] selinux: check for address length in selinux_socket_bind() To: David Miller , Stephen Smalley Cc: glider@google.com, dvyukov@google.com, kcc@google.com, keescook@chromium.org, edumazet@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, selinux@tycho.nsa.gov Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 30 On Thu, Mar 9, 2017 at 2:12 AM, David Miller wrote: > From: Alexander Potapenko > Date: Mon, 6 Mar 2017 19:46:14 +0100 > >> KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of >> uninitialized memory in selinux_socket_bind(): > ... >> (the line numbers are relative to 4.8-rc6, but the bug persists upstream) >> >> , when I run the following program as root: > ... >> (for different values of |size| other error reports are printed). >> >> This happens because bind() unconditionally copies |size| bytes of >> |addr| to the kernel, leaving the rest uninitialized. Then >> security_socket_bind() reads the IP address bytes, including the >> uninitialized ones, to determine the port, or e.g. pass them further to >> sel_netnode_find(), which uses them to calculate a hash. >> >> Signed-off-by: Alexander Potapenko > > Are the SELINUX folks going to pick this up or should I? Yes, it's on my list of things to merge, I was just a bit distracted this week with yet another audit problem. I'm going to start making my way through the patch backlog today. -- paul moore www.paul-moore.com