All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] RFC: connector: Add network namespace awareness
@ 2020-07-02  0:26 Matt Bennett
  2020-07-02  0:26 ` [PATCH 1/5] connector: Use task pid helpers Matt Bennett
                   ` (6 more replies)
  0 siblings, 7 replies; 25+ messages in thread
From: Matt Bennett @ 2020-07-02  0:26 UTC (permalink / raw)
  To: netdev; +Cc: zbr, ebiederm, linux-kernel, Matt Bennett

Previously the connector functionality could only be used by processes running in the
default network namespace. This meant that any process that uses the connector functionality
could not operate correctly when run inside a container. This is a draft patch series that
attempts to now allow this functionality outside of the default network namespace.

I see this has been discussed previously [1], but am not sure how my changes relate to all
of the topics discussed there and/or if there are any unintended side effects from my draft
changes.

Thanks.

[1] https://marc.info/?l=linux-kernel&m=150806196728365&w=2

Matt Bennett (5):
  connector: Use task pid helpers
  connector: Use 'current_user_ns' function
  connector: Ensure callback entry is released
  connector: Prepare for supporting multiple namespaces
  connector: Create connector per namespace

 Documentation/driver-api/connector.rst |   6 +-
 drivers/connector/cn_proc.c            | 110 +++++++-------
 drivers/connector/cn_queue.c           |   9 +-
 drivers/connector/connector.c          | 192 ++++++++++++++++++++-----
 drivers/hv/hv_fcopy.c                  |   1 +
 drivers/hv/hv_utils_transport.c        |   6 +-
 drivers/md/dm-log-userspace-transfer.c |   6 +-
 drivers/video/fbdev/uvesafb.c          |   8 +-
 drivers/w1/w1_netlink.c                |  19 +--
 include/linux/connector.h              |  38 +++--
 include/net/net_namespace.h            |   4 +
 kernel/exit.c                          |   2 +-
 samples/connector/cn_test.c            |   6 +-
 13 files changed, 286 insertions(+), 121 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [PATCH 5/5] connector: Create connector per namespace
@ 2020-07-02 12:45 kernel test robot
  0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2020-07-02 12:45 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9572 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200702002635.8169-6-matt.bennett@alliedtelesis.co.nz>
References: <20200702002635.8169-6-matt.bennett@alliedtelesis.co.nz>
TO: Matt Bennett <matt.bennett@alliedtelesis.co.nz>
TO: netdev(a)vger.kernel.org
CC: zbr(a)ioremap.net
CC: ebiederm(a)xmission.com
CC: linux-kernel(a)vger.kernel.org
CC: Matt Bennett <matt.bennett@alliedtelesis.co.nz>

