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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C91BEC19F2B for ; Fri, 29 Jul 2022 02:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233804AbiG2CbC (ORCPT ); Thu, 28 Jul 2022 22:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231522AbiG2Ca7 (ORCPT ); Thu, 28 Jul 2022 22:30:59 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F10A6A9E4; Thu, 28 Jul 2022 19:30:58 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oHFln-005h7C-M5; Fri, 29 Jul 2022 12:30:33 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 29 Jul 2022 10:30:31 +0800 Date: Fri, 29 Jul 2022 10:30:31 +0800 From: Herbert Xu To: Abhishek Shah Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, steffen.klassert@secunet.com, linux-kernel@vger.kernel.org, Gabriel Ryan , Fan Du Subject: Re: Race 1 in net/xfrm/xfrm_algo.c Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 28, 2022 at 08:00:00PM -0400, Abhishek Shah wrote: > Dear Herbert, > > Thanks for your quick reply and sorry for not being more clear about the > inconsistencies. We identified security implications when algorithms > disappear or reappear during the execution of *compose_sadb_supported*. > > In more detail, > > 1) If after *xfrm_count_pfkey_auth_supported* has finished counting the > available algos, a secondary thread changes the availability of an algo > through *xfrm_probe_algs*, it will return an incorrect number of available > algorithms. If an algo was added during the racing access, the code > allocates a buffer that is smaller than the number of available algorithms > at net/key/af_key.c#L1619 > . > This will result in an out of bounds write when the buffer is later > populated at net/key/af_key.c#L1657 > . OK this is a real bug caused by this commit: commit 283bc9f35bbbcb0e9ab4e6d2427da7f9f710d52d Author: Fan Du Date: Thu Nov 7 17:47:50 2013 +0800 xfrm: Namespacify xfrm state/policy locks It neglected to convert xfrm_probe_algs to namespaces so the previous assumption of exclusive ownership of xfrm_algo_list by the current afkey request is no longer true. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt