Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6450477pxb; Tue, 15 Feb 2022 02:43:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbsFJ8GL84cQBXMn5iJ1z3dy+8uR2CwuxuXG4QyKFPWKgwz+VJOv8xMV0uO4vu50DzSin7 X-Received: by 2002:a63:e70b:: with SMTP id b11mr3012496pgi.142.1644921816477; Tue, 15 Feb 2022 02:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644921816; cv=none; d=google.com; s=arc-20160816; b=oJQGR3eulR++/pCA9H6DSXml+dzppPfuAEkS+deoXCS/UH2IZGYRBWitsXhtyfECQ3 VzUHoWmySKRjzz9VBEFM1CuBEeAEtwwbueNlQvu0ZGxgp7nQn7YYuMkXFNBMV2UP/QtZ Oh9CqDgWXHXj6GNlxFIkt+fvJ9KxFt/fqheXmlvMrCF+5C3WJH7kieGOsjCnzD1FxNNg Tk+oSZzbPBPF7sjpcPQkGx5U8qec4zinL/3C+7Uc2+Acm/GQvTCDiWzZWW/Jz+FVv4f8 837EdoKAXxKyJMm7/pWIS0u0eEbUcnS0bcoFtwmVbFAr8+BkaEjYIlSyuK7x8fUydYd3 1GzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UTelz8ULof2gSjsBcmY6Zg1fgejCRlE5fSYm6lKKjy4=; b=pgnSMpX1YV5vVeYT2jHt6aiXqZnmshhNeP1w90omYcX/pa6oNIimUcD8vpNn2bNhl+ YI2jk/9x7fKP4Z8gpg7tX/nwwDYKysAUsVBsYPNxSIM/qy9LYo17laBqPOOmK62kz8XZ R1193w1wwqoNX5ZdyHKnQvsUvZN9PB1FWNJRF5RDNWzG7KGFSPrJHiE/q2/GSzJP2kIx HOHnDfasZMXw44due971CKTcj2uI1pDVpb9qxq8oJzEnRprVEEa1fb+yUEzLKVzUi07i /Nb/WDxz8WenP9bYd//S3zSG0l7WPala4CzZQ5Xq3S9kpilyK3ovrE5pfSfj93Wc+GTT PiKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VDHh7z+I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9si17376069plc.434.2022.02.15.02.43.21; Tue, 15 Feb 2022 02:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VDHh7z+I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233007AbiBOE0W (ORCPT + 99 others); Mon, 14 Feb 2022 23:26:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiBOE0V (ORCPT ); Mon, 14 Feb 2022 23:26:21 -0500 Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B1CAA8ED5; Mon, 14 Feb 2022 20:26:12 -0800 (PST) Received: by mail-oo1-xc2a.google.com with SMTP id p190-20020a4a2fc7000000b0031820de484aso21804399oop.9; Mon, 14 Feb 2022 20:26:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UTelz8ULof2gSjsBcmY6Zg1fgejCRlE5fSYm6lKKjy4=; b=VDHh7z+IwcbBeMbqb/ts7h9CtBJtyvfF8FwWbf6emVp/mYymuVKbMMqRANFT8nLPpW VCm425TEHngvz36JYjLZN+4o8vveeIyJZaKUMd7trP9ccSMivUMMNwjn4fxk0mnJi+1B mDhTeO5C1X9Fmmc5uoX9AoY+zT2aFZjs5950zzjJiusCHSPv//q5Oh7wfs6GOiiqBQ8t 6PwX/37UFBXhs/cunn5Y/Sy6ojbvNmdK2A3/PXXJQ+1JR9V32r1bI4HnwmtdBv0YHi0l t9V5MRgouIoHU2sxJrO6MdaJgO8dJYeD1LkGRzWS5Yb2gJppiVVTIzXgqI5YzgegKT5S Onjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UTelz8ULof2gSjsBcmY6Zg1fgejCRlE5fSYm6lKKjy4=; b=rn2/HaG3J/ZC0NA+c3YsGbmnttCQQp+fNskAMsJYhJCMGUTGi8jTzTrSHfsk4gw5rx X7T0LvD0d5Bg7HNs6Km99YO87bcm2FV82uTom4hix89ucR3mVujhNG+Bg8fSb/x19xwq 5IEd4XQDoFInXo2NocMvmN1BH+EcVYnvSdlIV/MzGnQFDucLBsts0/QC6vIYmnCJreDA mPj++dpWpph0MF9FCtADFfpJ/OCn10AlE0GWxWaS9yFO0a8aKC5OnGIx1P00/QBYyX2r 2MBU6agsBB49ogpCux/C50guulXDPsgFvOwZsOr0PBN5ZByStwm8Smo1UZhYfmKwhT3N Z2cw== X-Gm-Message-State: AOAM53328K+i8f13wNf4+xu5ojgcVmjRbuzUU2lc1U+zsYZyJTbewDSZ 961cS9oKZ6GlUwS6jvMHnnyqQEdV1+gRyWhqR/Q= X-Received: by 2002:a05:6870:d606:b0:ce:c0c9:657 with SMTP id a6-20020a056870d60600b000cec0c90657mr791380oaq.169.1644899171351; Mon, 14 Feb 2022 20:26:11 -0800 (PST) MIME-Version: 1.0 References: <20220212175922.665442-1-omosnace@redhat.com> In-Reply-To: <20220212175922.665442-1-omosnace@redhat.com> From: Xin Long Date: Tue, 15 Feb 2022 12:26:00 +0800 Message-ID: Subject: Re: [PATCH net v3 0/2] security: fixups for the security hooks in sctp To: Ondrej Mosnacek Cc: network dev , davem , Jakub Kicinski , SElinux list , Paul Moore , Richard Haines , Vlad Yasevich , Neil Horman , Marcelo Ricardo Leitner , "linux-sctp @ vger . kernel . org" , LSM List , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 13, 2022 at 1:59 AM Ondrej Mosnacek wrote: > > This is a third round of patches to fix the SCTP-SELinux interaction > w.r.t. client-side peeloff. The patches are a modified version of Xin > Long's patches posted previously, of which only a part was merged (the > rest was merged for a while, but was later reverted): > https://lore.kernel.org/selinux/cover.1635854268.git.lucien.xin@gmail.com/T/ > > In gist, these patches replace the call to > security_inet_conn_established() in SCTP with a new hook > security_sctp_assoc_established() and implement the new hook in SELinux > so that the client-side association labels are set correctly (which > matters in case the association eventually gets peeled off into a > separate socket). > > Note that other LSMs than SELinux don't implement the SCTP hooks nor > inet_conn_established, so they shouldn't be affected by any of these > changes. > > These patches were tested by selinux-testsuite [1] with an additional > patch [2] and by lksctp-tools func_tests [3]. > > Changes since v2: > - patches 1 and 2 dropped as they are already in mainline (not reverted) > - in patch 3, the return value of security_sctp_assoc_established() is > changed to int, the call is moved earlier in the function, and if the > hook returns an error value, the packet will now be discarded, > aborting the association > - patch 4 has been changed a lot - please see the patch description for > details on how the hook is now implemented and why > > [1] https://github.com/SELinuxProject/selinux-testsuite/ > [2] https://patchwork.kernel.org/project/selinux/patch/20211021144543.740762-1-omosnace@redhat.com/ > [3] https://github.com/sctp/lksctp-tools/tree/master/src/func_tests > > Ondrej Mosnacek (2): > security: add sctp_assoc_established hook > security: implement sctp_assoc_established hook in selinux > > Documentation/security/SCTP.rst | 22 ++++---- > include/linux/lsm_hook_defs.h | 2 + > include/linux/lsm_hooks.h | 5 ++ > include/linux/security.h | 8 +++ > net/sctp/sm_statefuns.c | 8 +-- > security/security.c | 7 +++ > security/selinux/hooks.c | 90 ++++++++++++++++++++++++--------- > 7 files changed, 103 insertions(+), 39 deletions(-) > > -- > 2.34.1 > Reviewed-by: Xin Long