Commit 6cff79f4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'uml-for-linus-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

Pull UML updates from Richard Weinberger:

 - Clang coverage support

 - Many cleanups from Benjamin Berg

 - Various minor fixes

* tag 'uml-for-linus-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
  um: Mark 32bit syscall helpers as clobbering memory
  um: Remove unused register save/restore functions
  um: Rely on PTRACE_SETREGSET to set FS/GS base registers
  Documentation: kunit: Add clang UML coverage example
  arch: um: Add Clang coverage support
  um: time-travel: fix time corruption
  um: net: Fix return type of uml_net_start_xmit()
  um: Always inline stub functions
  um: Do not use printk in userspace trampoline
  um: Reap winch thread if it fails
  um: Do not use printk in SIGWINCH helper thread
  um: Don't use vfprintf() for os_info()
  um: Make errors to stop ptraced child fatal during startup
  um: Drop NULL check from start_userspace
  um: Drop support for hosts without SYSEMU_SINGLESTEP support
  um: document arch_futex_atomic_op_inuser
  um: mmu: remove stub_pages
  um: Fix naming clash between UML and scheduler
  um: virt-pci: fix platform map offset
parents 0c6bc372 83aec96c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -139,6 +139,17 @@ If your installed version of gcc doesn't work, you can tweak the steps:
	$ ./tools/testing/kunit/kunit.py run --make_options=CC=/usr/bin/gcc-6
	$ lcov -t "my_kunit_tests" -o coverage.info -c -d .kunit/ --gcov-tool=/usr/bin/gcov-6

Alternatively, LLVM-based toolchains can also be used:

.. code-block:: bash

	# Build with LLVM and append coverage options to the current config
	$ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --kunitconfig=.kunit/ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config
	$ llvm-profdata merge -sparse default.profraw -o default.profdata
	$ llvm-cov export --format=lcov .kunit/vmlinux -instr-profile default.profdata > coverage.info
	# The coverage.info file is in lcov-compatible format and it can be used to e.g. generate HTML report
	$ genhtml -o /tmp/coverage_html coverage.info


Running tests manually
======================
+5 −0
Original line number Diff line number Diff line
@@ -4,7 +4,12 @@
#

GPROF_OPT += -pg

ifdef CONFIG_CC_IS_CLANG
GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
else
GCOV_OPT += -fprofile-arcs -ftest-coverage
endif

CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT)
CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT)
+24 −18
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ struct winch_data {
	int pipe_fd;
};

static int winch_thread(void *arg)
static __noreturn int winch_thread(void *arg)
{
	struct winch_data *data = arg;
	sigset_t sigs;
@@ -153,8 +153,8 @@ static int winch_thread(void *arg)
	pipe_fd = data->pipe_fd;
	count = write(pipe_fd, &c, sizeof(c));
	if (count != sizeof(c))
		printk(UM_KERN_ERR "winch_thread : failed to write "
		       "synchronization byte, err = %d\n", -count);
		os_info("winch_thread : failed to write synchronization byte, err = %d\n",
			-count);

	/*
	 * We are not using SIG_IGN on purpose, so don't fix it as I thought to
@@ -166,29 +166,29 @@ static int winch_thread(void *arg)
	sigfillset(&sigs);
	/* Block all signals possible. */
	if (sigprocmask(SIG_SETMASK, &sigs, NULL) < 0) {
		printk(UM_KERN_ERR "winch_thread : sigprocmask failed, "
		       "errno = %d\n", errno);
		exit(1);
		os_info("winch_thread : sigprocmask failed, errno = %d\n",
			errno);
		goto wait_kill;
	}
	/* In sigsuspend(), block anything else than SIGWINCH. */
	sigdelset(&sigs, SIGWINCH);

	if (setsid() < 0) {
		printk(UM_KERN_ERR "winch_thread : setsid failed, errno = %d\n",
		os_info("winch_thread : setsid failed, errno = %d\n",
		       errno);
		exit(1);
		goto wait_kill;
	}

	if (ioctl(pty_fd, TIOCSCTTY, 0) < 0) {
		printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
		os_info("winch_thread : TIOCSCTTY failed on "
			"fd %d err = %d\n", pty_fd, errno);
		exit(1);
		goto wait_kill;
	}

	if (tcsetpgrp(pty_fd, os_getpid()) < 0) {
		printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
		       "fd %d err = %d\n", pty_fd, errno);
		exit(1);
		os_info("winch_thread : tcsetpgrp failed on fd %d err = %d\n",
			pty_fd, errno);
		goto wait_kill;
	}

	/*
@@ -199,8 +199,8 @@ static int winch_thread(void *arg)
	 */
	count = read(pipe_fd, &c, sizeof(c));
	if (count != sizeof(c))
		printk(UM_KERN_ERR "winch_thread : failed to read "
		       "synchronization byte, err = %d\n", errno);
		os_info("winch_thread : failed to read synchronization byte, err = %d\n",
			errno);

	while(1) {
		/*
@@ -211,9 +211,15 @@ static int winch_thread(void *arg)

		count = write(pipe_fd, &c, sizeof(c));
		if (count != sizeof(c))
			printk(UM_KERN_ERR "winch_thread : write failed, "
			       "err = %d\n", errno);
			os_info("winch_thread : write failed, err = %d\n",
				errno);
	}

wait_kill:
	c = 2;
	count = write(pipe_fd, &c, sizeof(c));
	while (1)
		pause();
}

static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
+8 −5
Original line number Diff line number Diff line
@@ -629,15 +629,18 @@ static irqreturn_t winch_interrupt(int irq, void *data)

	if (fd != -1) {
		err = generic_read(fd, &c, NULL);
		if (err < 0) {
		/* A read of 2 means the winch thread failed and has warned */
		if (err < 0 || (err == 1 && c == 2)) {
			if (err != -EAGAIN) {
				winch->fd = -1;
				list_del(&winch->list);
				os_close_file(fd);
				printk(KERN_ERR "winch_interrupt : "
				       "read failed, errno = %d\n", -err);
				printk(KERN_ERR "fd %d is losing SIGWINCH "
				       "support\n", winch->tty_fd);
				if (err < 0) {
					printk(KERN_ERR "winch_interrupt : read failed, errno = %d\n",
					       -err);
					printk(KERN_ERR "fd %d is losing SIGWINCH support\n",
					       winch->tty_fd);
				}
				INIT_WORK(&winch->work, __free_winch);
				schedule_work(&winch->work);
				return IRQ_HANDLED;
+1 −1
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ static int uml_net_close(struct net_device *dev)
	return 0;
}

static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
static netdev_tx_t uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct uml_net_private *lp = netdev_priv(dev);
	unsigned long flags;
Loading