From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1494338600.2410.6.camel@sipsolutions.net> From: Johannes Berg Date: Tue, 09 May 2017 16:03:20 +0200 In-Reply-To: <20170509135009.13751-1-Jason@zx2c4.com> (sfid-20170509_155352_302082_2551EB62) References: <20170509135009.13751-1-Jason@zx2c4.com> (sfid-20170509_155352_302082_2551EB62) Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [kernel-hardening] Re: [PATCH v7 0/5] skb_to_sgvec hardening To: "Jason A. Donenfeld" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, kernel-hardening@lists.openwall.com List-ID: On Tue, 2017-05-09 at 15:50 +0200, Jason A. Donenfeld wrote: > The recent bug with macsec and historical one with virtio have > indicated that letting skb_to_sgvec trounce all over an sglist > without checking the length is probably a bad idea. And it's not > necessary either: an sglist already explicitly marks its last > item, and the initialization functions are diligent in doing so. > Thus there's a clear way of avoiding future overflows. > > So, this patchset, from a high level, makes skb_to_sgvec return > a potential error code, and then adjusts all callers to check > for the error code. Perhaps you should add __must_check annotation to the function prototype(s)? johannes From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753828AbdEIODb (ORCPT ); Tue, 9 May 2017 10:03:31 -0400 Received: from s3.sipsolutions.net ([5.9.151.49]:48328 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbdEIODa (ORCPT ); Tue, 9 May 2017 10:03:30 -0400 Message-ID: <1494338600.2410.6.camel@sipsolutions.net> Subject: Re: [PATCH v7 0/5] skb_to_sgvec hardening From: Johannes Berg To: "Jason A. Donenfeld" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, kernel-hardening@lists.openwall.com Date: Tue, 09 May 2017 16:03:20 +0200 In-Reply-To: <20170509135009.13751-1-Jason@zx2c4.com> (sfid-20170509_155352_302082_2551EB62) References: <20170509135009.13751-1-Jason@zx2c4.com> (sfid-20170509_155352_302082_2551EB62) Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-05-09 at 15:50 +0200, Jason A. Donenfeld wrote: > The recent bug with macsec and historical one with virtio have > indicated that letting skb_to_sgvec trounce all over an sglist > without checking the length is probably a bad idea. And it's not > necessary either: an sglist already explicitly marks its last > item, and the initialization functions are diligent in doing so. > Thus there's a clear way of avoiding future overflows. > > So, this patchset, from a high level, makes skb_to_sgvec return > a potential error code, and then adjusts all callers to check > for the error code. Perhaps you should add __must_check annotation to the function prototype(s)? johannes