From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [bpf-next PATCH] bpf: sockmap, fix skmsg recvmsg handler to track size correctly Date: Wed, 17 Oct 2018 02:32:52 +0200 Message-ID: <4e315066-0dd3-d39a-9f07-3e5dee876ab0@iogearbox.net> References: <20181016173601.9211.1573.stgit@john-Precision-Tower-5810> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: John Fastabend , ast@kernel.org Return-path: Received: from www62.your-server.de ([213.133.104.62]:44254 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727410AbeJQIZz (ORCPT ); Wed, 17 Oct 2018 04:25:55 -0400 In-Reply-To: <20181016173601.9211.1573.stgit@john-Precision-Tower-5810> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10/16/2018 07:36 PM, John Fastabend wrote: > When converting sockmap to new skmsg generic data structures we missed > that the recvmsg handler did not correctly use sg.size and instead was > using individual elements length. The result is if a sock is closed > with outstanding data we omit the call to sk_mem_uncharge() and can > get the warning below. > > [ 66.728282] WARNING: CPU: 6 PID: 5783 at net/core/stream.c:206 sk_stream_kill_queues+0x1fa/0x210 > > To fix this correct the redirect handler to xfer the size along with > the scatterlist and also decrement the size from the recvmsg handler. > Now when a sock is closed the remaining 'size' will be decremented > with sk_mem_uncharge(). > > Signed-off-by: John Fastabend Applied to bpf-next, thanks!