From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alasdair G Kergon Subject: Re: [PATCH] dm ioctl: prevent stack leak in dm ioctl call Date: Wed, 26 Apr 2017 02:06:09 +0100 Message-ID: <20170426010608.GD7433@agk-dp.fab.redhat.com> References: <20170425233129.GA155598@google.com> <20170426001117.GA7433@agk-dp.fab.redhat.com> <20170426004245.GB7433@agk-dp.fab.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Adrian Salido Cc: dm-devel@redhat.com, snitzer@redhat.com, agk@redhat.com List-Id: dm-devel.ids On Tue, Apr 25, 2017 at 05:57:41PM -0700, Adrian Salido wrote: > 1. param_kernel is allocated from stack and passed to copy_params > 2. copy_params only copies up to param_kernel->data from user > (param_kernel->data still contains stack contents) > 3. in copy_params, since there are no params it will skip through and > return param = dmi = param_kernel after setting dmi->data_size = minimum_data_size; and then input_param_size = param->data_size; > 4. that stale data is copied back to user because it is incorrectly extending the buffer? param->data_size = sizeof(*param); instead of continuing to use input_param_size? Alasdair