Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3008947pxb; Tue, 13 Apr 2021 16:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZTIigjsrTju8WRW4aQj8RBUQhwkLr9uYvc7N4UxQiDAVfmExymVrOhNWw4r1lAKy/8OF7 X-Received: by 2002:a17:906:cc48:: with SMTP id mm8mr8787073ejb.58.1618355847812; Tue, 13 Apr 2021 16:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618355847; cv=none; d=google.com; s=arc-20160816; b=bKrJoMyEEnIQuc7hPtplwHDEWGQhYxf4OgGDWiBKHuqP9mIGJOcFAS+5XpPxld/aSu T/NSafH1VHlg8F6zAWjl7xhphP6afexobcykbE88tyE8C79cRWq2rK3IH4p5x+O5lI17 m5dabN6ioO8JllldzFdgen/882sA7IIqy7+gJcvfYJoUEg3W7Xz1d0bmpLrbwcIuVn7D BwDcylwxmG+aMe84Y+oRvmg1FRcDvawc0myAVxr2emCPbY/At4qqX7ChwO8aVz0EseuL TC3V308KSuW38mrPHJpHwgQWSOOmPcUF2/5cV/9q4qCmJk0EnEUcv7eHsbLZA8EhbR63 hFBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LdE+UQyPBir3qEoJ25yiHIhY36a9GrhFUDezW/crBk4=; b=CfERW7pRF7VZc27gUdwxTJ/6kLiYFiCT+OCLKucdWZjjEQzJonXH1R3xIQaJwD4O// 0gnf56o0angIcVDlOJnb/w4K8mIGrRX9lURx4t/i1eno825zasmMumOqV9EZ/aEWEZIE nxc2vcuGlqY+HkMBNU2IJh51dWs9d14PoSs28bjAAbhsbopOBIgeEnGO5dRNTD8pmiLl 1+mW9V/q0aTU80lHASxWKejiX8b5bHKb7FhnlSxI4RIUt4Q8lC0U4FqO6wMbBjx/TtUC Q1lzOPGwdMvlPLhMLoEb4JB88/vQOWSbTfvF/u0DRu3wF/MvMVBpbn8xG8dTM5A5cN+u 0zaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BEK3HZeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si210970edm.217.2021.04.13.16.17.04; Tue, 13 Apr 2021 16:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BEK3HZeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344138AbhDMTI5 (ORCPT + 99 others); Tue, 13 Apr 2021 15:08:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343838AbhDMTIv (ORCPT ); Tue, 13 Apr 2021 15:08:51 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF5CC061574; Tue, 13 Apr 2021 12:08:31 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id j3so8644928qvs.1; Tue, 13 Apr 2021 12:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LdE+UQyPBir3qEoJ25yiHIhY36a9GrhFUDezW/crBk4=; b=BEK3HZeWPrQDeh+CQpY/A2Suo78Mt9YLm+JV/SteoPBcRqJQC7v0VsCNMosSzHucsc 5JsdaE+HufhKwm6r1EmXlughUDl6JLpOmFD6PS1SPmh5FKzW1b2t4YEa/WdJP7/Vaj+v TvSFnwq+6PAqsZ62Y5cZCFkBfNGAeNJxF9NGOWJl8+kRkbbFeMfNs2VKGWhIKToOwElt qG11q2fIKtXIE/bEiG2fvlTBg7z7eYZQh+T8wKO0m7Swuhzona8gF9NJHvQ3G3kXRMK/ GB98jjUK6oLImzAERXJ3KaJA6r9XrgCL8YR3g2GgefZQUOtc8zrBgvOqmPO69kDlSh3A 7K7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LdE+UQyPBir3qEoJ25yiHIhY36a9GrhFUDezW/crBk4=; b=H3nuYi+4zr3+am35DZQOCl6JZyWHnBteokAbviKQVqyGB7rruXyCcLABu+cE1Xftee 4engbbNKT8y2Opx/yBuE+0wQf3CNj0YAYaDQG0nO3ucUbrNm/mZn4eNlvf2wd3qMdMiA 3YMHv+g8Par5Rdc7E+V02FBzLtSr7wiWrvaoRdjjuITca+bomA/bFKqxoukcfncz9Imf nvu7/v2SHZpGHF/4f702Sf+Q2WLVMeQzmoITiy1BvkPTHXuZbcE8C2WFYJJugfOlszbL jGpQGaWc3w6UYrDmwkL/esPbl1oXLLi8pbnza4jCPBRsOwsK77BZ7mMDJ0yukp74Mr8C 7bYA== X-Gm-Message-State: AOAM5319dpHivxGT8DtTb0YjIuDG1zq/VybkMU4p84rzoeRDXtoH0Nea Vet6x/6a5A0Q/w3qqFt0cxFDkAOMm2txcggb X-Received: by 2002:a05:6214:19c4:: with SMTP id j4mr34361602qvc.27.1618340910256; Tue, 13 Apr 2021 12:08:30 -0700 (PDT) Received: from horizon.localdomain ([177.220.174.149]) by smtp.gmail.com with ESMTPSA id t6sm4792130qtq.83.2021.04.13.12.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 12:08:29 -0700 (PDT) Received: by horizon.localdomain (Postfix, from userid 1000) id 7CAA2C0784; Tue, 13 Apr 2021 16:08:27 -0300 (-03) Date: Tue, 13 Apr 2021 16:08:27 -0300 From: Marcelo Ricardo Leitner To: Or Cohen Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, vyasevich@gmail.com, nhorman@tuxdriver.com, davem@davemloft.net, kuba@kernel.org, linux-sctp@vger.kernel.org, lucien.xin@gmail.com, nmarkus@paloaltonetworks.com Subject: Re: [PATCH v2] net/sctp: fix race condition in sctp_destroy_sock Message-ID: References: <20210413181031.27557-1-orcohen@paloaltonetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210413181031.27557-1-orcohen@paloaltonetworks.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 09:10:31PM +0300, Or Cohen wrote: > If sctp_destroy_sock is called without sock_net(sk)->sctp.addr_wq_lock > held and sp->do_auto_asconf is true, then an element is removed > from the auto_asconf_splist without any proper locking. > > This can happen in the following functions: > 1. In sctp_accept, if sctp_sock_migrate fails. > 2. In inet_create or inet6_create, if there is a bpf program > attached to BPF_CGROUP_INET_SOCK_CREATE which denies > creation of the sctp socket. > > The bug is fixed by acquiring addr_wq_lock in sctp_destroy_sock > instead of sctp_close. > > This addresses CVE-2021-23133. > > Reported-by: Or Cohen > Reviewed-by: Xin Long > Fixes: 610236587600 ("bpf: Add new cgroup attach type to enable sock modifications") > Signed-off-by: Or Cohen Thanks folks. Acked-by: Marcelo Ricardo Leitner