Hi Matt,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ipvs/master]
[also build test WARNING on dm/for-next linux/master linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Matt-Bennett/RFC-connector-Add-network-namespace-awareness/20200702-083030
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
:::::: branch date: 12 hours ago
:::::: commit date: 12 hours ago
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/connector/connector.c:71 cn_netlink_send_mult() warn: impossible condition '(len < 0) => (0-u16max < 0)'

# https://github.com/0day-ci/linux/commit/32f49fbf9dcfe5c3bc100728f5b8b5f9c95757cb
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 32f49fbf9dcfe5c3bc100728f5b8b5f9c95757cb
vim +71 drivers/connector/connector.c

7672d0b5441137 Evgeniy Polyakov         2005-09-11   30  
7672d0b5441137 Evgeniy Polyakov         2005-09-11   31  /*
34470e0bfae223 David Fries              2014-04-08   32   * Sends mult (multiple) cn_msg@a time.
34470e0bfae223 David Fries              2014-04-08   33   *
7672d0b5441137 Evgeniy Polyakov         2005-09-11   34   * msg->seq and msg->ack are used to determine message genealogy.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   35   * When someone sends message it puts there locally unique sequence
7672d0b5441137 Evgeniy Polyakov         2005-09-11   36   * and random acknowledge numbers.  Sequence number may be copied into
7672d0b5441137 Evgeniy Polyakov         2005-09-11   37   * nlmsghdr->nlmsg_seq too.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   38   *
7672d0b5441137 Evgeniy Polyakov         2005-09-11   39   * Sequence number is incremented with each message to be sent.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   40   *
ac8f73305eea8a David Fries              2014-01-15   41   * If we expect a reply to our message then the sequence number in
7672d0b5441137 Evgeniy Polyakov         2005-09-11   42   * received message MUST be the same as in original message, and
7672d0b5441137 Evgeniy Polyakov         2005-09-11   43   * acknowledge number MUST be the same + 1.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   44   *
7672d0b5441137 Evgeniy Polyakov         2005-09-11   45   * If we receive a message and its sequence number is not equal to the
7672d0b5441137 Evgeniy Polyakov         2005-09-11   46   * one we are expecting then it is a new message.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   47   *
7672d0b5441137 Evgeniy Polyakov         2005-09-11   48   * If we receive a message and its sequence number is the same as one
7672d0b5441137 Evgeniy Polyakov         2005-09-11   49   * we are expecting but it's acknowledgement number is not equal to
7672d0b5441137 Evgeniy Polyakov         2005-09-11   50   * the acknowledgement number in the original message + 1, then it is
7672d0b5441137 Evgeniy Polyakov         2005-09-11   51   * a new message.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   52   *
34470e0bfae223 David Fries              2014-04-08   53   * If msg->len != len, then additional cn_msg messages are expected following
34470e0bfae223 David Fries              2014-04-08   54   * the first msg.
34470e0bfae223 David Fries              2014-04-08   55   *
ac8f73305eea8a David Fries              2014-01-15   56   * The message is sent to, the portid if given, the group if given, both if
ac8f73305eea8a David Fries              2014-01-15   57   * both, or if both are zero then the group is looked up and sent there.
7672d0b5441137 Evgeniy Polyakov         2005-09-11   58   */
e921441014422d Matt Bennett             2020-07-02   59  int cn_netlink_send_mult(struct net *net, struct cn_msg *msg, u16 len,
e921441014422d Matt Bennett             2020-07-02   60  			 u32 portid, u32 __group, gfp_t gfp_mask)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   61  {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   62  	struct cn_callback_entry *__cbq;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   63  	unsigned int size;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   64  	struct sk_buff *skb;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   65  	struct nlmsghdr *nlh;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   66  	struct cn_msg *data;
32f49fbf9dcfe5 Matt Bennett             2020-07-02   67  	struct cn_dev *dev = &(net->cdev);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   68  	u32 group = 0;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   69  	int found = 0;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   70  
32f49fbf9dcfe5 Matt Bennett             2020-07-02  @71  	if (!msg || len < 0)
32f49fbf9dcfe5 Matt Bennett             2020-07-02   72  		return -EINVAL;
32f49fbf9dcfe5 Matt Bennett             2020-07-02   73  
ac8f73305eea8a David Fries              2014-01-15   74  	if (portid || __group) {
ac8f73305eea8a David Fries              2014-01-15   75  		group = __group;
ac8f73305eea8a David Fries              2014-01-15   76  	} else {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   77  		spin_lock_bh(&dev->cbdev->queue_lock);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   78  		list_for_each_entry(__cbq, &dev->cbdev->queue_list,
7672d0b5441137 Evgeniy Polyakov         2005-09-11   79  				    callback_entry) {
acd042bb2de50d Evgeniy Polyakov         2005-09-26   80  			if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   81  				found = 1;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   82  				group = __cbq->group;
fd00eeccd92b7b Li Zefan                 2008-01-04   83  				break;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   84  			}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   85  		}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   86  		spin_unlock_bh(&dev->cbdev->queue_lock);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   87  
7672d0b5441137 Evgeniy Polyakov         2005-09-11   88  		if (!found)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   89  			return -ENODEV;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   90  	}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   91  
ac8f73305eea8a David Fries              2014-01-15   92  	if (!portid && !netlink_has_listeners(dev->nls, group))
b191ba0d599928 Evgeniy Polyakov         2006-03-20   93  		return -ESRCH;
b191ba0d599928 Evgeniy Polyakov         2006-03-20   94  
34470e0bfae223 David Fries              2014-04-08   95  	size = sizeof(*msg) + len;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   96  
9631d79e815197 Hong zhi guo             2013-03-27   97  	skb = nlmsg_new(size, gfp_mask);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   98  	if (!skb)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   99  		return -ENOMEM;
7672d0b5441137 Evgeniy Polyakov         2005-09-11  100  
9631d79e815197 Hong zhi guo             2013-03-27  101  	nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size, 0);
85c931665d822f Javier Martinez Canillas 2012-06-26  102  	if (!nlh) {
85c931665d822f Javier Martinez Canillas 2012-06-26  103  		kfree_skb(skb);
85c931665d822f Javier Martinez Canillas 2012-06-26  104  		return -EMSGSIZE;
85c931665d822f Javier Martinez Canillas 2012-06-26  105  	}
7672d0b5441137 Evgeniy Polyakov         2005-09-11  106  
85c931665d822f Javier Martinez Canillas 2012-06-26  107  	data = nlmsg_data(nlh);
7672d0b5441137 Evgeniy Polyakov         2005-09-11  108  
ac73bf50b709de Mathias Krause           2013-09-30  109  	memcpy(data, msg, size);
7672d0b5441137 Evgeniy Polyakov         2005-09-11  110  
7672d0b5441137 Evgeniy Polyakov         2005-09-11  111  	NETLINK_CB(skb).dst_group = group;
7672d0b5441137 Evgeniy Polyakov         2005-09-11  112  
ac8f73305eea8a David Fries              2014-01-15  113  	if (group)
ac8f73305eea8a David Fries              2014-01-15  114  		return netlink_broadcast(dev->nls, skb, portid, group,
ac8f73305eea8a David Fries              2014-01-15  115  					 gfp_mask);
d0164adc89f6bb Mel Gorman               2015-11-06  116  	return netlink_unicast(dev->nls, skb, portid,
d0164adc89f6bb Mel Gorman               2015-11-06  117  			!gfpflags_allow_blocking(gfp_mask));
7672d0b5441137 Evgeniy Polyakov         2005-09-11  118  }
34470e0bfae223 David Fries              2014-04-08  119  EXPORT_SYMBOL_GPL(cn_netlink_send_mult);
34470e0bfae223 David Fries              2014-04-08  120  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27431 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-09-10 15:06 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-02  0:26 [PATCH 0/5] RFC: connector: Add network namespace awareness Matt Bennett
2020-07-02  0:26 ` [PATCH 1/5] connector: Use task pid helpers Matt Bennett
2020-07-02  0:26 ` [PATCH 2/5] connector: Use 'current_user_ns' function Matt Bennett
2020-07-02  0:26 ` [PATCH 3/5] connector: Ensure callback entry is released Matt Bennett
2020-07-02  0:26 ` [PATCH 4/5] connector: Prepare for supporting multiple namespaces Matt Bennett
2020-07-02  0:26 ` [PATCH 5/5] connector: Create connector per namespace Matt Bennett
2020-07-02  5:52   ` kernel test robot
2020-07-02  5:52     ` kernel test robot
2020-07-02  6:40   ` kernel test robot
2020-07-02  6:40     ` kernel test robot
2020-07-02 14:32   ` Dan Carpenter
2020-07-02 14:32     ` [kbuild] " Dan Carpenter
2020-07-02 14:32     ` Dan Carpenter
2020-07-02 13:17 ` [PATCH 0/5] RFC: connector: Add network namespace awareness Eric W. Biederman
2020-07-02 19:10   ` Christian Brauner
2020-07-02 22:44     ` Aleksa Sarai
2020-07-05 22:32     ` Matt Bennett
2020-07-13 18:34       ` Eric W. Biederman
2020-07-14  5:03         ` Aleksa Sarai
2020-07-14  5:19           ` Matt Bennett
2020-07-02 18:59 ` Eric W. Biederman
2020-07-05 22:31   ` Matt Bennett
2020-07-13 18:39     ` Eric W. Biederman
2020-09-10 15:04       ` Evgeniy Polyakov
  -- strict thread matches above, loose matches on Subject: below --
2020-07-02 12:45 [PATCH 5/5] connector: Create connector per namespace kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.