Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2934119ybl; Thu, 29 Aug 2019 15:20:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxap73VAJVdw3sV7Z9tm+qCZe/cvhe8uPOf59wGCpXUaakxdLOqQ03HFmkRbzGooe7DYHUR X-Received: by 2002:a65:6108:: with SMTP id z8mr10358703pgu.289.1567117202040; Thu, 29 Aug 2019 15:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567117202; cv=none; d=google.com; s=arc-20160816; b=zGkcnYoRH33kHCw5zXT+mmK4kS2SNVLnLSL0x1jeLS+29SX7kAdVhjwt7+B8uNoLNU hBhUM3jF/czFwITeE+Z0J9mH9h0OAZOZ3P1KYRaCpvd+2kYgVpBg+qJrV6Clb+ofTgK6 sy5PRXa0Ozy/O+ZRw3xGSW/M0DDXo2AT7i+SwDovCWXb+BEAPiNbX67VgMH1WUbzs/dU QDUXjCKSPU3yhjWJy48AfrDcHLHgHdO/rXf93du+JUNTwPpZB/TKfwCz6mWLLWr1pM+d UGD9A/L6sS7Zji5NPKY83zDp19vZSiPZUDnVv48kUH2pjAoTroYY349UWDJVVWT21en/ faVg== 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 :subject:references:in-reply-to:message-id:cc:to:from:date :dkim-signature; bh=NMzxTj9QgBh2Pr7Ne/3+OQ1awCT7xR3SvdwiV+lU5kA=; b=lz4fVryKl9m38uQddMiwdlUU0curNMKndUsc/VqQwFrbYXTd3iMWIp0Z80v87En4UY E4rQIpa2yYK3Qy2lW2pTG7+Li0XO+e+GMXJY2j56cxW2WhYxd9toFlhwSmi1azG/Wcks CoQXNnilO/rETXUpefTzZ/4AhF7CbUjMVFv7FP4ngt2NfFZ0NlIO+T0l3gFnGsWePBym mhwZxz+VYLjeCWBjToMJsExLWQbaUUbJPiBOzVmosnsX3z3JINBvX+6/JvKLg9nswcJL qWyPKdQVTHJ8NL3c3jyH0v65E8rQ5M3kVBJRCWLZuNXquoyqhcqSmsoEJXNom0tJKFs+ zE2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MyLzrazQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si3075256pgr.196.2019.08.29.15.19.46; Thu, 29 Aug 2019 15:20:02 -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=@gmail.com header.s=20161025 header.b=MyLzrazQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728158AbfH2WS5 (ORCPT + 99 others); Thu, 29 Aug 2019 18:18:57 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:45799 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727929AbfH2WS4 (ORCPT ); Thu, 29 Aug 2019 18:18:56 -0400 Received: by mail-io1-f67.google.com with SMTP id t3so10042592ioj.12; Thu, 29 Aug 2019 15:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=NMzxTj9QgBh2Pr7Ne/3+OQ1awCT7xR3SvdwiV+lU5kA=; b=MyLzrazQhX13DC7Ra6s73Pf+C0n1A5aU0ML4n8KJN3BhOX+4zDH2Q3czsXDo77LaXh WqJRfFEvUMQPw53Ja7xCvFA3QPN6gY/AvDitALBHQ/eM3HGKVwPmtWPjUJZb9dqAbomd b9CerBqFccvAHBoRWxkcF81IE9N61nKtwIMCVeP4KauUAdEqh2Yu3lvO3pH5LxyeaZsc wVs4pZMsJQacyjs74+yeSAhEPMafF1mPnk08K8oWMt4eiYUtKtTeK8BwW5HY8MYrRMzl U0o6wiVVyLE7FHSUt/gSI78JUZ0znvQNfiGRh/YHfjXklKD9di3J/6J6XG276KxPQz12 wjQw== 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:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=NMzxTj9QgBh2Pr7Ne/3+OQ1awCT7xR3SvdwiV+lU5kA=; b=MI0ih3eITixAYaMeWlBtCH4HOf5663seZlgm/BwI2Rr6slEJ2ONaOZ9tno6Lcb6oKS Q2imIu4oA70krNcJj/3PVpDWHydfeydVscPTmdr+oTxmChF6HSI90IVWpR5IOP2UZIB1 slpFVe8pg+71qoc9pAohtC0SWyGWDxWfOGBp+p+BEcMT4GBsVWcdoAwveSzd7umYQGnw ajhWPRoZ6qmEgq3PngJEsdrUKNR1tnqTau+DE5B2U/isX3bjfu2q7xgoEdQgLh+m5mB/ 6Iy/4ig/D8wb2LfYj736hJYvShrWdB61z47Hud1jbJ4biL1rIlU/Yg94Ie7UlvWydgci cKSQ== X-Gm-Message-State: APjAAAWGyxrEBfn0jSuS3IoZaAN9RDOSBudA5X12mnBnaCgTgb5IaK9m zAWB/CeJmHkTZswmCLNVaTQ= X-Received: by 2002:a5d:97d7:: with SMTP id k23mr13736369ios.129.1567117135905; Thu, 29 Aug 2019 15:18:55 -0700 (PDT) Received: from localhost ([184.63.162.180]) by smtp.gmail.com with ESMTPSA id n25sm2821784iop.3.2019.08.29.15.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 15:18:55 -0700 (PDT) Date: Thu, 29 Aug 2019 15:18:46 -0700 From: John Fastabend To: Jakub Kicinski , 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 Message-ID: <5d684f46b5c51_6192b27353185bcf7@john-XPS-13-9370.notmuch> In-Reply-To: <20190829115315.5686c18f@cakuba.netronome.com> References: <000000000000c3c461059127a1c4@google.com> <20190829035200.3340-1-hdanton@sina.com> <20190829094343.0248c61c@cakuba.netronome.com> <5d681e0011c7b_6b462ad11252c5c084@john-XPS-13-9370.notmuch> <20190829115315.5686c18f@cakuba.netronome.com> Subject: Re: general protection fault in tls_sk_proto_close (2) Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jakub Kicinski wrote: > 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! I'll send it out this evening after running the selftests. .John