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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 8C939C63777 for ; Mon, 30 Nov 2020 16:18:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1ABBD206DF for ; Mon, 30 Nov 2020 16:18:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nametag.social header.i=@nametag.social header.b="su5xjkeL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728516AbgK3QSU (ORCPT ); Mon, 30 Nov 2020 11:18:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbgK3QSU (ORCPT ); Mon, 30 Nov 2020 11:18:20 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1F7EC0613D4 for ; Mon, 30 Nov 2020 08:17:34 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id m19so53077ejj.11 for ; Mon, 30 Nov 2020 08:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nametag.social; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kYkPuL9GlnXGub5oypPWNVCVWSUH0M/T34e+O98VB4s=; b=su5xjkeLP9kKNUx3nOasdTgwLq06Wsf29p4GXhzSORYciggHEz77TXkL4fNLuJqTcZ 9ciKLvPJvvk8Cz+zlbkVrC8jo4omcFcjyWQZIYSlwWjl7ICb4Aiq7Fri65Y8erbM4XBd JUU3zaoyTPf3ECxOMiVcaOin3ByMDs4epeM5d5s9ukTus8T3IBK6lCn00H/sA0JJSwwl sPTHLQmR58UUOhbDK1tfmcqJxWfQjMtSDBByOOC0tCQSkaReqBG0s1LJD9MJXJSa3kuE OvpsiCPlFSwLqlJ7ZO0+o2QGjNOQu9eUI/o2rrRL69Lv7ATzgTO2C+YgFubHRoA6t+o+ LDAw== 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=kYkPuL9GlnXGub5oypPWNVCVWSUH0M/T34e+O98VB4s=; b=EEjUY0ydK1ZszLABqRCxn7CBsbvHG/6830j0VNqYSUMvGWgbmqtTPsH4AAeY4gvH+A jTC2jYo8f1uKQxeF9GTO8owOnQgE1ED5KkbICWab2K/ehpDmT5Ja3J3m5DpjAdQeo+G1 W9LQlrDLZHT/I7jcag5qhHmmS6jaGTTVXMluMAK1YBk2zkR8aTrhl5Ph8Lq77pdEdobp dPrOiYZkHMoVlEcnJRLSdBfiOQpYYoDhI1mTCZriClmBrHrCNOIb5XXlSorbYTdIfpJn E8llguD9BspNwky6mhJL/pB2cRBNW0HJvwHsnrRCvPawZraKcolKBzaoHpQvalFISLIZ QMeA== X-Gm-Message-State: AOAM533xX4yEU9ai6hgLvLRLrAtla6F6CLJfMjwgHZquYn+a6K2Mo8hM E1PNS9HsAB/eI/QYrw3MElimGM8GO9sLKpmbYncY5A== X-Google-Smtp-Source: ABdhPJzSGozq00C4XGuB0NdGHdeM8ADvnY2iASJbH8SFqybL5yAl7kkyvxnrcEwZkbhjs46UpHMVRHXDxfyH6Amx++c= X-Received: by 2002:a17:906:40d3:: with SMTP id a19mr10781898ejk.98.1606753053317; Mon, 30 Nov 2020 08:17: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: Victor Stewart Date: Mon, 30 Nov 2020 16:17:22 +0000 Message-ID: Subject: Re: [RFC 0/1] whitelisting UDP GSO and GRO cmsgs To: Soheil Hassas Yeganeh 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 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 */ 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 > > > > > >