From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C14BC33CB1 for ; Sun, 19 Jan 2020 12:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E60D206D7 for ; Sun, 19 Jan 2020 12:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726860AbgASMco (ORCPT ); Sun, 19 Jan 2020 07:32:44 -0500 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:51710 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbgASMco (ORCPT ); Sun, 19 Jan 2020 07:32:44 -0500 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1it9kt-0002tD-F7; Sun, 19 Jan 2020 13:32:39 +0100 Date: Sun, 19 Jan 2020 13:32:39 +0100 From: Florian Westphal To: David Miller Cc: fw@strlen.de, netdev@vger.kernel.org Subject: Re: [PATCH net-next] netlink: make getters tolerate NULL nla arg Message-ID: <20200119123239.GB795@breakpoint.cc> References: <20200116145522.28803-1-fw@strlen.de> <20200117.040849.2032549448991143345.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200117.040849.2032549448991143345.davem@davemloft.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller wrote: > From: Florian Westphal > Date: Thu, 16 Jan 2020 15:55:22 +0100 > > > One recurring bug pattern triggered by syzbot is NULL dereference in > > netlink code paths due to a missing "tb[NL_ARG_FOO] != NULL" test. > > > > At least some of these missing checks would not have crashed the kernel if > > the various nla_get_XXX helpers would return 0 in case of missing arg. > > > > Make the helpers return 0 instead of crashing when a null nla is provided. > > Even with allyesconfig the .text increase is only about 350 bytes. > > > > Signed-off-by: Florian Westphal > > Sorry, I think it's better to find out when code is trying to access > attributes without verifying that they are even supplied. Less than 24 hours after I saw this patch marked rejected syzbot reported another incarnation of this pattern. Would you consider a v2 with a WARN_ON_ONCE() added (and the buildbot warning resolved)? Thanks.