All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v1 0/2] um: drop broken features to fix allyesconfig
@ 2019-12-06  2:01 Brendan Higgins
  2019-12-06  2:01 ` [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP Brendan Higgins
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Brendan Higgins @ 2019-12-06  2:01 UTC (permalink / raw)
  To: jdike, richard, anton.ivanov
  Cc: johannes.berg, linux-um, linux-kernel, davidgow, Brendan Higgins

# TL;DR

This patchset drops two broken features in an attempt to get
allyesconfig closer to working for ARCH=um.

# What am I trying to do?

This patchset is part of my attempt to get `make ARCH=um allyesconfig`
to produce a config that will build *and* boot to init, so that I can
use it as a mechanism to run tests[1].

# How far away are we from an allyesconfig UML kernel?

I have identified 33 Kconfigs that are selected by allyesconfig, but
will either not build on UML, or prevent it from booting. They are:

CONFIG_STATIC_LINK=y
CONFIG_UML_NET_PCAP=y
CONFIG_NET_PTP_CLASSIFY=y
CONFIG_IP_VS=y
CONFIG_BRIDGE_EBT_BROUTE=y
CONFIG_BRIDGE_EBT_T_FILTER=y
CONFIG_BRIDGE_EBT_T_NAT=y
CONFIG_MTD_NAND_CADENCE=y
CONFIG_MTD_NAND_NANDSIM=y
CONFIG_BLK_DEV_NULL_BLK=y
CONFIG_BLK_DEV_RAM=y
CONFIG_SCSI_DEBUG=y
CONFIG_NET_VENDOR_XILINX=y
CONFIG_NULL_TTY=y
CONFIG_PTP_1588_CLOCK=y
CONFIG_PINCTRL_EQUILIBRIUM=y
CONFIG_DMABUF_SELFTESTS=y
CONFIG_COMEDI=y
CONFIG_XIL_AXIS_FIFO=y
CONFIG_EXFAT_FS=y
CONFIG_STM_DUMMY=y
CONFIG_FSI_MASTER_ASPEED=y
CONFIG_JFS_FS=y
CONFIG_UBIFS_FS=y
CONFIG_CRAMFS=y
CONFIG_CRYPTO_DEV_SAFEXCEL=y
CONFIG_CRYPTO_DEV_AMLOGIC_GXL=y
CONFIG_KCOV=y
CONFIG_LKDTM=y
CONFIG_REED_SOLOMON_TEST=y
CONFIG_TEST_RHASHTABLE=y
CONFIG_TEST_MEMINIT=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y

This patchset attempts to deal with CONFIG_STATIC_LINK=y and
CONFIG_UML_NET_PCAP=y by just removing them since they are broken and
appear to have been broken for some time. (I am aware of the taboo of
dropping configs, but given the amount of time they have been broken, I
figured that I might be able to get away with it in this case, which is
easier than trying to actually fix them.)

I also have a patch out to fix CONFIG_EXFAT_FS=y[2].

After this I plan on going after

CONFIG_PINCTRL_EQUILIBRIUM=y
CONFIG_MTD_NAND_CADENCE=y
CONFIG_FSI_MASTER_ASPEED=y
CONFIG_CRYPTO_DEV_SAFEXCEL=y
CONFIG_XIL_AXIS_FIFO=y
CONFIG_CRYPTO_DEV_AMLOGIC_GXL=y
CONFIG_XILINX_AXI_EMAC=y

the problem with these is that they depend on
devm_platform_ioremap_resource without explicitly depending on
CONFIG_HAS_IOMEM=y.

Also note that I don't think that CONFIG_NULL_TTY=y is actually broken
on UML; however, console seems to get assigned to the null TTY by
default when it is enabled, so I added it to the list for the sake of
completeness.

The other broken configs require more investigation (I would welcome
help, if anyone is interested ;-) ).

# Why won't allyesconfig break again after this series of fixes?

As I mentioned above, I am using UML for testing the kernel, and I am
currently working on getting my tests to run on KernelCI. As part of our
testing procedure for KernelCI, we are planning on building a UML kernel
using allyesconfig and running our tests on it. Thus, we will find out
very quickly once someone breaks allyesconfig again once we get this all
working.

Brendan Higgins (2):
  um: drivers: remove support for UML_NET_PCAP
  uml: remove support for CONFIG_STATIC_LINK

 arch/um/Kconfig              |  23 +----
 arch/um/Makefile             |   3 +-
 arch/um/drivers/Kconfig      |  16 ----
 arch/um/drivers/Makefile     |  17 +---
 arch/um/drivers/pcap_kern.c  | 113 ----------------------
 arch/um/drivers/pcap_user.c  | 137 ---------------------------
 arch/um/drivers/pcap_user.h  |  21 -----
 arch/um/kernel/dyn.lds.S     | 170 ----------------------------------
 arch/um/kernel/uml.lds.S     | 115 -----------------------
 arch/um/kernel/vmlinux.lds.S | 175 ++++++++++++++++++++++++++++++++++-
 10 files changed, 174 insertions(+), 616 deletions(-)
 delete mode 100644 arch/um/drivers/pcap_kern.c
 delete mode 100644 arch/um/drivers/pcap_user.c
 delete mode 100644 arch/um/drivers/pcap_user.h
 delete mode 100644 arch/um/kernel/dyn.lds.S
 delete mode 100644 arch/um/kernel/uml.lds.S

Looking forward to hearing people's thoughts!

[1] https://bugzilla.kernel.org/show_bug.cgi?id=205223
[2] https://patchwork.kernel.org/patch/11273771/

-- 
2.24.0.393.g34dc348eaf-goog


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

* [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-06  2:01 [RFC v1 0/2] um: drop broken features to fix allyesconfig Brendan Higgins
@ 2019-12-06  2:01 ` Brendan Higgins
  2019-12-06  7:23   ` Anton Ivanov
  2019-12-06  2:01 ` [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK Brendan Higgins
  2019-12-06  7:45 ` [RFC v1 0/2] um: drop broken features to fix allyesconfig Anton Ivanov
  2 siblings, 1 reply; 15+ messages in thread
From: Brendan Higgins @ 2019-12-06  2:01 UTC (permalink / raw)
  To: jdike, richard, anton.ivanov
  Cc: johannes.berg, linux-um, linux-kernel, davidgow, Brendan Higgins

Remove support for UML_NET_PCAP. It is broken. When building with
libpcap installed, the build fails:

arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
 static int pcap_open(void *data)
            ^~~~~~~~~
In file included from /usr/include/pcap.h:43,
                 from arch/um/drivers/pcap_user.c:7:
/usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
 PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
                  ^~~~~~~~~

So it looks like this has probably been broken for some time.

In interest of trying to make allyesconfig work with UML, it is best
just to drop this.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
---
 arch/um/drivers/Kconfig     |  16 -----
 arch/um/drivers/Makefile    |  17 +----
 arch/um/drivers/pcap_kern.c | 113 -----------------------------
 arch/um/drivers/pcap_user.c | 137 ------------------------------------
 arch/um/drivers/pcap_user.h |  21 ------
 5 files changed, 2 insertions(+), 302 deletions(-)
 delete mode 100644 arch/um/drivers/pcap_kern.c
 delete mode 100644 arch/um/drivers/pcap_user.c
 delete mode 100644 arch/um/drivers/pcap_user.h

diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig
index 388096fb45a25..98fead07c33de 100644
--- a/arch/um/drivers/Kconfig
+++ b/arch/um/drivers/Kconfig
@@ -291,22 +291,6 @@ config UML_NET_MCAST
 	  exclusive).  If you don't need to network UMLs say N to each of
 	  the transports.
 
-config UML_NET_PCAP
-	bool "pcap transport"
-	depends on UML_NET
-	help
-	The pcap transport makes a pcap packet stream on the host look
-	like an ethernet device inside UML.  This is useful for making
-	UML act as a network monitor for the host.  You must have libcap
-	installed in order to build the pcap transport into UML.
-
-	  For more information, see
-	  <http://user-mode-linux.sourceforge.net/old/networking.html>  That site
-	  has examples of the UML command line to use to enable this option.
-
-	If you intend to use UML as a network monitor for the host, say
-	Y here.  Otherwise, say N.
-
 config UML_NET_SLIRP
 	bool "SLiRP transport"
 	depends on UML_NET
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index a290821e355c2..7548b18e77a27 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -3,9 +3,6 @@
 # Copyright (C) 2000, 2002, 2003 Jeff Dike (jdike@karaya.com)
 #
 
-# pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked
-# in to pcap.o
-
 slip-objs := slip_kern.o slip_user.o
 slirp-objs := slirp_kern.o slirp_user.o
 daemon-objs := daemon_kern.o daemon_user.o
@@ -18,14 +15,9 @@ ubd-objs := ubd_kern.o ubd_user.o
 port-objs := port_kern.o port_user.o
 harddog-objs := harddog_kern.o harddog_user.o
 
-LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a)
-
 LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
 
-targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
-
-$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
-	$(LD) -r -dp -o $@ $^ $(ld_flags)
+targets := vde_kern.o vde_user.o
 
 $(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
 	$(LD) -r -dp -o $@ $^ $(ld_flags)
@@ -34,9 +26,6 @@ $(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
 # object name, so nothing from the library gets linked.
 #$(call if_changed,ld)
 
-# When the above is fixed, don't forget to add this too!
-#targets += $(obj)/pcap.o
-
 obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o
 obj-$(CONFIG_SSL) += ssl.o
 obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o
@@ -47,7 +36,6 @@ obj-$(CONFIG_UML_NET_DAEMON) += daemon.o
 obj-$(CONFIG_UML_NET_VECTOR) += vector.o
 obj-$(CONFIG_UML_NET_VDE) += vde.o
 obj-$(CONFIG_UML_NET_MCAST) += umcast.o
-obj-$(CONFIG_UML_NET_PCAP) += pcap.o
 obj-$(CONFIG_UML_NET) += net.o 
 obj-$(CONFIG_MCONSOLE) += mconsole.o
 obj-$(CONFIG_MMAPPER) += mmapper_kern.o 
@@ -63,8 +51,7 @@ obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o
 obj-$(CONFIG_UML_RANDOM) += random.o
 obj-$(CONFIG_VIRTIO_UML) += virtio_uml.o
 
-# pcap_user.o must be added explicitly.
-USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o
+USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o vde_user.o vector_user.o
 CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)
 
 include arch/um/scripts/Makefile.rules
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
deleted file mode 100644
index cfe4cb17694cc..0000000000000
--- a/arch/um/drivers/pcap_kern.c
+++ /dev/null
@@ -1,113 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- */
-
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <net_kern.h>
-#include "pcap_user.h"
-
-struct pcap_init {
-	char *host_if;
-	int promisc;
-	int optimize;
-	char *filter;
-};
-
-void pcap_init(struct net_device *dev, void *data)
-{
-	struct uml_net_private *pri;
-	struct pcap_data *ppri;
-	struct pcap_init *init = data;
-
-	pri = netdev_priv(dev);
-	ppri = (struct pcap_data *) pri->user;
-	ppri->host_if = init->host_if;
-	ppri->promisc = init->promisc;
-	ppri->optimize = init->optimize;
-	ppri->filter = init->filter;
-
-	printk("pcap backend, host interface %s\n", ppri->host_if);
-}
-
-static int pcap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
-{
-	return pcap_user_read(fd, skb_mac_header(skb),
-			      skb->dev->mtu + ETH_HEADER_OTHER,
-			      (struct pcap_data *) &lp->user);
-}
-
-static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
-{
-	return -EPERM;
-}
-
-static const struct net_kern_info pcap_kern_info = {
-	.init			= pcap_init,
-	.protocol		= eth_protocol,
-	.read			= pcap_read,
-	.write			= pcap_write,
-};
-
-int pcap_setup(char *str, char **mac_out, void *data)
-{
-	struct pcap_init *init = data;
-	char *remain, *host_if = NULL, *options[2] = { NULL, NULL };
-	int i;
-
-	*init = ((struct pcap_init)
-		{ .host_if 	= "eth0",
-		  .promisc 	= 1,
-		  .optimize 	= 0,
-		  .filter 	= NULL });
-
-	remain = split_if_spec(str, &host_if, &init->filter,
-			       &options[0], &options[1], mac_out, NULL);
-	if (remain != NULL) {
-		printk(KERN_ERR "pcap_setup - Extra garbage on "
-		       "specification : '%s'\n", remain);
-		return 0;
-	}
-
-	if (host_if != NULL)
-		init->host_if = host_if;
-
-	for (i = 0; i < ARRAY_SIZE(options); i++) {
-		if (options[i] == NULL)
-			continue;
-		if (!strcmp(options[i], "promisc"))
-			init->promisc = 1;
-		else if (!strcmp(options[i], "nopromisc"))
-			init->promisc = 0;
-		else if (!strcmp(options[i], "optimize"))
-			init->optimize = 1;
-		else if (!strcmp(options[i], "nooptimize"))
-			init->optimize = 0;
-		else {
-			printk(KERN_ERR "pcap_setup : bad option - '%s'\n",
-			       options[i]);
-			return 0;
-		}
-	}
-
-	return 1;
-}
-
-static struct transport pcap_transport = {
-	.list 		= LIST_HEAD_INIT(pcap_transport.list),
-	.name 		= "pcap",
-	.setup  	= pcap_setup,
-	.user 		= &pcap_user_info,
-	.kern 		= &pcap_kern_info,
-	.private_size 	= sizeof(struct pcap_data),
-	.setup_size 	= sizeof(struct pcap_init),
-};
-
-static int register_pcap(void)
-{
-	register_transport(&pcap_transport);
-	return 0;
-}
-
-late_initcall(register_pcap);
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
deleted file mode 100644
index bbd20638788af..0000000000000
--- a/arch/um/drivers/pcap_user.c
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- */
-
-#include <errno.h>
-#include <pcap.h>
-#include <string.h>
-#include <asm/types.h>
-#include <net_user.h>
-#include "pcap_user.h"
-#include <um_malloc.h>
-
-#define PCAP_FD(p) (*(int *)(p))
-
-static int pcap_user_init(void *data, void *dev)
-{
-	struct pcap_data *pri = data;
-	pcap_t *p;
-	char errors[PCAP_ERRBUF_SIZE];
-
-	p = pcap_open_live(pri->host_if, ETH_MAX_PACKET + ETH_HEADER_OTHER,
-			   pri->promisc, 0, errors);
-	if (p == NULL) {
-		printk(UM_KERN_ERR "pcap_user_init : pcap_open_live failed - "
-		       "'%s'\n", errors);
-		return -EINVAL;
-	}
-
-	pri->dev = dev;
-	pri->pcap = p;
-	return 0;
-}
-
-static int pcap_open(void *data)
-{
-	struct pcap_data *pri = data;
-	__u32 netmask;
-	int err;
-
-	if (pri->pcap == NULL)
-		return -ENODEV;
-
-	if (pri->filter != NULL) {
-		err = dev_netmask(pri->dev, &netmask);
-		if (err < 0) {
-			printk(UM_KERN_ERR "pcap_open : dev_netmask failed\n");
-			return -EIO;
-		}
-
-		pri->compiled = uml_kmalloc(sizeof(struct bpf_program),
-					UM_GFP_KERNEL);
-		if (pri->compiled == NULL) {
-			printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
-			return -ENOMEM;
-		}
-
-		err = pcap_compile(pri->pcap,
-				   (struct bpf_program *) pri->compiled,
-				   pri->filter, pri->optimize, netmask);
-		if (err < 0) {
-			printk(UM_KERN_ERR "pcap_open : pcap_compile failed - "
-			       "'%s'\n", pcap_geterr(pri->pcap));
-			goto out;
-		}
-
-		err = pcap_setfilter(pri->pcap, pri->compiled);
-		if (err < 0) {
-			printk(UM_KERN_ERR "pcap_open : pcap_setfilter "
-			       "failed - '%s'\n", pcap_geterr(pri->pcap));
-			goto out;
-		}
-	}
-
-	return PCAP_FD(pri->pcap);
-
- out:
-	kfree(pri->compiled);
-	return -EIO;
-}
-
-static void pcap_remove(void *data)
-{
-	struct pcap_data *pri = data;
-
-	if (pri->compiled != NULL)
-		pcap_freecode(pri->compiled);
-
-	if (pri->pcap != NULL)
-		pcap_close(pri->pcap);
-}
-
-struct pcap_handler_data {
-	char *buffer;
-	int len;
-};
-
-static void handler(u_char *data, const struct pcap_pkthdr *header,
-		    const u_char *packet)
-{
-	int len;
-
-	struct pcap_handler_data *hdata = (struct pcap_handler_data *) data;
-
-	len = hdata->len < header->caplen ? hdata->len : header->caplen;
-	memcpy(hdata->buffer, packet, len);
-	hdata->len = len;
-}
-
-int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)
-{
-	struct pcap_handler_data hdata = ((struct pcap_handler_data)
-		                          { .buffer  	= buffer,
-					    .len 	= len });
-	int n;
-
-	n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata);
-	if (n < 0) {
-		printk(UM_KERN_ERR "pcap_dispatch failed - %s\n",
-		       pcap_geterr(pri->pcap));
-		return -EIO;
-	}
-	else if (n == 0)
-		return 0;
-	return hdata.len;
-}
-
-const struct net_user_info pcap_user_info = {
-	.init		= pcap_user_init,
-	.open		= pcap_open,
-	.close	 	= NULL,
-	.remove	 	= pcap_remove,
-	.add_address	= NULL,
-	.delete_address = NULL,
-	.mtu		= ETH_MAX_PACKET,
-	.max_packet	= ETH_MAX_PACKET + ETH_HEADER_OTHER,
-};
diff --git a/arch/um/drivers/pcap_user.h b/arch/um/drivers/pcap_user.h
deleted file mode 100644
index 216246f5f09bd..0000000000000
--- a/arch/um/drivers/pcap_user.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* 
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
- */
-
-#include <net_user.h>
-
-struct pcap_data {
-	char *host_if;
-	int promisc;
-	int optimize;
-	char *filter;
-	void *compiled;
-	void *pcap;
-	void *dev;
-};
-
-extern const struct net_user_info pcap_user_info;
-
-extern int pcap_user_read(int fd, void *buf, int len, struct pcap_data *pri);
-
-- 
2.24.0.393.g34dc348eaf-goog


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

* [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK
  2019-12-06  2:01 [RFC v1 0/2] um: drop broken features to fix allyesconfig Brendan Higgins
  2019-12-06  2:01 ` [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP Brendan Higgins
@ 2019-12-06  2:01 ` Brendan Higgins
  2019-12-06  7:41   ` Anton Ivanov
  2019-12-06  7:45 ` [RFC v1 0/2] um: drop broken features to fix allyesconfig Anton Ivanov
  2 siblings, 1 reply; 15+ messages in thread
From: Brendan Higgins @ 2019-12-06  2:01 UTC (permalink / raw)
  To: jdike, richard, anton.ivanov
  Cc: johannes.berg, linux-um, linux-kernel, davidgow, Brendan Higgins

CONFIG_STATIC_LINK appears to have been broken since before v4.20. It
doesn't play nice with CONFIG_UML_NET_VECTOR=y:

/usr/bin/ld: arch/um/drivers/vector_user.o: in function
`user_init_socket_fds': vector_user.c:(.text+0x430): warning: Using
'getaddrinfo' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking

And it seems to break the ptrace check:

Checking that ptrace can change system call numbers...check_ptrace :
child exited with exitcode 6, while expecting 0; status 0x67f
[1]    126822 abort      ./linux mem=256M

Given the importance of ptrace in UML, CONFIG_STATIC_LINK seems totally
broken right now; remove it in order to fix allyesconfig for ARCH=um.

Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
---
 arch/um/Kconfig              |  23 +----
 arch/um/Makefile             |   3 +-
 arch/um/kernel/dyn.lds.S     | 170 ----------------------------------
 arch/um/kernel/uml.lds.S     | 115 -----------------------
 arch/um/kernel/vmlinux.lds.S | 175 ++++++++++++++++++++++++++++++++++-
 5 files changed, 172 insertions(+), 314 deletions(-)
 delete mode 100644 arch/um/kernel/dyn.lds.S
 delete mode 100644 arch/um/kernel/uml.lds.S

diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 2a6d04fcb3e91..00927fb7ce67a 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -19,6 +19,7 @@ config UML
 	select GENERIC_CLOCKEVENTS
 	select HAVE_GCC_PLUGINS
 	select TTY # Needed for line.c
+	select MODULE_REL_CRCS if MODVERSIONS
 
 config MMU
 	bool
@@ -61,28 +62,6 @@ config NR_CPUS
 
 source "arch/$(HEADER_ARCH)/um/Kconfig"
 
-config STATIC_LINK
-	bool "Force a static link"
-	default n
-	help
-	  This option gives you the ability to force a static link of UML.
-	  Normally, UML is linked as a shared binary.  This is inconvenient for
-	  use in a chroot jail.  So, if you intend to run UML inside a chroot,
-	  you probably want to say Y here.
-	  Additionally, this option enables using higher memory spaces (up to
-	  2.75G) for UML.
-
-config LD_SCRIPT_STATIC
-	bool
-	default y
-	depends on STATIC_LINK
-
-config LD_SCRIPT_DYN
-	bool
-	default y
-	depends on !LD_SCRIPT_STATIC
-	select MODULE_REL_CRCS if MODVERSIONS
-
 config HOSTFS
 	tristate "Host filesystem"
 	help
diff --git a/arch/um/Makefile b/arch/um/Makefile
index d2daa206872da..ec8af28daf051 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -117,8 +117,7 @@ archheaders:
 archprepare:
 	$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
 
-LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
-LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie)
+LINK-y += -Wl,-rpath,/lib $(call cc-option, -no-pie)
 
 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
 	$(call cc-option, -fno-stack-protector,) \
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
deleted file mode 100644
index c69d69ee96beb..0000000000000
--- a/arch/um/kernel/dyn.lds.S
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <asm/vmlinux.lds.h>
-#include <asm/page.h>
-
-OUTPUT_FORMAT(ELF_FORMAT)
-OUTPUT_ARCH(ELF_ARCH)
-ENTRY(_start)
-jiffies = jiffies_64;
-
-SECTIONS
-{
-  PROVIDE (__executable_start = START);
-  . = START + SIZEOF_HEADERS;
-  .interp         : { *(.interp) }
-  __binary_start = .;
-  . = ALIGN(4096);		/* Init code and data */
-  _text = .;
-  INIT_TEXT_SECTION(PAGE_SIZE)
-
-  . = ALIGN(PAGE_SIZE);
-
-  /* Read-only sections, merged into text segment: */
-  .hash           : { *(.hash) }
-  .gnu.hash       : { *(.gnu.hash) }
-  .dynsym         : { *(.dynsym) }
-  .dynstr         : { *(.dynstr) }
-  .gnu.version    : { *(.gnu.version) }
-  .gnu.version_d  : { *(.gnu.version_d) }
-  .gnu.version_r  : { *(.gnu.version_r) }
-  .rel.init       : { *(.rel.init) }
-  .rela.init      : { *(.rela.init) }
-  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
-  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
-  .rel.fini       : { *(.rel.fini) }
-  .rela.fini      : { *(.rela.fini) }
-  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
-  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
-  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
-  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
-  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
-  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
-  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
-  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
-  .rel.ctors      : { *(.rel.ctors) }
-  .rela.ctors     : { *(.rela.ctors) }
-  .rel.dtors      : { *(.rel.dtors) }
-  .rela.dtors     : { *(.rela.dtors) }
-  .rel.got        : { *(.rel.got) }
-  .rela.got       : { *(.rela.got) }
-  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
-  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.plt : {
-	*(.rel.plt)
-	PROVIDE_HIDDEN(__rel_iplt_start = .);
-	*(.rel.iplt)
-	PROVIDE_HIDDEN(__rel_iplt_end = .);
-  }
-  .rela.plt : {
-	*(.rela.plt)
-	PROVIDE_HIDDEN(__rela_iplt_start = .);
-	*(.rela.iplt)
-	PROVIDE_HIDDEN(__rela_iplt_end = .);
-  }
-  .init           : {
-    KEEP (*(.init))
-  } =0x90909090
-  .plt            : { *(.plt) }
-  .text           : {
-    _stext = .;
-    TEXT_TEXT
-    SCHED_TEXT
-    CPUIDLE_TEXT
-    LOCK_TEXT
-    IRQENTRY_TEXT
-    SOFTIRQENTRY_TEXT
-    *(.fixup)
-    *(.stub .text.* .gnu.linkonce.t.*)
-    /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
-
-    . = ALIGN(PAGE_SIZE);
-  } =0x90909090
-  . = ALIGN(PAGE_SIZE);
-  .syscall_stub : {
-	__syscall_stub_start = .;
-	*(.__syscall_stub*)
-	__syscall_stub_end = .;
-  }
-  .fini           : {
-    KEEP (*(.fini))
-  } =0x90909090
-
-  .kstrtab : { *(.kstrtab) }
-
-  #include <asm/common.lds.S>
-
-  __init_begin = .;
-  init.data : { INIT_DATA }
-  __init_end = .;
-
-  /* Ensure the __preinit_array_start label is properly aligned.  We
-     could instead move the label definition inside the section, but
-     the linker would then create the section even if it turns out to
-     be empty, which isn't pretty.  */
-  . = ALIGN(32 / 8);
-  .preinit_array     : { *(.preinit_array) }
-  .fini_array     : { *(.fini_array) }
-  .data           : {
-    INIT_TASK_DATA(KERNEL_STACK_SIZE)
-    . = ALIGN(KERNEL_STACK_SIZE);
-    *(.data..init_irqstack)
-    DATA_DATA
-    *(.data.* .gnu.linkonce.d.*)
-    SORT(CONSTRUCTORS)
-  }
-  .data1          : { *(.data1) }
-  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
-  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
-  .eh_frame       : { KEEP (*(.eh_frame)) }
-  .gcc_except_table   : { *(.gcc_except_table) }
-  .dynamic        : { *(.dynamic) }
-  .ctors          : {
-    /* gcc uses crtbegin.o to find the start of
-       the constructors, so we make sure it is
-       first.  Because this is a wildcard, it
-       doesn't matter if the user does not
-       actually link against crtbegin.o; the
-       linker won't look for a file to match a
-       wildcard.  The wildcard also means that it
-       doesn't matter which directory crtbegin.o
-       is in.  */
-    KEEP (*crtbegin.o(.ctors))
-    /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last */
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors))
-  }
-  .dtors          : {
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors))
-  }
-  .jcr            : { KEEP (*(.jcr)) }
-  .got            : { *(.got.plt) *(.got) }
-  _edata = .;
-  PROVIDE (edata = .);
-  .bss            : {
-   __bss_start = .;
-   *(.dynbss)
-   *(.bss .bss.* .gnu.linkonce.b.*)
-   *(COMMON)
-   /* Align here to ensure that the .bss section occupies space up to
-      _end.  Align after .bss to ensure correct alignment even if the
-      .bss section disappears because there are no input sections.  */
-   . = ALIGN(32 / 8);
-  . = ALIGN(32 / 8);
-  }
-   __bss_stop = .;
-  _end = .;
-  PROVIDE (end = .);
-
-  STABS_DEBUG
-
-  DWARF_DEBUG
-
-  DISCARDS
-}
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
deleted file mode 100644
index 9f21443be2c9e..0000000000000
--- a/arch/um/kernel/uml.lds.S
+++ /dev/null
@@ -1,115 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <asm/vmlinux.lds.h>
-#include <asm/page.h>
-
-OUTPUT_FORMAT(ELF_FORMAT)
-OUTPUT_ARCH(ELF_ARCH)
-ENTRY(_start)
-jiffies = jiffies_64;
-
-SECTIONS
-{
-  /* This must contain the right address - not quite the default ELF one.*/
-  PROVIDE (__executable_start = START);
-  /* Static binaries stick stuff here, like the sigreturn trampoline,
-   * invisibly to objdump.  So, just make __binary_start equal to the very
-   * beginning of the executable, and if there are unmapped pages after this,
-   * they are forever unusable.
-   */
-  __binary_start = START;
-
-  . = START + SIZEOF_HEADERS;
-
-  _text = .;
-  INIT_TEXT_SECTION(0)
-  . = ALIGN(PAGE_SIZE);
-
-  .text      :
-  {
-    _stext = .;
-    TEXT_TEXT
-    SCHED_TEXT
-    CPUIDLE_TEXT
-    LOCK_TEXT
-    IRQENTRY_TEXT
-    SOFTIRQENTRY_TEXT
-    *(.fixup)
-    /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
-    *(.gnu.linkonce.t*)
-  }
-
-  . = ALIGN(PAGE_SIZE);
-  .syscall_stub : {
-	__syscall_stub_start = .;
-	*(.__syscall_stub*)
-	__syscall_stub_end = .;
-  }
-
-  /*
-   * These are needed even in a static link, even if they wind up being empty.
-   * Newer glibc needs these __rel{,a}_iplt_{start,end} symbols.
-   */
-  .rel.plt : {
-	*(.rel.plt)
-	PROVIDE_HIDDEN(__rel_iplt_start = .);
-	*(.rel.iplt)
-	PROVIDE_HIDDEN(__rel_iplt_end = .);
-  }
-  .rela.plt : {
-	*(.rela.plt)
-	PROVIDE_HIDDEN(__rela_iplt_start = .);
-	*(.rela.iplt)
-	PROVIDE_HIDDEN(__rela_iplt_end = .);
-  }
-
-  #include <asm/common.lds.S>
-
-  __init_begin = .;
-  init.data : { INIT_DATA }
-  __init_end = .;
-
-  .data    :
-  {
-    INIT_TASK_DATA(KERNEL_STACK_SIZE)
-    . = ALIGN(KERNEL_STACK_SIZE);
-    *(.data..init_irqstack)
-    DATA_DATA
-    *(.gnu.linkonce.d*)
-    CONSTRUCTORS
-  }
-  .data1   : { *(.data1) }
-  .ctors         :
-  {
-    *(.ctors)
-  }
-  .dtors         :
-  {
-    *(.dtors)
-  }
-
-  .got           : { *(.got.plt) *(.got) }
-  .dynamic       : { *(.dynamic) }
-  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
-  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
-  /* We want the small data sections together, so single-instruction offsets
-     can access them all, and initialized data all before uninitialized, so
-     we can shorten the on-disk segment size.  */
-  .sdata     : { *(.sdata) }
-  _edata  =  .;
-  PROVIDE (edata = .);
-  . = ALIGN(PAGE_SIZE);
-  __bss_start = .;
-  PROVIDE(_bss_start = .);
-  SBSS(0)
-  BSS(0)
-   __bss_stop = .;
-  _end = .;
-  PROVIDE (end = .);
-
-  STABS_DEBUG
-
-  DWARF_DEBUG
-
-  DISCARDS
-}
diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
index 16e49bfa2b426..f4b6114e54d62 100644
--- a/arch/um/kernel/vmlinux.lds.S
+++ b/arch/um/kernel/vmlinux.lds.S
@@ -1,8 +1,173 @@
 
 KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
 
