From mboxrd@z Thu Jan 1 00:00:00 1970 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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 22FBEC64E8A for ; Mon, 30 Nov 2020 16:22:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2E3F20855 for ; Mon, 30 Nov 2020 16:22:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CHxhyjjt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728682AbgK3QWW (ORCPT ); Mon, 30 Nov 2020 11:22:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgK3QWV (ORCPT ); Mon, 30 Nov 2020 11:22:21 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7C1C0613D2 for ; Mon, 30 Nov 2020 08:21:35 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id v14so13421184wml.1 for ; Mon, 30 Nov 2020 08:21:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6o+tTuRWUftSik6GCGw8PaA9/bP4unYZlgapimV10cE=; b=CHxhyjjtBrM1bZN2TVbDcL8qeErZNUNi+SafUYP7Kg7+NIqXNes+kEG8k64ix56b4N ixyeYLmzpaZnPyuwDwYnEs/vBGQu5WCq58s24emZtL52HCgLd8OZLtEcy6gOoMHn/8bq YwXW/Ldz+lY7ks7Ykz03gNe4Fx7jWA+8nEOEUF41eXwH+LHLMe4OIN3+oGsHuz3p13xC 2EOoSGXwJRQtHT9RVtK4RFsGVnIWJ8HwKey/GMt8GxScAzwuDko61/tgmaeOHyiittTN 65on2y2qJy/VNcLc9OAKEsYqkqWdiqymNA6+u/CgVEZJpZaHY5cZY/1lTZ/oJJTeTJRz 3eLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6o+tTuRWUftSik6GCGw8PaA9/bP4unYZlgapimV10cE=; b=bNM4pWAVxyOWEyH+KfqemAB3B2wWoDkLfvOdws+f1GVnbMzcD1cPCScr7FnQeciod/ x49wbMYGGoAZLSxlb9p9Sybs0e0TEefh2ulg+VNPpnFvhpdbaxZMoDHfCsj1nEL4izE/ iqKCExutalIc53aE5stMRtAsOPZei86C59D3HB7WkTHqTuOxIWcrrzyw6oTVM9i/4NEx CdFyl2ADGHGbPYj94KpFmstyJJosROksNMw7wy5G3wY7nS30MXSa6igvnl3pM2ZtkWxo 56YUeVbgI/x/r+GwCKESd3C0Qj7d2+mNLUawUqlbOUW0TCSK9ZocdguYcZIjOHS9WRaS ajRQ== X-Gm-Message-State: AOAM533zfjmzekizbD18YAGqyLwGM6LfqRyRv6CrHXObQurK/+Tg4H5s F6MBl5crRktzzrfBA8fuGbm53PohmUlAo9Zcq7MfbQ== X-Google-Smtp-Source: ABdhPJwWHSeE36NOVxA+spSuXFIKBttCccBgfvUU3aPgrGSxETENnvC3eMIep1GgiEHsgEfrx+9QF6OQNlnFBNIaPiA= X-Received: by 2002:a7b:c8da:: with SMTP id f26mr2909267wml.50.1606753293781; Mon, 30 Nov 2020 08:21:33 -0800 (PST) MIME-Version: 1.0 References: <4bb2cb8a-c3ef-bfa9-7b04-cb2cca32d3ee@samba.org> <5d71d36c-0bfb-a313-07e8-0e22f7331a7a@samba.org> <12153e6a-37b1-872f-dd82-399e255eef5d@samba.org> In-Reply-To: From: Soheil Hassas Yeganeh Date: Mon, 30 Nov 2020 11:20:57 -0500 Message-ID: Subject: Re: [RFC 0/1] whitelisting UDP GSO and GRO cmsgs To: Victor Stewart Cc: Stefan Metzmacher , io-uring , Luke Hsiao , "David S. Miller" , Jann Horn , Arjun Roy , netdev , Jens Axboe Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Mon, Nov 30, 2020 at 11:17 AM Victor Stewart wrote: > > this being the list of UDP options.. i think we're good here? I'll put > together a new patch. > > https://github.com/torvalds/linux/blob/b65054597872ce3aefbc6a666385eabdf9e288da/include/uapi/linux/udp.h#L30 > > /* UDP socket options */ > #define UDP_CORK 1 /* Never send partially complete segments */ > #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ > #define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */ > #define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */ > #define UDP_SEGMENT 103 /* Set GSO segmentation size */ > #define UDP_GRO 104 /* This socket can receive UDP GRO packets */ That is not sufficient proof, because in udp_sendmsg() we also call ip_cmsg_send() in udp_sendmsg(), and ip_cmsg_recv_offset() in udp_recvmsg(). That said, I have audited them and I think they are sane. Jann, what do you think? > On Mon, Nov 30, 2020 at 3:15 PM Soheil Hassas Yeganeh wrote: > > > > On Mon, Nov 30, 2020 at 10:05 AM Stefan Metzmacher wrote: > > > > > > Hi Soheil, > > > > > > > Thank you for CCing us. > > > > > > > > The reason for PROTO_CMSG_DATA_ONLY is explained in the paragraph > > > > above in the commit message. PROTO_CMSG_DATA_ONLY is basically to > > > > allow-list a protocol that is guaranteed not to have the privilege > > > > escalation in https://crbug.com/project-zero/1975. TCP doesn't have > > > > that issue, and I believe UDP doesn't have that issue either (but > > > > please audit and confirm that with +Jann Horn). > > > > > > > > If you couldn't find any non-data CMSGs for UDP, you should just add > > > > PROTO_CMSG_DATA_ONLY to inet dgram sockets instead of introducing > > > > __sys_whitelisted_cmsghdrs as Stefan mentioned. > > > > > > Was there a specific reason why you only added the PROTO_CMSG_DATA_ONLY check > > > in __sys_recvmsg_sock(), but not in __sys_sendmsg_sock()? > > > > We only needed this for recvmsg(MSG_ERRQUEUE) to support transmit > > zerocopy. So, we took a more conservative approach and didn't add it > > for sendmsg(). > > > > I believe it should be fine to add it for TCP sendmsg, because for > > SO_MARK we check the user's capability: > > > > if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) > > return -EPERM; > > > > I believe udp_sendmsg() is sane too and I cannot spot any issue there. > > > > > metze > > > > > > > > >