Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2717893ybl; Thu, 29 Aug 2019 11:54:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc0lTHNvo6+jbxdNSvk/IhmnqEWX7jSTJ8XIFxQG127M8whvMqetptVLnBVKCEkMd/ds7f X-Received: by 2002:a63:2784:: with SMTP id n126mr9390063pgn.92.1567104887151; Thu, 29 Aug 2019 11:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567104887; cv=none; d=google.com; s=arc-20160816; b=cev/7BWwkFkyYtHPeyd+E5Cve9Avyf+pbiW8DnaVXJXF+XgFDTXzHVGgTrYIkeOIfd DaATSxgdujmvx5bDY2RXL8FBdaUG4lwSxFE7x4rpNMrOrsJqjUNGsmXQfzijELzO+hV6 kF+llclWcPXHh1dmZvRRj5OQfbbLi2yWm0ttN96lVu53oT1WXdPpfTt0vNp9QMxA4jWb zdnZ9BOo/B/p13sV7Ni+9c2F9Tn9GP2SqTFXl85dmJ5jC/46iYA+tnyq95/DgAlwouNw HAmA0WqFvM6C99k+g4H8jin5CMqbWkTp5u1EVFWIxy7HBcvtvzoNJaw6E7sz0Nb2LGqM AYWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=8DrLJYkJSDE8yNy0hRWD87xXnqGiLOj6Q5kMDIVILTo=; b=aPMObiUWOhC/r+c691otVoStb3dWxoXHmzOf1y/bS7mREJWoZZRY2STT8bH2HIg5Fw zYBzCiHsjsIwqKCU4gMewFkJGgmLKUh3Upe8Z+DNcFEBEF3Q2DLzACWUAMasbBRwrTwN YOynKo98Oos0upQjzkfalOzfQVOGAWCbzdZ3DJP0UcIDzhb94KYzmxV/nFLOtLciRtQt ZJb9PrT8cgzfsYktME1lkp0Wsxfhojc7rtJr5hCfRmEJ7OF1IXlPQNmTowsNJ6nDnblc QrMB6Meo/QveCJQiGo5/VPfLcwmcve2EW9zvRwQm87pRRkw664xJz8krL2opa6pP2Q6l QVCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=m3NGDl7h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si2697406plq.188.2019.08.29.11.54.32; Thu, 29 Aug 2019 11:54:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=m3NGDl7h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728612AbfH2Sxn (ORCPT + 99 others); Thu, 29 Aug 2019 14:53:43 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:35006 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfH2Sxm (ORCPT ); Thu, 29 Aug 2019 14:53:42 -0400 Received: by mail-ed1-f67.google.com with SMTP id t50so5196910edd.2 for ; Thu, 29 Aug 2019 11:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=8DrLJYkJSDE8yNy0hRWD87xXnqGiLOj6Q5kMDIVILTo=; b=m3NGDl7hjD+pzGgurTlgTCSL/BEaKxEELRGKgiRlKZ/FPBlvDKeFYDy8pUB5aMUjop R1imImwALYyWHL+UzB2n1ZoevwjUcrNiarQjRCaR9mAVrZg5kPskOWCqxJJ5XvEEJER+ 5YYooJ1a4H0TCpLtIceMxZP+jLsGSZhQzGg7w73h1dIkYdnQTuEVVk4J3IMmUrIke3E9 55Fn5mGoyrv6vB7KyAZRbUjhs7Iu/oQEfflYsxmjmCG/xutlzUMglCQi4oGyBisLuWEj mAzlM0ZDkHP6gwkHxv5TARcTE1TrIkbJiWshIBdpA7PyOtHjrB7uIrkgKallm9m3k6HW 3uHw== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=8DrLJYkJSDE8yNy0hRWD87xXnqGiLOj6Q5kMDIVILTo=; b=q8V7N6yjR5hKd3znqq1Vh2FJ/JWzbQ9TW9cN5gwLwmcctk0BkhFygzQ9tD4BxLwwLy iWgU9RJTCMKUj/cv4stTnCcC2hd59InTyHRbKL/oNMHKJ2JKN3pFeKGRAJkGBhKTykVz 3loEuOFr6PBA6QO6XqU0sQxHpGzO0chSlgzjszVCwcjHzHN73vlw8mu7mFFLhdVBXWDj 0bEzs7LWxsWyuLjVGRiMrJuAwflCV3zL+XvFgmh05jKgZP112mZysYQRc0j7yD1RB28x +on5u5GhWZaZpvscFUQYelGMihMKsSVPL61nAKWHGk91IO0pN1JvgCdg3UQp8Gbaun3x DlKg== X-Gm-Message-State: APjAAAV5JUNiMaSbQFSVfGtMI6XJLx/shGMf163X4/b+TjlEwLjhB9P/ arWrBfCOa6ToD+epPik2OdI5kQ== X-Received: by 2002:a50:8ec9:: with SMTP id x9mr11413207edx.89.1567104821374; Thu, 29 Aug 2019 11:53:41 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id s22sm590615eds.67.2019.08.29.11.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 11:53:41 -0700 (PDT) Date: Thu, 29 Aug 2019 11:53:15 -0700 From: Jakub Kicinski To: John Fastabend Cc: Hillf Danton , syzbot , aviadye@mellanox.com, borisp@mellanox.com, daniel@iogearbox.net, davejwatson@fb.com, davem@davemloft.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: general protection fault in tls_sk_proto_close (2) Message-ID: <20190829115315.5686c18f@cakuba.netronome.com> In-Reply-To: <5d681e0011c7b_6b462ad11252c5c084@john-XPS-13-9370.notmuch> References: <000000000000c3c461059127a1c4@google.com> <20190829035200.3340-1-hdanton@sina.com> <20190829094343.0248c61c@cakuba.netronome.com> <5d681e0011c7b_6b462ad11252c5c084@john-XPS-13-9370.notmuch> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Aug 2019 11:48:32 -0700, John Fastabend wrote: > Jakub Kicinski wrote: > > On Thu, 29 Aug 2019 11:52:00 +0800, Hillf Danton wrote: > > > Alternatively work is done if sock is closed again. Anyway ctx is reset > > > under sock's callback lock in write mode. > > > > > > --- a/net/tls/tls_main.c > > > +++ b/net/tls/tls_main.c > > > @@ -295,6 +295,8 @@ static void tls_sk_proto_close(struct so > > > long timeo = sock_sndtimeo(sk, 0); > > > bool free_ctx; > > > > > > + if (!ctx) > > > + return; > > > if (ctx->tx_conf == TLS_SW) > > > tls_sw_cancel_work_tx(ctx); > > > > That's no bueno, the real socket's close will never get called. > > Seems when we refactored BPF side we dropped the check for ULP on one > path so I'll add that back now. It would be nice and seems we are > getting closer now that tls side is a bit more dynamic if the ordering > didn't matter. We'd probably need some more generic way of communicating the changes in sk_proto stack, e.g. by moving the update into one of sk_proto callbacks? but yes. > diff --git a/net/core/sock_map.c b/net/core/sock_map.c > index 1330a7442e5b..30d11558740e 100644 > --- a/net/core/sock_map.c > +++ b/net/core/sock_map.c > @@ -666,6 +666,8 @@ static int sock_hash_update_common(struct bpf_map *map, void *key, > WARN_ON_ONCE(!rcu_read_lock_held()); > if (unlikely(flags > BPF_EXIST)) > return -EINVAL; > + if (unlikely(icsk->icsk_ulp_data)) > + return -EINVAL; > > link = sk_psock_init_link(); > if (!link) Thanks! That looks good, if you feel like submitting officially feel free to add my Reviewed-by!