-#ifdef CONFIG_LD_SCRIPT_STATIC
-#include "uml.lds.S"
-#else
-#include "dyn.lds.S"
-#endif
+#include <asm/vmlinux.lds.h>
+#include <asm/page.h>
+
+OUTPUT_FORMAT(ELF_FORMAT)
+OUTPUT_ARCH(ELF_ARCH)
+ENTRY(_start)
+jiffies = jiffies_64;
+
+SECTIONS
+{
+  PROVIDE (__executable_start = START);
+  . = START + SIZEOF_HEADERS;
+  .interp         : { *(.interp) }
+  __binary_start = .;
+  . = ALIGN(4096);		/* Init code and data */
+  _text = .;
+  INIT_TEXT_SECTION(PAGE_SIZE)
+
+  . = ALIGN(PAGE_SIZE);
+
+  /* Read-only sections, merged into text segment: */
+  .hash           : { *(.hash) }
+  .gnu.hash       : { *(.gnu.hash) }
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+  .rel.init       : { *(.rel.init) }
+  .rela.init      : { *(.rela.init) }
+  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
+  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+  .rel.fini       : { *(.rel.fini) }
+  .rela.fini      : { *(.rela.fini) }
+  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
+  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
+  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
+  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
+  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
+  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
+  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
+  .rel.ctors      : { *(.rel.ctors) }
+  .rela.ctors     : { *(.rela.ctors) }
+  .rel.dtors      : { *(.rel.dtors) }
+  .rela.dtors     : { *(.rela.dtors) }
+  .rel.got        : { *(.rel.got) }
+  .rela.got       : { *(.rela.got) }
+  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
+  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
+  .rel.plt : {
+	*(.rel.plt)
+	PROVIDE_HIDDEN(__rel_iplt_start = .);
+	*(.rel.iplt)
+	PROVIDE_HIDDEN(__rel_iplt_end = .);
+  }
+  .rela.plt : {
+	*(.rela.plt)
+	PROVIDE_HIDDEN(__rela_iplt_start = .);
+	*(.rela.iplt)
+	PROVIDE_HIDDEN(__rela_iplt_end = .);
+  }
+  .init           : {
+    KEEP (*(.init))
+  } =0x90909090
+  .plt            : { *(.plt) }
+  .text           : {
+    _stext = .;
+    TEXT_TEXT
+    SCHED_TEXT
+    CPUIDLE_TEXT
+    LOCK_TEXT
+    IRQENTRY_TEXT
+    SOFTIRQENTRY_TEXT
+    *(.fixup)
+    *(.stub .text.* .gnu.linkonce.t.*)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+
+    . = ALIGN(PAGE_SIZE);
+  } =0x90909090
+  . = ALIGN(PAGE_SIZE);
+  .syscall_stub : {
+	__syscall_stub_start = .;
+	*(.__syscall_stub*)
+	__syscall_stub_end = .;
+  }
+  .fini           : {
+    KEEP (*(.fini))
+  } =0x90909090
+
+  .kstrtab : { *(.kstrtab) }
+
+  #include <asm/common.lds.S>
+
+  __init_begin = .;
+  init.data : { INIT_DATA }
+  __init_end = .;
+
+  /* Ensure the __preinit_array_start label is properly aligned.  We
+     could instead move the label definition inside the section, but
+     the linker would then create the section even if it turns out to
+     be empty, which isn't pretty.  */
+  . = ALIGN(32 / 8);
+  .preinit_array     : { *(.preinit_array) }
+  .fini_array     : { *(.fini_array) }
+  .data           : {
+    INIT_TASK_DATA(KERNEL_STACK_SIZE)
+    . = ALIGN(KERNEL_STACK_SIZE);
+    *(.data..init_irqstack)
+    DATA_DATA
+    *(.data.* .gnu.linkonce.d.*)
+    SORT(CONSTRUCTORS)
+  }
+  .data1          : { *(.data1) }
+  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+  .eh_frame       : { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : { *(.gcc_except_table) }
+  .dynamic        : { *(.dynamic) }
+  .ctors          : {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, so we make sure it is
+       first.  Because this is a wildcard, it
+       doesn't matter if the user does not
+       actually link against crtbegin.o; the
+       linker won't look for a file to match a
+       wildcard.  The wildcard also means that it
+       doesn't matter which directory crtbegin.o
+       is in.  */
+    KEEP (*crtbegin.o(.ctors))
+    /* We don't want to include the .ctor section from
+       from the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+  }
+  .dtors          : {
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+  }
+  .jcr            : { KEEP (*(.jcr)) }
+  .got            : { *(.got.plt) *(.got) }
+  _edata = .;
+  PROVIDE (edata = .);
+  .bss            : {
+   __bss_start = .;
+   *(.dynbss)
+   *(.bss .bss.* .gnu.linkonce.b.*)
+   *(COMMON)
+   /* Align here to ensure that the .bss section occupies space up to
+      _end.  Align after .bss to ensure correct alignment even if the
+      .bss section disappears because there are no input sections.  */
+   . = ALIGN(32 / 8);
+  . = ALIGN(32 / 8);
+  }
+   __bss_stop = .;
+  _end = .;
+  PROVIDE (end = .);
+
+  STABS_DEBUG
+
+  DWARF_DEBUG
+
+  DISCARDS
+}
-- 
2.24.0.393.g34dc348eaf-goog


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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-06  2:01 ` [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP Brendan Higgins
@ 2019-12-06  7:23   ` Anton Ivanov
  2019-12-07  0:32     ` Brendan Higgins
  0 siblings, 1 reply; 15+ messages in thread
From: Anton Ivanov @ 2019-12-06  7:23 UTC (permalink / raw)
  To: Brendan Higgins, jdike, richard
  Cc: johannes.berg, linux-um, linux-kernel, davidgow

On 06/12/2019 02:01, Brendan Higgins wrote:
> Remove support for UML_NET_PCAP. It is broken. When building with
> libpcap installed, the build fails:
> 
> arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
>   static int pcap_open(void *data)
>              ^~~~~~~~~
> In file included from /usr/include/pcap.h:43,
>                   from arch/um/drivers/pcap_user.c:7:
> /usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
>   PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
>                    ^~~~~~~~~
> 
> So it looks like this has probably been broken for some time.
> 
> In interest of trying to make allyesconfig work with UML, it is best
> just to drop this.
> 
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> ---
>   arch/um/drivers/Kconfig     |  16 -----
>   arch/um/drivers/Makefile    |  17 +----
>   arch/um/drivers/pcap_kern.c | 113 -----------------------------
>   arch/um/drivers/pcap_user.c | 137 ------------------------------------
>   arch/um/drivers/pcap_user.h |  21 ------
>   5 files changed, 2 insertions(+), 302 deletions(-)
>   delete mode 100644 arch/um/drivers/pcap_kern.c
>   delete mode 100644 arch/um/drivers/pcap_user.c
>   delete mode 100644 arch/um/drivers/pcap_user.h
> 
> diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig
> index 388096fb45a25..98fead07c33de 100644
> --- a/arch/um/drivers/Kconfig
> +++ b/arch/um/drivers/Kconfig
> @@ -291,22 +291,6 @@ config UML_NET_MCAST
>   	  exclusive).  If you don't need to network UMLs say N to each of
>   	  the transports.
>   
> -config UML_NET_PCAP
> -	bool "pcap transport"
> -	depends on UML_NET
> -	help
> -	The pcap transport makes a pcap packet stream on the host look
> -	like an ethernet device inside UML.  This is useful for making
> -	UML act as a network monitor for the host.  You must have libcap
> -	installed in order to build the pcap transport into UML.
> -
> -	  For more information, see
> -	  <http://user-mode-linux.sourceforge.net/old/networking.html>  That site
> -	  has examples of the UML command line to use to enable this option.
> -
> -	If you intend to use UML as a network monitor for the host, say
> -	Y here.  Otherwise, say N.
> -
>   config UML_NET_SLIRP
>   	bool "SLiRP transport"
>   	depends on UML_NET
> diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
> index a290821e355c2..7548b18e77a27 100644
> --- a/arch/um/drivers/Makefile
> +++ b/arch/um/drivers/Makefile
> @@ -3,9 +3,6 @@
>   # Copyright (C) 2000, 2002, 2003 Jeff Dike (jdike@karaya.com)
>   #
>   
> -# pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked
> -# in to pcap.o
> -
>   slip-objs := slip_kern.o slip_user.o
>   slirp-objs := slirp_kern.o slirp_user.o
>   daemon-objs := daemon_kern.o daemon_user.o
> @@ -18,14 +15,9 @@ ubd-objs := ubd_kern.o ubd_user.o
>   port-objs := port_kern.o port_user.o
>   harddog-objs := harddog_kern.o harddog_user.o
>   
> -LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a)
> -
>   LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a)
>   
> -targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
> -
> -$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
> -	$(LD) -r -dp -o $@ $^ $(ld_flags)
> +targets := vde_kern.o vde_user.o
>   
>   $(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
>   	$(LD) -r -dp -o $@ $^ $(ld_flags)
> @@ -34,9 +26,6 @@ $(obj)/vde.o: $(obj)/vde_kern.o $(obj)/vde_user.o
>   # object name, so nothing from the library gets linked.
>   #$(call if_changed,ld)
>   
> -# When the above is fixed, don't forget to add this too!
> -#targets += $(obj)/pcap.o
> -
>   obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o
>   obj-$(CONFIG_SSL) += ssl.o
>   obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o
> @@ -47,7 +36,6 @@ obj-$(CONFIG_UML_NET_DAEMON) += daemon.o
>   obj-$(CONFIG_UML_NET_VECTOR) += vector.o
>   obj-$(CONFIG_UML_NET_VDE) += vde.o
>   obj-$(CONFIG_UML_NET_MCAST) += umcast.o
> -obj-$(CONFIG_UML_NET_PCAP) += pcap.o
>   obj-$(CONFIG_UML_NET) += net.o
>   obj-$(CONFIG_MCONSOLE) += mconsole.o
>   obj-$(CONFIG_MMAPPER) += mmapper_kern.o
> @@ -63,8 +51,7 @@ obj-$(CONFIG_BLK_DEV_COW_COMMON) += cow_user.o
>   obj-$(CONFIG_UML_RANDOM) += random.o
>   obj-$(CONFIG_VIRTIO_UML) += virtio_uml.o
>   
> -# pcap_user.o must be added explicitly.
> -USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o pcap_user.o vde_user.o vector_user.o
> +USER_OBJS := fd.o null.o pty.o tty.o xterm.o slip_common.o vde_user.o vector_user.o
>   CFLAGS_null.o = -DDEV_NULL=$(DEV_NULL_PATH)
>   
>   include arch/um/scripts/Makefile.rules
> diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c
> deleted file mode 100644
> index cfe4cb17694cc..0000000000000
> --- a/arch/um/drivers/pcap_kern.c
> +++ /dev/null
> @@ -1,113 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
> - */
> -
> -#include <linux/init.h>
> -#include <linux/netdevice.h>
> -#include <net_kern.h>
> -#include "pcap_user.h"
> -
> -struct pcap_init {
> -	char *host_if;
> -	int promisc;
> -	int optimize;
> -	char *filter;
> -};
> -
> -void pcap_init(struct net_device *dev, void *data)
> -{
> -	struct uml_net_private *pri;
> -	struct pcap_data *ppri;
> -	struct pcap_init *init = data;
> -
> -	pri = netdev_priv(dev);
> -	ppri = (struct pcap_data *) pri->user;
> -	ppri->host_if = init->host_if;
> -	ppri->promisc = init->promisc;
> -	ppri->optimize = init->optimize;
> -	ppri->filter = init->filter;
> -
> -	printk("pcap backend, host interface %s\n", ppri->host_if);
> -}
> -
> -static int pcap_read(int fd, struct sk_buff *skb, struct uml_net_private *lp)
> -{
> -	return pcap_user_read(fd, skb_mac_header(skb),
> -			      skb->dev->mtu + ETH_HEADER_OTHER,
> -			      (struct pcap_data *) &lp->user);
> -}
> -
> -static int pcap_write(int fd, struct sk_buff *skb, struct uml_net_private *lp)
> -{
> -	return -EPERM;
> -}
> -
> -static const struct net_kern_info pcap_kern_info = {
> -	.init			= pcap_init,
> -	.protocol		= eth_protocol,
> -	.read			= pcap_read,
> -	.write			= pcap_write,
> -};
> -
> -int pcap_setup(char *str, char **mac_out, void *data)
> -{
> -	struct pcap_init *init = data;
> -	char *remain, *host_if = NULL, *options[2] = { NULL, NULL };
> -	int i;
> -
> -	*init = ((struct pcap_init)
> -		{ .host_if 	= "eth0",
> -		  .promisc 	= 1,
> -		  .optimize 	= 0,
> -		  .filter 	= NULL });
> -
> -	remain = split_if_spec(str, &host_if, &init->filter,
> -			       &options[0], &options[1], mac_out, NULL);
> -	if (remain != NULL) {
> -		printk(KERN_ERR "pcap_setup - Extra garbage on "
> -		       "specification : '%s'\n", remain);
> -		return 0;
> -	}
> -
> -	if (host_if != NULL)
> -		init->host_if = host_if;
> -
> -	for (i = 0; i < ARRAY_SIZE(options); i++) {
> -		if (options[i] == NULL)
> -			continue;
> -		if (!strcmp(options[i], "promisc"))
> -			init->promisc = 1;
> -		else if (!strcmp(options[i], "nopromisc"))
> -			init->promisc = 0;
> -		else if (!strcmp(options[i], "optimize"))
> -			init->optimize = 1;
> -		else if (!strcmp(options[i], "nooptimize"))
> -			init->optimize = 0;
> -		else {
> -			printk(KERN_ERR "pcap_setup : bad option - '%s'\n",
> -			       options[i]);
> -			return 0;
> -		}
> -	}
> -
> -	return 1;
> -}
> -
> -static struct transport pcap_transport = {
> -	.list 		= LIST_HEAD_INIT(pcap_transport.list),
> -	.name 		= "pcap",
> -	.setup  	= pcap_setup,
> -	.user 		= &pcap_user_info,
> -	.kern 		= &pcap_kern_info,
> -	.private_size 	= sizeof(struct pcap_data),
> -	.setup_size 	= sizeof(struct pcap_init),
> -};
> -
> -static int register_pcap(void)
> -{
> -	register_transport(&pcap_transport);
> -	return 0;
> -}
> -
> -late_initcall(register_pcap);
> diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c
> deleted file mode 100644
> index bbd20638788af..0000000000000
> --- a/arch/um/drivers/pcap_user.c
> +++ /dev/null
> @@ -1,137 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
> - */
> -
> -#include <errno.h>
> -#include <pcap.h>
> -#include <string.h>
> -#include <asm/types.h>
> -#include <net_user.h>
> -#include "pcap_user.h"
> -#include <um_malloc.h>
> -
> -#define PCAP_FD(p) (*(int *)(p))
> -
> -static int pcap_user_init(void *data, void *dev)
> -{
> -	struct pcap_data *pri = data;
> -	pcap_t *p;
> -	char errors[PCAP_ERRBUF_SIZE];
> -
> -	p = pcap_open_live(pri->host_if, ETH_MAX_PACKET + ETH_HEADER_OTHER,
> -			   pri->promisc, 0, errors);
> -	if (p == NULL) {
> -		printk(UM_KERN_ERR "pcap_user_init : pcap_open_live failed - "
> -		       "'%s'\n", errors);
> -		return -EINVAL;
> -	}
> -
> -	pri->dev = dev;
> -	pri->pcap = p;
> -	return 0;
> -}
> -
> -static int pcap_open(void *data)
> -{
> -	struct pcap_data *pri = data;
> -	__u32 netmask;
> -	int err;
> -
> -	if (pri->pcap == NULL)
> -		return -ENODEV;
> -
> -	if (pri->filter != NULL) {
> -		err = dev_netmask(pri->dev, &netmask);
> -		if (err < 0) {
> -			printk(UM_KERN_ERR "pcap_open : dev_netmask failed\n");
> -			return -EIO;
> -		}
> -
> -		pri->compiled = uml_kmalloc(sizeof(struct bpf_program),
> -					UM_GFP_KERNEL);
> -		if (pri->compiled == NULL) {
> -			printk(UM_KERN_ERR "pcap_open : kmalloc failed\n");
> -			return -ENOMEM;
> -		}
> -
> -		err = pcap_compile(pri->pcap,
> -				   (struct bpf_program *) pri->compiled,
> -				   pri->filter, pri->optimize, netmask);
> -		if (err < 0) {
> -			printk(UM_KERN_ERR "pcap_open : pcap_compile failed - "
> -			       "'%s'\n", pcap_geterr(pri->pcap));
> -			goto out;
> -		}
> -
> -		err = pcap_setfilter(pri->pcap, pri->compiled);
> -		if (err < 0) {
> -			printk(UM_KERN_ERR "pcap_open : pcap_setfilter "
> -			       "failed - '%s'\n", pcap_geterr(pri->pcap));
> -			goto out;
> -		}
> -	}
> -
> -	return PCAP_FD(pri->pcap);
> -
> - out:
> -	kfree(pri->compiled);
> -	return -EIO;
> -}
> -
> -static void pcap_remove(void *data)
> -{
> -	struct pcap_data *pri = data;
> -
> -	if (pri->compiled != NULL)
> -		pcap_freecode(pri->compiled);
> -
> -	if (pri->pcap != NULL)
> -		pcap_close(pri->pcap);
> -}
> -
> -struct pcap_handler_data {
> -	char *buffer;
> -	int len;
> -};
> -
> -static void handler(u_char *data, const struct pcap_pkthdr *header,
> -		    const u_char *packet)
> -{
> -	int len;
> -
> -	struct pcap_handler_data *hdata = (struct pcap_handler_data *) data;
> -
> -	len = hdata->len < header->caplen ? hdata->len : header->caplen;
> -	memcpy(hdata->buffer, packet, len);
> -	hdata->len = len;
> -}
> -
> -int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri)
> -{
> -	struct pcap_handler_data hdata = ((struct pcap_handler_data)
> -		                          { .buffer  	= buffer,
> -					    .len 	= len });
> -	int n;
> -
> -	n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata);
> -	if (n < 0) {
> -		printk(UM_KERN_ERR "pcap_dispatch failed - %s\n",
> -		       pcap_geterr(pri->pcap));
> -		return -EIO;
> -	}
> -	else if (n == 0)
> -		return 0;
> -	return hdata.len;
> -}
> -
> -const struct net_user_info pcap_user_info = {
> -	.init		= pcap_user_init,
> -	.open		= pcap_open,
> -	.close	 	= NULL,
> -	.remove	 	= pcap_remove,
> -	.add_address	= NULL,
> -	.delete_address = NULL,
> -	.mtu		= ETH_MAX_PACKET,
> -	.max_packet	= ETH_MAX_PACKET + ETH_HEADER_OTHER,
> -};
> diff --git a/arch/um/drivers/pcap_user.h b/arch/um/drivers/pcap_user.h
> deleted file mode 100644
> index 216246f5f09bd..0000000000000
> --- a/arch/um/drivers/pcap_user.h
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
> - */
> -
> -#include <net_user.h>
> -
> -struct pcap_data {
> -	char *host_if;
> -	int promisc;
> -	int optimize;
> -	char *filter;
> -	void *compiled;
> -	void *pcap;
> -	void *dev;
> -};
> -
> -extern const struct net_user_info pcap_user_info;
> -
> -extern int pcap_user_read(int fd, void *buf, int len, struct pcap_data *pri);
> -
> 

1. There is a proposed patch for the build system to fix it.

2. We should be removing all old drivers and replacing them with the 
vector ones.

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

* Re: [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK
  2019-12-06  2:01 ` [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK Brendan Higgins
@ 2019-12-06  7:41   ` Anton Ivanov
  2019-12-06 22:49     ` Brendan Higgins
  0 siblings, 1 reply; 15+ messages in thread
From: Anton Ivanov @ 2019-12-06  7:41 UTC (permalink / raw)
  To: Brendan Higgins, jdike, richard
  Cc: johannes.berg, linux-um, linux-kernel, davidgow

On 06/12/2019 02:01, Brendan Higgins wrote:
> CONFIG_STATIC_LINK appears to have been broken since before v4.20. It
> doesn't play nice with CONFIG_UML_NET_VECTOR=y:
> 
> /usr/bin/ld: arch/um/drivers/vector_user.o: in function
> `user_init_socket_fds': vector_user.c:(.text+0x430): warning: Using
> 'getaddrinfo' in statically linked applications requires at runtime the
> shared libraries from the glibc version used for linking
> 
> And it seems to break the ptrace check:
> 
> Checking that ptrace can change system call numbers...check_ptrace :
> child exited with exitcode 6, while expecting 0; status 0x67f
> [1]    126822 abort      ./linux mem=256M
> 
> Given the importance of ptrace in UML, CONFIG_STATIC_LINK seems totally
> broken right now; remove it in order to fix allyesconfig for ARCH=um.
> 
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> ---
>   arch/um/Kconfig              |  23 +----
>   arch/um/Makefile             |   3 +-
>   arch/um/kernel/dyn.lds.S     | 170 ----------------------------------
>   arch/um/kernel/uml.lds.S     | 115 -----------------------
>   arch/um/kernel/vmlinux.lds.S | 175 ++++++++++++++++++++++++++++++++++-
>   5 files changed, 172 insertions(+), 314 deletions(-)
>   delete mode 100644 arch/um/kernel/dyn.lds.S
>   delete mode 100644 arch/um/kernel/uml.lds.S
> 
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 2a6d04fcb3e91..00927fb7ce67a 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -19,6 +19,7 @@ config UML
>   	select GENERIC_CLOCKEVENTS
>   	select HAVE_GCC_PLUGINS
>   	select TTY # Needed for line.c
> +	select MODULE_REL_CRCS if MODVERSIONS
>   
>   config MMU
>   	bool
> @@ -61,28 +62,6 @@ config NR_CPUS
>   
>   source "arch/$(HEADER_ARCH)/um/Kconfig"
>   
> -config STATIC_LINK
> -	bool "Force a static link"
> -	default n
> -	help
> -	  This option gives you the ability to force a static link of UML.
> -	  Normally, UML is linked as a shared binary.  This is inconvenient for
> -	  use in a chroot jail.  So, if you intend to run UML inside a chroot,
> -	  you probably want to say Y here.
> -	  Additionally, this option enables using higher memory spaces (up to
> -	  2.75G) for UML.
> -
> -config LD_SCRIPT_STATIC
> -	bool
> -	default y
> -	depends on STATIC_LINK
> -
> -config LD_SCRIPT_DYN
> -	bool
> -	default y
> -	depends on !LD_SCRIPT_STATIC
> -	select MODULE_REL_CRCS if MODVERSIONS
> -
>   config HOSTFS
>   	tristate "Host filesystem"
>   	help
> diff --git a/arch/um/Makefile b/arch/um/Makefile
> index d2daa206872da..ec8af28daf051 100644
> --- a/arch/um/Makefile
> +++ b/arch/um/Makefile
> @@ -117,8 +117,7 @@ archheaders:
>   archprepare:
>   	$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
>   
> -LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
> -LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie)
> +LINK-y += -Wl,-rpath,/lib $(call cc-option, -no-pie)
>   
>   CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
>   	$(call cc-option, -fno-stack-protector,) \
> diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
> deleted file mode 100644
> index c69d69ee96beb..0000000000000
> --- a/arch/um/kernel/dyn.lds.S
> +++ /dev/null
> @@ -1,170 +0,0 @@
> -#include <asm/vmlinux.lds.h>
> -#include <asm/page.h>
> -
> -OUTPUT_FORMAT(ELF_FORMAT)
> -OUTPUT_ARCH(ELF_ARCH)
> -ENTRY(_start)
> -jiffies = jiffies_64;
> -
> -SECTIONS
> -{
> -  PROVIDE (__executable_start = START);
> -  . = START + SIZEOF_HEADERS;
> -  .interp         : { *(.interp) }
> -  __binary_start = .;
> -  . = ALIGN(4096);		/* Init code and data */
> -  _text = .;
> -  INIT_TEXT_SECTION(PAGE_SIZE)
> -
> -  . = ALIGN(PAGE_SIZE);
> -
> -  /* Read-only sections, merged into text segment: */
> -  .hash           : { *(.hash) }
> -  .gnu.hash       : { *(.gnu.hash) }
> -  .dynsym         : { *(.dynsym) }
> -  .dynstr         : { *(.dynstr) }
> -  .gnu.version    : { *(.gnu.version) }
> -  .gnu.version_d  : { *(.gnu.version_d) }
> -  .gnu.version_r  : { *(.gnu.version_r) }
> -  .rel.init       : { *(.rel.init) }
> -  .rela.init      : { *(.rela.init) }
> -  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
> -  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
> -  .rel.fini       : { *(.rel.fini) }
> -  .rela.fini      : { *(.rela.fini) }
> -  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
> -  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
> -  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
> -  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
> -  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
> -  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
> -  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
> -  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
> -  .rel.ctors      : { *(.rel.ctors) }
> -  .rela.ctors     : { *(.rela.ctors) }
> -  .rel.dtors      : { *(.rel.dtors) }
> -  .rela.dtors     : { *(.rela.dtors) }
> -  .rel.got        : { *(.rel.got) }
> -  .rela.got       : { *(.rela.got) }
> -  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
> -  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
> -  .rel.plt : {
> -	*(.rel.plt)
> -	PROVIDE_HIDDEN(__rel_iplt_start = .);
> -	*(.rel.iplt)
> -	PROVIDE_HIDDEN(__rel_iplt_end = .);
> -  }
> -  .rela.plt : {
> -	*(.rela.plt)
> -	PROVIDE_HIDDEN(__rela_iplt_start = .);
> -	*(.rela.iplt)
> -	PROVIDE_HIDDEN(__rela_iplt_end = .);
> -  }
> -  .init           : {
> -    KEEP (*(.init))
> -  } =0x90909090
> -  .plt            : { *(.plt) }
> -  .text           : {
> -    _stext = .;
> -    TEXT_TEXT
> -    SCHED_TEXT
> -    CPUIDLE_TEXT
> -    LOCK_TEXT
> -    IRQENTRY_TEXT
> -    SOFTIRQENTRY_TEXT
> -    *(.fixup)
> -    *(.stub .text.* .gnu.linkonce.t.*)
> -    /* .gnu.warning sections are handled specially by elf32.em.  */
> -    *(.gnu.warning)
> -
> -    . = ALIGN(PAGE_SIZE);
> -  } =0x90909090
> -  . = ALIGN(PAGE_SIZE);
> -  .syscall_stub : {
> -	__syscall_stub_start = .;
> -	*(.__syscall_stub*)
> -	__syscall_stub_end = .;
> -  }
> -  .fini           : {
> -    KEEP (*(.fini))
> -  } =0x90909090
> -
> -  .kstrtab : { *(.kstrtab) }
> -
> -  #include <asm/common.lds.S>
> -
> -  __init_begin = .;
> -  init.data : { INIT_DATA }
> -  __init_end = .;
> -
> -  /* Ensure the __preinit_array_start label is properly aligned.  We
> -     could instead move the label definition inside the section, but
> -     the linker would then create the section even if it turns out to
> -     be empty, which isn't pretty.  */
> -  . = ALIGN(32 / 8);
> -  .preinit_array     : { *(.preinit_array) }
> -  .fini_array     : { *(.fini_array) }
> -  .data           : {
> -    INIT_TASK_DATA(KERNEL_STACK_SIZE)
> -    . = ALIGN(KERNEL_STACK_SIZE);
> -    *(.data..init_irqstack)
> -    DATA_DATA
> -    *(.data.* .gnu.linkonce.d.*)
> -    SORT(CONSTRUCTORS)
> -  }
> -  .data1          : { *(.data1) }
> -  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
> -  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
> -  .eh_frame       : { KEEP (*(.eh_frame)) }
> -  .gcc_except_table   : { *(.gcc_except_table) }
> -  .dynamic        : { *(.dynamic) }
> -  .ctors          : {
> -    /* gcc uses crtbegin.o to find the start of
> -       the constructors, so we make sure it is
> -       first.  Because this is a wildcard, it
> -       doesn't matter if the user does not
> -       actually link against crtbegin.o; the
> -       linker won't look for a file to match a
> -       wildcard.  The wildcard also means that it
> -       doesn't matter which directory crtbegin.o
> -       is in.  */
> -    KEEP (*crtbegin.o(.ctors))
> -    /* We don't want to include the .ctor section from
> -       from the crtend.o file until after the sorted ctors.
> -       The .ctor section from the crtend file contains the
> -       end of ctors marker and it must be last */
> -    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
> -    KEEP (*(SORT(.ctors.*)))
> -    KEEP (*(.ctors))
> -  }
> -  .dtors          : {
> -    KEEP (*crtbegin.o(.dtors))
> -    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
> -    KEEP (*(SORT(.dtors.*)))
> -    KEEP (*(.dtors))
> -  }
> -  .jcr            : { KEEP (*(.jcr)) }
> -  .got            : { *(.got.plt) *(.got) }
> -  _edata = .;
> -  PROVIDE (edata = .);
> -  .bss            : {
> -   __bss_start = .;
> -   *(.dynbss)
> -   *(.bss .bss.* .gnu.linkonce.b.*)
> -   *(COMMON)
> -   /* Align here to ensure that the .bss section occupies space up to
> -      _end.  Align after .bss to ensure correct alignment even if the
> -      .bss section disappears because there are no input sections.  */
> -   . = ALIGN(32 / 8);
> -  . = ALIGN(32 / 8);
> -  }
> -   __bss_stop = .;
> -  _end = .;
> -  PROVIDE (end = .);
> -
> -  STABS_DEBUG
> -
> -  DWARF_DEBUG
> -
> -  DISCARDS
> -}
> diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
> deleted file mode 100644
> index 9f21443be2c9e..0000000000000
> --- a/arch/um/kernel/uml.lds.S
> +++ /dev/null
> @@ -1,115 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -#include <asm/vmlinux.lds.h>
> -#include <asm/page.h>
> -
> -OUTPUT_FORMAT(ELF_FORMAT)
> -OUTPUT_ARCH(ELF_ARCH)
> -ENTRY(_start)
> -jiffies = jiffies_64;
> -
> -SECTIONS
> -{
> -  /* This must contain the right address - not quite the default ELF one.*/
> -  PROVIDE (__executable_start = START);
> -  /* Static binaries stick stuff here, like the sigreturn trampoline,
> -   * invisibly to objdump.  So, just make __binary_start equal to the very
> -   * beginning of the executable, and if there are unmapped pages after this,
> -   * they are forever unusable.
> -   */
> -  __binary_start = START;
> -
> -  . = START + SIZEOF_HEADERS;
> -
> -  _text = .;
> -  INIT_TEXT_SECTION(0)
> -  . = ALIGN(PAGE_SIZE);
> -
> -  .text      :
> -  {
> -    _stext = .;
> -    TEXT_TEXT
> -    SCHED_TEXT
> -    CPUIDLE_TEXT
> -    LOCK_TEXT
> -    IRQENTRY_TEXT
> -    SOFTIRQENTRY_TEXT
> -    *(.fixup)
> -    /* .gnu.warning sections are handled specially by elf32.em.  */
> -    *(.gnu.warning)
> -    *(.gnu.linkonce.t*)
> -  }
> -
> -  . = ALIGN(PAGE_SIZE);
> -  .syscall_stub : {
> -	__syscall_stub_start = .;
> -	*(.__syscall_stub*)
> -	__syscall_stub_end = .;
> -  }
> -
> -  /*
> -   * These are needed even in a static link, even if they wind up being empty.
> -   * Newer glibc needs these __rel{,a}_iplt_{start,end} symbols.
> -   */
> -  .rel.plt : {
> -	*(.rel.plt)
> -	PROVIDE_HIDDEN(__rel_iplt_start = .);
> -	*(.rel.iplt)
> -	PROVIDE_HIDDEN(__rel_iplt_end = .);
> -  }
> -  .rela.plt : {
> -	*(.rela.plt)
> -	PROVIDE_HIDDEN(__rela_iplt_start = .);
> -	*(.rela.iplt)
> -	PROVIDE_HIDDEN(__rela_iplt_end = .);
> -  }
> -
> -  #include <asm/common.lds.S>
> -
> -  __init_begin = .;
> -  init.data : { INIT_DATA }
> -  __init_end = .;
> -
> -  .data    :
> -  {
> -    INIT_TASK_DATA(KERNEL_STACK_SIZE)
> -    . = ALIGN(KERNEL_STACK_SIZE);
> -    *(.data..init_irqstack)
> -    DATA_DATA
> -    *(.gnu.linkonce.d*)
> -    CONSTRUCTORS
> -  }
> -  .data1   : { *(.data1) }
> -  .ctors         :
> -  {
> -    *(.ctors)
> -  }
> -  .dtors         :
> -  {
> -    *(.dtors)
> -  }
> -
> -  .got           : { *(.got.plt) *(.got) }
> -  .dynamic       : { *(.dynamic) }
> -  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
> -  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
> -  /* We want the small data sections together, so single-instruction offsets
> -     can access them all, and initialized data all before uninitialized, so
> -     we can shorten the on-disk segment size.  */
> -  .sdata     : { *(.sdata) }
> -  _edata  =  .;
> -  PROVIDE (edata = .);
> -  . = ALIGN(PAGE_SIZE);
> -  __bss_start = .;
> -  PROVIDE(_bss_start = .);
> -  SBSS(0)
> -  BSS(0)
> -   __bss_stop = .;
> -  _end = .;
> -  PROVIDE (end = .);
> -
> -  STABS_DEBUG
> -
> -  DWARF_DEBUG
> -
> -  DISCARDS
> -}
> diff --git a/arch/um/kernel/vmlinux.lds.S b/arch/um/kernel/vmlinux.lds.S
> index 16e49bfa2b426..f4b6114e54d62 100644
> --- a/arch/um/kernel/vmlinux.lds.S
> +++ b/arch/um/kernel/vmlinux.lds.S
> @@ -1,8 +1,173 @@
>   
>   KERNEL_STACK_SIZE = 4096 * (1 << CONFIG_KERNEL_STACK_ORDER);
>   
> -#ifdef CONFIG_LD_SCRIPT_STATIC
> -#include "uml.lds.S"
> -#else
> -#include "dyn.lds.S"
> -#endif
> +#include <asm/vmlinux.lds.h>
> +#include <asm/page.h>
> +
> +OUTPUT_FORMAT(ELF_FORMAT)
> +OUTPUT_ARCH(ELF_ARCH)
> +ENTRY(_start)
> +jiffies = jiffies_64;
> +
> +SECTIONS
> +{
> +  PROVIDE (__executable_start = START);
> +  . = START + SIZEOF_HEADERS;
> +  .interp         : { *(.interp) }
> +  __binary_start = .;
> +  . = ALIGN(4096);		/* Init code and data */
> +  _text = .;
> +  INIT_TEXT_SECTION(PAGE_SIZE)
> +
> +  . = ALIGN(PAGE_SIZE);
> +
> +  /* Read-only sections, merged into text segment: */
> +  .hash           : { *(.hash) }
> +  .gnu.hash       : { *(.gnu.hash) }
> +  .dynsym         : { *(.dynsym) }
> +  .dynstr         : { *(.dynstr) }
> +  .gnu.version    : { *(.gnu.version) }
> +  .gnu.version_d  : { *(.gnu.version_d) }
> +  .gnu.version_r  : { *(.gnu.version_r) }
> +  .rel.init       : { *(.rel.init) }
> +  .rela.init      : { *(.rela.init) }
> +  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
> +  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
> +  .rel.fini       : { *(.rel.fini) }
> +  .rela.fini      : { *(.rela.fini) }
> +  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
> +  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
> +  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
> +  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
> +  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
> +  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
> +  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
> +  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
> +  .rel.ctors      : { *(.rel.ctors) }
> +  .rela.ctors     : { *(.rela.ctors) }
> +  .rel.dtors      : { *(.rel.dtors) }
> +  .rela.dtors     : { *(.rela.dtors) }
> +  .rel.got        : { *(.rel.got) }
> +  .rela.got       : { *(.rela.got) }
> +  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
> +  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
> +  .rel.plt : {
> +	*(.rel.plt)
> +	PROVIDE_HIDDEN(__rel_iplt_start = .);
> +	*(.rel.iplt)
> +	PROVIDE_HIDDEN(__rel_iplt_end = .);
> +  }
> +  .rela.plt : {
> +	*(.rela.plt)
> +	PROVIDE_HIDDEN(__rela_iplt_start = .);
> +	*(.rela.iplt)
> +	PROVIDE_HIDDEN(__rela_iplt_end = .);
> +  }
> +  .init           : {
> +    KEEP (*(.init))
> +  } =0x90909090
> +  .plt            : { *(.plt) }
> +  .text           : {
> +    _stext = .;
> +    TEXT_TEXT
> +    SCHED_TEXT
> +    CPUIDLE_TEXT
> +    LOCK_TEXT
> +    IRQENTRY_TEXT
> +    SOFTIRQENTRY_TEXT
> +    *(.fixup)
> +    *(.stub .text.* .gnu.linkonce.t.*)
> +    /* .gnu.warning sections are handled specially by elf32.em.  */
> +    *(.gnu.warning)
> +
> +    . = ALIGN(PAGE_SIZE);
> +  } =0x90909090
> +  . = ALIGN(PAGE_SIZE);
> +  .syscall_stub : {
> +	__syscall_stub_start = .;
> +	*(.__syscall_stub*)
> +	__syscall_stub_end = .;
> +  }
> +  .fini           : {
> +    KEEP (*(.fini))
> +  } =0x90909090
> +
> +  .kstrtab : { *(.kstrtab) }
> +
> +  #include <asm/common.lds.S>
> +
> +  __init_begin = .;
> +  init.data : { INIT_DATA }
> +  __init_end = .;
> +
> +  /* Ensure the __preinit_array_start label is properly aligned.  We
> +     could instead move the label definition inside the section, but
> +     the linker would then create the section even if it turns out to
> +     be empty, which isn't pretty.  */
> +  . = ALIGN(32 / 8);
> +  .preinit_array     : { *(.preinit_array) }
> +  .fini_array     : { *(.fini_array) }
> +  .data           : {
> +    INIT_TASK_DATA(KERNEL_STACK_SIZE)
> +    . = ALIGN(KERNEL_STACK_SIZE);
> +    *(.data..init_irqstack)
> +    DATA_DATA
> +    *(.data.* .gnu.linkonce.d.*)
> +    SORT(CONSTRUCTORS)
> +  }
> +  .data1          : { *(.data1) }
> +  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
> +  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
> +  .eh_frame       : { KEEP (*(.eh_frame)) }
> +  .gcc_except_table   : { *(.gcc_except_table) }
> +  .dynamic        : { *(.dynamic) }
> +  .ctors          : {
> +    /* gcc uses crtbegin.o to find the start of
> +       the constructors, so we make sure it is
> +       first.  Because this is a wildcard, it
> +       doesn't matter if the user does not
> +       actually link against crtbegin.o; the
> +       linker won't look for a file to match a
> +       wildcard.  The wildcard also means that it
> +       doesn't matter which directory crtbegin.o
> +       is in.  */
> +    KEEP (*crtbegin.o(.ctors))
> +    /* We don't want to include the .ctor section from
> +       from the crtend.o file until after the sorted ctors.
> +       The .ctor section from the crtend file contains the
> +       end of ctors marker and it must be last */
> +    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
> +    KEEP (*(SORT(.ctors.*)))
> +    KEEP (*(.ctors))
> +  }
> +  .dtors          : {
> +    KEEP (*crtbegin.o(.dtors))
> +    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
> +    KEEP (*(SORT(.dtors.*)))
> +    KEEP (*(.dtors))
> +  }
> +  .jcr            : { KEEP (*(.jcr)) }
> +  .got            : { *(.got.plt) *(.got) }
> +  _edata = .;
> +  PROVIDE (edata = .);
> +  .bss            : {
> +   __bss_start = .;
> +   *(.dynbss)
> +   *(.bss .bss.* .gnu.linkonce.b.*)
> +   *(COMMON)
> +   /* Align here to ensure that the .bss section occupies space up to
> +      _end.  Align after .bss to ensure correct alignment even if the
> +      .bss section disappears because there are no input sections.  */
> +   . = ALIGN(32 / 8);
> +  . = ALIGN(32 / 8);
> +  }
> +   __bss_stop = .;
> +  _end = .;
> +  PROVIDE (end = .);
> +
> +  STABS_DEBUG
> +
> +  DWARF_DEBUG
> +
> +  DISCARDS
> +}
> 

The ptrace check was discussed on the list this week - it is the enable 
constructors commit in 5.3-rc1.

A patch reverting it was submitted by Johannes yesterday.

I did not try disabling/enabling static link - good catch.

Otherwise, I agree - static link should probably go.

Adding PCAP throws even more warnings and the AF_XDP work I have in 
progress generates a whole page of them. Considering that the resulting 
executable is not really static there is no point keeping the option.

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

* Re: [RFC v1 0/2] um: drop broken features to fix allyesconfig
  2019-12-06  2:01 [RFC v1 0/2] um: drop broken features to fix allyesconfig Brendan Higgins
  2019-12-06  2:01 ` [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP Brendan Higgins
  2019-12-06  2:01 ` [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK Brendan Higgins
@ 2019-12-06  7:45 ` Anton Ivanov
  2 siblings, 0 replies; 15+ messages in thread
From: Anton Ivanov @ 2019-12-06  7:45 UTC (permalink / raw)
  To: Brendan Higgins, jdike, richard
  Cc: davidgow, linux-um, linux-kernel, johannes.berg

On 06/12/2019 02:01, Brendan Higgins wrote:
> # TL;DR
> 
> This patchset drops two broken features in an attempt to get
> allyesconfig closer to working for ARCH=um.
> 
> # What am I trying to do?
> 
> This patchset is part of my attempt to get `make ARCH=um allyesconfig`
> to produce a config that will build *and* boot to init, so that I can
> use it as a mechanism to run tests[1].
> 
> # How far away are we from an allyesconfig UML kernel?
> 
> I have identified 33 Kconfigs that are selected by allyesconfig, but
> will either not build on UML, or prevent it from booting. They are:
> 
> CONFIG_STATIC_LINK=y
> CONFIG_UML_NET_PCAP=y
> CONFIG_NET_PTP_CLASSIFY=y
> CONFIG_IP_VS=y
> CONFIG_BRIDGE_EBT_BROUTE=y
> CONFIG_BRIDGE_EBT_T_FILTER=y
> CONFIG_BRIDGE_EBT_T_NAT=y
> CONFIG_MTD_NAND_CADENCE=y
> CONFIG_MTD_NAND_NANDSIM=y
> CONFIG_BLK_DEV_NULL_BLK=y
> CONFIG_BLK_DEV_RAM=y
> CONFIG_SCSI_DEBUG=y
> CONFIG_NET_VENDOR_XILINX=y
> CONFIG_NULL_TTY=y
> CONFIG_PTP_1588_CLOCK=y
> CONFIG_PINCTRL_EQUILIBRIUM=y
> CONFIG_DMABUF_SELFTESTS=y
> CONFIG_COMEDI=y
> CONFIG_XIL_AXIS_FIFO=y
> CONFIG_EXFAT_FS=y
> CONFIG_STM_DUMMY=y
> CONFIG_FSI_MASTER_ASPEED=y
> CONFIG_JFS_FS=y
> CONFIG_UBIFS_FS=y
> CONFIG_CRAMFS=y
> CONFIG_CRYPTO_DEV_SAFEXCEL=y
> CONFIG_CRYPTO_DEV_AMLOGIC_GXL=y
> CONFIG_KCOV=y
> CONFIG_LKDTM=y
> CONFIG_REED_SOLOMON_TEST=y
> CONFIG_TEST_RHASHTABLE=y
> CONFIG_TEST_MEMINIT=y
> CONFIG_NETWORK_PHY_TIMESTAMPING=y
> 
> This patchset attempts to deal with CONFIG_STATIC_LINK=y and
> CONFIG_UML_NET_PCAP=y by just removing them since they are broken and
> appear to have been broken for some time. (I am aware of the taboo of
> dropping configs, but given the amount of time they have been broken, I
> figured that I might be able to get away with it in this case, which is
> easier than trying to actually fix them.)
> 
> I also have a patch out to fix CONFIG_EXFAT_FS=y[2].
> 
> After this I plan on going after
> 
> CONFIG_PINCTRL_EQUILIBRIUM=y
> CONFIG_MTD_NAND_CADENCE=y
> CONFIG_FSI_MASTER_ASPEED=y
> CONFIG_CRYPTO_DEV_SAFEXCEL=y
> CONFIG_XIL_AXIS_FIFO=y
> CONFIG_CRYPTO_DEV_AMLOGIC_GXL=y
> CONFIG_XILINX_AXI_EMAC=y
> 
> the problem with these is that they depend on
> devm_platform_ioremap_resource without explicitly depending on
> CONFIG_HAS_IOMEM=y.
> 
> Also note that I don't think that CONFIG_NULL_TTY=y is actually broken
> on UML; however, console seems to get assigned to the null TTY by
> default when it is enabled, so I added it to the list for the sake of
> completeness.
> 
> The other broken configs require more investigation (I would welcome
> help, if anyone is interested ;-) ).
> 
> # Why won't allyesconfig break again after this series of fixes?
> 
> As I mentioned above, I am using UML for testing the kernel, and I am
> currently working on getting my tests to run on KernelCI. As part of our
> testing procedure for KernelCI, we are planning on building a UML kernel
> using allyesconfig and running our tests on it. Thus, we will find out
> very quickly once someone breaks allyesconfig again once we get this all
> working.
> 
> Brendan Higgins (2):
>    um: drivers: remove support for UML_NET_PCAP
>    uml: remove support for CONFIG_STATIC_LINK
> 
>   arch/um/Kconfig              |  23 +----
>   arch/um/Makefile             |   3 +-
>   arch/um/drivers/Kconfig      |  16 ----
>   arch/um/drivers/Makefile     |  17 +---
>   arch/um/drivers/pcap_kern.c  | 113 ----------------------
>   arch/um/drivers/pcap_user.c  | 137 ---------------------------
>   arch/um/drivers/pcap_user.h  |  21 -----
>   arch/um/kernel/dyn.lds.S     | 170 ----------------------------------
>   arch/um/kernel/uml.lds.S     | 115 -----------------------
>   arch/um/kernel/vmlinux.lds.S | 175 ++++++++++++++++++++++++++++++++++-
>   10 files changed, 174 insertions(+), 616 deletions(-)
>   delete mode 100644 arch/um/drivers/pcap_kern.c
>   delete mode 100644 arch/um/drivers/pcap_user.c
>   delete mode 100644 arch/um/drivers/pcap_user.h
>   delete mode 100644 arch/um/kernel/dyn.lds.S
>   delete mode 100644 arch/um/kernel/uml.lds.S
> 
> Looking forward to hearing people's thoughts!
> 
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=205223
> [2] https://patchwork.kernel.org/patch/11273771/
> 

Patch for pcap: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938962#79


-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

* Re: [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK
  2019-12-06  7:41   ` Anton Ivanov
@ 2019-12-06 22:49     ` Brendan Higgins
  0 siblings, 0 replies; 15+ messages in thread
From: Brendan Higgins @ 2019-12-06 22:49 UTC (permalink / raw)
  To: Anton Ivanov
  Cc: Jeff Dike, Richard Weinberger, johannes.berg, linux-um,
	Linux Kernel Mailing List, David Gow

On Thu, Dec 5, 2019 at 11:41 PM Anton Ivanov
<anton.ivanov@cambridgegreys.com> wrote:
>
> On 06/12/2019 02:01, Brendan Higgins wrote:
> > CONFIG_STATIC_LINK appears to have been broken since before v4.20. It
> > doesn't play nice with CONFIG_UML_NET_VECTOR=y:
> >
> > /usr/bin/ld: arch/um/drivers/vector_user.o: in function
> > `user_init_socket_fds': vector_user.c:(.text+0x430): warning: Using
> > 'getaddrinfo' in statically linked applications requires at runtime the
> > shared libraries from the glibc version used for linking
> >
> > And it seems to break the ptrace check:
> >
> > Checking that ptrace can change system call numbers...check_ptrace :
> > child exited with exitcode 6, while expecting 0; status 0x67f
> > [1]    126822 abort      ./linux mem=256M
> >
> > Given the importance of ptrace in UML, CONFIG_STATIC_LINK seems totally
> > broken right now; remove it in order to fix allyesconfig for ARCH=um.
> >
> > Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
[...]
> The ptrace check was discussed on the list this week - it is the enable
> constructors commit in 5.3-rc1.
>
> A patch reverting it was submitted by Johannes yesterday.
>
> I did not try disabling/enabling static link - good catch.
>
> Otherwise, I agree - static link should probably go.
>
> Adding PCAP throws even more warnings and the AF_XDP work I have in
> progress generates a whole page of them. Considering that the resulting
> executable is not really static there is no point keeping the option.

Sounds good. I will send this out again as a non-RFC patch.

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-06  7:23   ` Anton Ivanov
@ 2019-12-07  0:32     ` Brendan Higgins
  2019-12-07  1:21       ` Brendan Higgins
  0 siblings, 1 reply; 15+ messages in thread
From: Brendan Higgins @ 2019-12-07  0:32 UTC (permalink / raw)
  To: Anton Ivanov
  Cc: Jeff Dike, Richard Weinberger, David Gow, linux-um,
	Linux Kernel Mailing List, johannes.berg

On Thu, Dec 5, 2019 at 11:23 PM Anton Ivanov
<anton.ivanov@cambridgegreys.com> wrote:
[...]
> 1. There is a proposed patch for the build system to fix it.
>
> 2. We should be removing all old drivers and replacing them with the
> vector ones.

Hmm...does this mean you would entertain a patch removing all the
non-vector UML network drivers? I would be happy to see VDE go as
well.

In any event, it sounds like I should probably drop this patch as it
is currently.

Thanks!

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-07  0:32     ` Brendan Higgins
@ 2019-12-07  1:21       ` Brendan Higgins
  2019-12-07  9:14         ` Anton Ivanov
  0 siblings, 1 reply; 15+ messages in thread
From: Brendan Higgins @ 2019-12-07  1:21 UTC (permalink / raw)
  To: Anton Ivanov
  Cc: Jeff Dike, Richard Weinberger, David Gow, linux-um,
	Linux Kernel Mailing List, johannes.berg

On Fri, Dec 06, 2019 at 04:32:34PM -0800, Brendan Higgins wrote:
> On Thu, Dec 5, 2019 at 11:23 PM Anton Ivanov
> <anton.ivanov@cambridgegreys.com> wrote:
> [...]
> > 1. There is a proposed patch for the build system to fix it.

So I just tried the patch you linked on the cover letter[1], and I am
still getting the build error described above:

arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
 static int pcap_open(void *data)
            ^~~~~~~~~
In file included from /usr/include/pcap.h:43,
                 from arch/um/drivers/pcap_user.c:7:
/usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
 PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,

Looking at the patch, I wouldn't expect it to solve this problem.

Are there maybe different conflicting libpcap-dev libraries and I have
the wrong one? Or is this just still broken?

> > 2. We should be removing all old drivers and replacing them with the
> > vector ones.
> 
> Hmm...does this mean you would entertain a patch removing all the
> non-vector UML network drivers? I would be happy to see VDE go as
> well.
> 
> In any event, it sounds like I should probably drop this patch as it
> is currently.
> 
> Thanks!

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938962#79

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-07  1:21       ` Brendan Higgins
@ 2019-12-07  9:14         ` Anton Ivanov
  2019-12-09 23:40           ` Brendan Higgins
  0 siblings, 1 reply; 15+ messages in thread
From: Anton Ivanov @ 2019-12-07  9:14 UTC (permalink / raw)
  To: Brendan Higgins
  Cc: johannes.berg, Richard Weinberger, Jeff Dike, linux-um,
	Linux Kernel Mailing List, David Gow

On 07/12/2019 01:21, Brendan Higgins wrote:
> On Fri, Dec 06, 2019 at 04:32:34PM -0800, Brendan Higgins wrote:
>> On Thu, Dec 5, 2019 at 11:23 PM Anton Ivanov
>> <anton.ivanov@cambridgegreys.com> wrote:
>> [...]
>>> 1. There is a proposed patch for the build system to fix it.
> 
> So I just tried the patch you linked on the cover letter[1], and I am
> still getting the build error described above:
> 
> arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
>   static int pcap_open(void *data)
>              ^~~~~~~~~
> In file included from /usr/include/pcap.h:43,
>                   from arch/um/drivers/pcap_user.c:7:
> /usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
>   PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
> 
> Looking at the patch, I wouldn't expect it to solve this problem.
> 
> Are there maybe different conflicting libpcap-dev libraries and I have
> the wrong one? Or is this just still broken?
> 
>>> 2. We should be removing all old drivers and replacing them with the
>>> vector ones.
>>
>> Hmm...does this mean you would entertain a patch removing all the
>> non-vector UML network drivers? I would be happy to see VDE go as
>> well.
>>
>> In any event, it sounds like I should probably drop this patch as it
>> is currently.
>>
>> Thanks!
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938962#79
> 
> _______________________________________________
> linux-um mailing list
> linux-um@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-um
> 

OK, looks like the pcap.h differs now as well.

I will fix that too. It looks like you need both a pcap fix and a 
library linking fix for this to work.

The patch fixes the issue with the build system which no longer provides 
the means for UML to specify extra libraries (I probably had an older 
pcap version on the machine where I tested this).

IMHO frankly it is no longer necessary.

5.5-rc1 vector raw now has the facility to add/remove (including at 
runtime) filters compiled with pcap outside UML. It was merged this week.

We now have the following line-up for vector drivers - EoGRE, EoL2TPv3, 
RAW (+/- BPF), TAP and BESS. Speeds are 2.5 to 9Gbit on my machine 
(mid-range Ryzen desktop).

If I figure out a way to get hold of the underlying tap raw sockets the 
same way vhost does, TAP can probably go to 12Gbit or thereabouts. Same 
applies to getting zerocopy working with raw.

As a basis for comparison I get 18Gbit on the same machine using vEth 
and containers. 50% of that is actually a very decent number.

While vector drivers are not 1:1 replacements for the existing drivers, 
you can achieve the same topologies and the same connectivity at much 
higher performance - the old drivers test out in the 500Mbit range on 
the same hardware.

IMHO we should at least mark them as "obsolete" and start preparing to 
remove them.

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-07  9:14         ` Anton Ivanov
@ 2019-12-09 23:40           ` Brendan Higgins
  2019-12-10  0:02             ` Richard Weinberger
  2019-12-10  7:08             ` Anton Ivanov
  0 siblings, 2 replies; 15+ messages in thread
From: Brendan Higgins @ 2019-12-09 23:40 UTC (permalink / raw)
  To: Anton Ivanov
  Cc: johannes.berg, Richard Weinberger, Jeff Dike, linux-um,
	Linux Kernel Mailing List, David Gow

On Sat, Dec 7, 2019 at 1:15 AM Anton Ivanov
<anton.ivanov@cambridgegreys.com> wrote:
>
> On 07/12/2019 01:21, Brendan Higgins wrote:
> > On Fri, Dec 06, 2019 at 04:32:34PM -0800, Brendan Higgins wrote:
> >> On Thu, Dec 5, 2019 at 11:23 PM Anton Ivanov
> >> <anton.ivanov@cambridgegreys.com> wrote:
> >> [...]
> >>> 1. There is a proposed patch for the build system to fix it.
> >
> > So I just tried the patch you linked on the cover letter[1], and I am
> > still getting the build error described above:
> >
> > arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
> >   static int pcap_open(void *data)
> >              ^~~~~~~~~
> > In file included from /usr/include/pcap.h:43,
> >                   from arch/um/drivers/pcap_user.c:7:
> > /usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
> >   PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
> >
> > Looking at the patch, I wouldn't expect it to solve this problem.
> >
> > Are there maybe different conflicting libpcap-dev libraries and I have
> > the wrong one? Or is this just still broken?
> >
> >>> 2. We should be removing all old drivers and replacing them with the
> >>> vector ones.
> >>
> >> Hmm...does this mean you would entertain a patch removing all the
> >> non-vector UML network drivers? I would be happy to see VDE go as
> >> well.
> >>
> >> In any event, it sounds like I should probably drop this patch as it
> >> is currently.
> >>
> >> Thanks!
> >
> > [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938962#79
> >
> > _______________________________________________
> > linux-um mailing list
> > linux-um@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-um
> >
>
> OK, looks like the pcap.h differs now as well.
>
> I will fix that too. It looks like you need both a pcap fix and a
> library linking fix for this to work.
>
> The patch fixes the issue with the build system which no longer provides
> the means for UML to specify extra libraries (I probably had an older
> pcap version on the machine where I tested this).
>
> IMHO frankly it is no longer necessary.
>
> 5.5-rc1 vector raw now has the facility to add/remove (including at
> runtime) filters compiled with pcap outside UML. It was merged this week.
>
> We now have the following line-up for vector drivers - EoGRE, EoL2TPv3,
> RAW (+/- BPF), TAP and BESS. Speeds are 2.5 to 9Gbit on my machine
> (mid-range Ryzen desktop).
>
> If I figure out a way to get hold of the underlying tap raw sockets the
> same way vhost does, TAP can probably go to 12Gbit or thereabouts. Same
> applies to getting zerocopy working with raw.
>
> As a basis for comparison I get 18Gbit on the same machine using vEth
> and containers. 50% of that is actually a very decent number.
>
> While vector drivers are not 1:1 replacements for the existing drivers,
> you can achieve the same topologies and the same connectivity at much
> higher performance - the old drivers test out in the 500Mbit range on
> the same hardware.
>
> IMHO we should at least mark them as "obsolete" and start preparing to
> remove them.

Alright, I will send a patch out which marks the other network drivers
as "obsolete".

Clarification: Should I mark all UML network devices as "obsolete"
except for NET_VECTOR? Daemon and MCAST looked to me (I am not a
networking expert), like they might not be covered by vector.

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-09 23:40           ` Brendan Higgins
@ 2019-12-10  0:02             ` Richard Weinberger
  2019-12-10  7:14               ` Anton Ivanov
  2019-12-10  7:08             ` Anton Ivanov
  1 sibling, 1 reply; 15+ messages in thread
From: Richard Weinberger @ 2019-12-10  0:02 UTC (permalink / raw)
  To: Brendan Higgins
  Cc: anton ivanov, Johannes Berg, Jeff Dike, linux-um, linux-kernel, davidgow

----- Ursprüngliche Mail -----
> Von: "Brendan Higgins" <brendanhiggins@google.com>
>> IMHO we should at least mark them as "obsolete" and start preparing to
>> remove them.
> 
> Alright, I will send a patch out which marks the other network drivers
> as "obsolete".
> 
> Clarification: Should I mark all UML network devices as "obsolete"
> except for NET_VECTOR? Daemon and MCAST looked to me (I am not a
> networking expert), like they might not be covered by vector.

No. Why?

Thanks,
//richard

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-09 23:40           ` Brendan Higgins
  2019-12-10  0:02             ` Richard Weinberger
@ 2019-12-10  7:08             ` Anton Ivanov
  1 sibling, 0 replies; 15+ messages in thread
From: Anton Ivanov @ 2019-12-10  7:08 UTC (permalink / raw)
  To: Brendan Higgins
  Cc: johannes.berg, Richard Weinberger, Jeff Dike, linux-um,
	Linux Kernel Mailing List, David Gow

On 09/12/2019 23:40, Brendan Higgins wrote:
> On Sat, Dec 7, 2019 at 1:15 AM Anton Ivanov
> <anton.ivanov@cambridgegreys.com> wrote:
>> On 07/12/2019 01:21, Brendan Higgins wrote:
>>> On Fri, Dec 06, 2019 at 04:32:34PM -0800, Brendan Higgins wrote:
>>>> On Thu, Dec 5, 2019 at 11:23 PM Anton Ivanov
>>>> <anton.ivanov@cambridgegreys.com> wrote:
>>>> [...]
>>>>> 1. There is a proposed patch for the build system to fix it.
>>> So I just tried the patch you linked on the cover letter[1], and I am
>>> still getting the build error described above:
>>>
>>> arch/um/drivers/pcap_user.c:35:12: error: conflicting types for ‘pcap_open’
>>>    static int pcap_open(void *data)
>>>               ^~~~~~~~~
>>> In file included from /usr/include/pcap.h:43,
>>>                    from arch/um/drivers/pcap_user.c:7:
>>> /usr/include/pcap/pcap.h:859:18: note: previous declaration of ‘pcap_open’ was here
>>>    PCAP_API pcap_t *pcap_open(const char *source, int snaplen, int flags,
>>>
>>> Looking at the patch, I wouldn't expect it to solve this problem.
>>>
>>> Are there maybe different conflicting libpcap-dev libraries and I have
>>> the wrong one? Or is this just still broken?
>>>
>>>>> 2. We should be removing all old drivers and replacing them with the
>>>>> vector ones.
>>>> Hmm...does this mean you would entertain a patch removing all the
>>>> non-vector UML network drivers? I would be happy to see VDE go as
>>>> well.
>>>>
>>>> In any event, it sounds like I should probably drop this patch as it
>>>> is currently.
>>>>
>>>> Thanks!
>>> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=938962#79
>>>
>>> _______________________________________________
>>> linux-um mailing list
>>> linux-um@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-um
>>>
>> OK, looks like the pcap.h differs now as well.
>>
>> I will fix that too. It looks like you need both a pcap fix and a
>> library linking fix for this to work.
>>
>> The patch fixes the issue with the build system which no longer provides
>> the means for UML to specify extra libraries (I probably had an older
>> pcap version on the machine where I tested this).
>>
>> IMHO frankly it is no longer necessary.
>>
>> 5.5-rc1 vector raw now has the facility to add/remove (including at
>> runtime) filters compiled with pcap outside UML. It was merged this week.
>>
>> We now have the following line-up for vector drivers - EoGRE, EoL2TPv3,
>> RAW (+/- BPF), TAP and BESS. Speeds are 2.5 to 9Gbit on my machine
>> (mid-range Ryzen desktop).
>>
>> If I figure out a way to get hold of the underlying tap raw sockets the
>> same way vhost does, TAP can probably go to 12Gbit or thereabouts. Same
>> applies to getting zerocopy working with raw.
>>
>> As a basis for comparison I get 18Gbit on the same machine using vEth
>> and containers. 50% of that is actually a very decent number.
>>
>> While vector drivers are not 1:1 replacements for the existing drivers,
>> you can achieve the same topologies and the same connectivity at much
>> higher performance - the old drivers test out in the 500Mbit range on
>> the same hardware.
>>
>> IMHO we should at least mark them as "obsolete" and start preparing to
>> remove them.
> Alright, I will send a patch out which marks the other network drivers
> as "obsolete".
>
> Clarification: Should I mark all UML network devices as "obsolete"
> except for NET_VECTOR? Daemon and MCAST looked to me (I am not a
> networking expert), like they might not be covered by vector.
>
They are not 1:1 replacements unfortunately.

However, in order to fix daemon I have to rewrite the switch from 
uml-utilities too. It is beyond obsolete.

MCAST for 2 UML instances can be replaced by either GRE or L2TPv3, for 
more than 2 you are better off introducing a proper switch.

I am OK if all old drivers are marked as obsolete at this point, so 
please proceed with the patch.

Brgds,

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/


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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-10  0:02             ` Richard Weinberger
@ 2019-12-10  7:14               ` Anton Ivanov
  2019-12-10 22:40                 ` Brendan Higgins
  0 siblings, 1 reply; 15+ messages in thread
From: Anton Ivanov @ 2019-12-10  7:14 UTC (permalink / raw)
  To: Richard Weinberger, Brendan Higgins
  Cc: Johannes Berg, Jeff Dike, linux-um, linux-kernel, davidgow

On 10/12/2019 00:02, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
>> Von: "Brendan Higgins" <brendanhiggins@google.com>
>>> IMHO we should at least mark them as "obsolete" and start preparing to
>>> remove them.
>>
>> Alright, I will send a patch out which marks the other network drivers
>> as "obsolete".
>>
>> Clarification: Should I mark all UML network devices as "obsolete"
>> except for NET_VECTOR? Daemon and MCAST looked to me (I am not a
>> networking expert), like they might not be covered by vector.
> 
> No. Why?
> 
> Thanks,
> //richard
> 
> _______________________________________________
> linux-um mailing list
> linux-um@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-um
> 
At least pcap and vde are maintenance issues. They do not even build today.

Off the top of my head, daemon needs fixes to the switch - it has an 
O(n) performance hit for n="number of ports" as well as a few other issues.

Tap has a fully functional replacement

Pcap has a fully functional replacement

mcast for 2 instances is functionally equivalent to running l2tp or gre 
back-to-back.

IMHO we can start marking some of them as obsolete.

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

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

* Re: [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP
  2019-12-10  7:14               ` Anton Ivanov
@ 2019-12-10 22:40                 ` Brendan Higgins
  0 siblings, 0 replies; 15+ messages in thread
From: Brendan Higgins @ 2019-12-10 22:40 UTC (permalink / raw)
  To: Anton Ivanov
  Cc: Richard Weinberger, davidgow, Jeff Dike, linux-um, linux-kernel,
	Johannes Berg

On Mon, Dec 9, 2019 at 11:14 PM Anton Ivanov
<anton.ivanov@cambridgegreys.com> wrote:
>
> On 10/12/2019 00:02, Richard Weinberger wrote:
> > ----- Ursprüngliche Mail -----
> >> Von: "Brendan Higgins" <brendanhiggins@google.com>
> >>> IMHO we should at least mark them as "obsolete" and start preparing to
> >>> remove them.
> >>
> >> Alright, I will send a patch out which marks the other network drivers
> >> as "obsolete".
> >>
> >> Clarification: Should I mark all UML network devices as "obsolete"
> >> except for NET_VECTOR? Daemon and MCAST looked to me (I am not a
> >> networking expert), like they might not be covered by vector.
> >
> > No. Why?
> >
> > Thanks,
> > //richard
> >
> > _______________________________________________
> > linux-um mailing list
> > linux-um@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-um
> >
> At least pcap and vde are maintenance issues. They do not even build today.
>
> Off the top of my head, daemon needs fixes to the switch - it has an
> O(n) performance hit for n="number of ports" as well as a few other issues.
>
> Tap has a fully functional replacement
>
> Pcap has a fully functional replacement
>
> mcast for 2 instances is functionally equivalent to running l2tp or gre
> back-to-back.
>
> IMHO we can start marking some of them as obsolete.

It looked to me like this discussion is ongoing; however, it seemed
like the discussion might be boiling down to *which* drivers should be
marked obsolete, so I decided to go ahead and send a patch which marks
everything as deprecated. I figured it would make it easier to focus
the conversation on what, if anything, should be marked obsolete:

https://lore.kernel.org/lkml/20191210223403.244842-1-brendanhiggins@google.com/T/#u

Also, Anton, I flat out stole a bunch of your comments on this thread
to make my commit message. Just respond with the appropriate tags
(co-developed-by, etc) if you want to be credited for them. As it is,
I marked you as "suggested-by".

Cheers!

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

end of thread, other threads:[~2019-12-10 22:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06  2:01 [RFC v1 0/2] um: drop broken features to fix allyesconfig Brendan Higgins
2019-12-06  2:01 ` [RFC v1 1/2] um: drivers: remove support for UML_NET_PCAP Brendan Higgins
2019-12-06  7:23   ` Anton Ivanov
2019-12-07  0:32     ` Brendan Higgins
2019-12-07  1:21       ` Brendan Higgins
2019-12-07  9:14         ` Anton Ivanov
2019-12-09 23:40           ` Brendan Higgins
2019-12-10  0:02             ` Richard Weinberger
2019-12-10  7:14               ` Anton Ivanov
2019-12-10 22:40                 ` Brendan Higgins
2019-12-10  7:08             ` Anton Ivanov
2019-12-06  2:01 ` [RFC v1 2/2] uml: remove support for CONFIG_STATIC_LINK Brendan Higgins
2019-12-06  7:41   ` Anton Ivanov
2019-12-06 22:49     ` Brendan Higgins
2019-12-06  7:45 ` [RFC v1 0/2] um: drop broken features to fix allyesconfig Anton Ivanov

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.