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=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT 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 66522C10F0B for ; Thu, 18 Apr 2019 06:10:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BD74205C9 for ; Thu, 18 Apr 2019 06:10:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Fe4rC1xt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387855AbfDRGKT (ORCPT ); Thu, 18 Apr 2019 02:10:19 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41696 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfDRGKS (ORCPT ); Thu, 18 Apr 2019 02:10:18 -0400 Received: by mail-pg1-f194.google.com with SMTP id f6so675154pgs.8 for ; Wed, 17 Apr 2019 23:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=18SBahN6VjBUbUjL7SSeSGAMYhuhra6JkYI9JVuk28Q=; b=Fe4rC1xtDYLVo75UoYOuWOdJwN0ojDCqDH5yWVXSBAbhIoNX5YU652VNEb6qIVJso+ U9KBnL61W3kYfGLalv64eu0o2oLQwcRu3ULsgrcO7VPgQd5Ryjc7pL12McIGSiwFtRpC xYd7Z8pBfbnQOsduZ7GMe8xs2n6FEmie04kY5ZZqF0MfD7OGUDjx1pVhu+g6hTwmVm+Q 56juVFM1rha3+WNy3IirqDI6FfF+v9HwByzNlb8FuxzStyKohbR79tSDL14tBckFxjCg hp3xgz9b/cCzZMciJ5Wwz8S4DyYh76QIjix5EkfxurI8n1rBLuSdsjT7MK6ph2N2loBV 2jkQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=18SBahN6VjBUbUjL7SSeSGAMYhuhra6JkYI9JVuk28Q=; b=btaFDsErSsNZE0BBvWZ0lm3aemhc2G0ygfzLIAV+EvRULStroiydZKxnMR/77FgmJ+ ZeeGBZr1BqqgT8exYn0yxgminTRGALa44M6V8AViHeMtik4BwWNmkN1AniKyN4plx6lp nGUVsNKKejceFEDPLJFQ0auHJ53JZo4S26rdKke4FakUmMakeNzXbT4IUBWx/UEiu9wb 6bCyG4L2BAqvdO+MLGH6jACiO3huMn9lr23LU6ou6QkgKYL7PObep3VE3Evl0g6XOBKo Cn6AIqY3cGd3EnlJl4UtU2bnSJvG4rnl6MLqsMC6YGMraJBIDkPux+vWZ1WSzTPpFkwE hOeQ== X-Gm-Message-State: APjAAAW2V5RZn8KZ7Ef+gEIf8Myl+gTKfjAxXhkcdoLGL3XeCsQEedin CTbAx3tEDioD15qjGY7U34M= X-Google-Smtp-Source: APXvYqwR8PUKlxouUGZnngwjGmYcSfowXT2XOQ7DDwBLPLbeGd6dbAgWW0AoGBTGVWbnQaUFEhoJZg== X-Received: by 2002:a63:2405:: with SMTP id k5mr3859135pgk.447.1555567818048; Wed, 17 Apr 2019 23:10:18 -0700 (PDT) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id l19sm1698449pfi.87.2019.04.17.23.10.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Apr 2019 23:10:17 -0700 (PDT) Date: Thu, 18 Apr 2019 14:10:07 +0800 From: Hangbin Liu To: Richard Cochran Cc: Jiri Benc , netdev@vger.kernel.org, David Miller , Miroslav Lichvar , Patrick McHardy , stefan.sorensen@spectralink.com Subject: Re: [PATCH net-next] macvlan: pass get_ts_info and SIOC[SG]HWTSTAMP ioctl to real device Message-ID: <20190418061006.GC18865@dhcp-12-139.nay.redhat.com> References: <20190320022333.3378-1-liuhangbin@gmail.com> <20190417061452.GA18865@dhcp-12-139.nay.redhat.com> <20190417154306.om6rjkxq4hikhsht@localhost> <20190417205958.6508bda2@redhat.com> <20190418033157.irs25halxnemh65y@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190418033157.irs25halxnemh65y@localhost> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Apr 17, 2019 at 08:31:57PM -0700, Richard Cochran wrote: > On Wed, Apr 17, 2019 at 08:59:58PM +0200, Jiri Benc wrote: > > The problem here is this patch gives access to physical interface > > settings through a virtual interface layered on top of it. Whenever > > such thing is done, the virtual interface needs to provide a suitable > > way of moderating access to the shared resources, so the individual > > virtual interfaces do not affect each other. That's not what's being > > done here. > > So I guess the macvlan should reject SIOCSHWTSTAMP but allow > SIOCGHWTSTAMP. Do you want to fix it only in container, like: diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 4a6be8fab884..a2bd50a50e2f 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -836,6 +836,8 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) switch (cmd) { case SIOCSHWTSTAMP: + if (!net_eq(dev_net(dev), &init_net)) + break; case SIOCGHWTSTAMP: if (netif_device_present(real_dev) && ops->ndo_do_ioctl) err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd); Or just remove 'case SIOCSHWTSTAMP' directly? And we should do the same on vlan, right? > > > I think this patch is wrong. > > But what about this statement: > > ptp over vlan also has this issue > > What is the issue with VLAN interfaces? Are these exportable to a > container when the physical interface is not? Yes, if we attach a VLAN interface to container, a mapped user could also be able to modify the host's physical interface rx filter via ioctl. Thanks Hangbin