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=-3.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,USER_AGENT_GIT 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 AE32EC43381 for ; Fri, 1 Mar 2019 19:49:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F21D20848 for ; Fri, 1 Mar 2019 19:49:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="i4ZdszaH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbfCATtW (ORCPT ); Fri, 1 Mar 2019 14:49:22 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:43476 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725862AbfCATtV (ORCPT ); Fri, 1 Mar 2019 14:49:21 -0500 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x21JmDi1024751 for ; Fri, 1 Mar 2019 11:49:20 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=234zDuJi9S3H0ZfagB4gJcAGeJrv8E3+kwo7H2GiOR4=; b=i4ZdszaH+k+U+4LvTn4noJRibdffk6RuB+9lgZCAEINihaG9MpwWWGYCAsvAR3+V5Riw O+QFdQXHEvUIiKHPRdMvRCoVEDvvNOpTY+TbWcjkMKOOTTddMc0wnhBMRVGOL0W6Vgd/ gMI0PmAeZgM0UlqfEdFbGTFtf6zaY0aOs+I= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2qyajxg52e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 01 Mar 2019 11:49:20 -0800 Received: from mx-out.facebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5; Fri, 1 Mar 2019 11:49:19 -0800 Received: by devbig005.ftw2.facebook.com (Postfix, from userid 6611) id 354FB2941A14; Fri, 1 Mar 2019 11:49:18 -0800 (PST) Smtp-Origin-Hostprefix: devbig From: Martin KaFai Lau Smtp-Origin-Hostname: devbig005.ftw2.facebook.com To: CC: Alexei Starovoitov , Daniel Borkmann , Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH v2 bpf-next 0/2] Fix bpf_tcp_sock and bpf_sk_fullsock issue related to bpf_sk_release Date: Fri, 1 Mar 2019 11:49:18 -0800 Message-ID: <20190301194918.2856285-1-kafai@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-01_13:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This set addresses issue about accessing invalid ptr returned from bpf_tcp_sock() and bpf_sk_fullsock() after bpf_sk_release(). v2: - Remove refcount_id arg from release_reference() because id == refcount_id - Add a WARN_ON_ONCE to mark_ptr_or_null_regs() to catch an internal verifier bug. Martin KaFai Lau (2): bpf: Fix bpf_tcp_sock and bpf_sk_fullsock issue related to bpf_sk_release bpf: Test ref release issue in bpf_tcp_sock and bpf_sk_fullsock. include/linux/bpf_verifier.h | 9 ++ kernel/bpf/verifier.c | 86 +++++++++++-------- .../selftests/bpf/verifier/ref_tracking.c | 73 ++++++++++++++++ 3 files changed, 134 insertions(+), 34 deletions(-) -- 2.17.1