2021-12-17 07:34:30

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the userns tree

Hi all,

After merging the userns tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

ERROR: modpost: ".do_exit" [drivers/vhost/vhost.ko] undefined!

Caused by commit

eb55e716ac1a ("exit: Stop exporting do_exit")

interacting with commit

bbf761db7dbb ("vhost: use user_worker to check RLIMITs")

from the vhost tree.

I have added the following merge fix patch.

From: Stephen Rothwell <[email protected]>
Date: Fri, 17 Dec 2021 18:24:30 +1100
Subject: [PATCH] fix up for "vhost: use user_worker to check RLIMITs"

Signed-off-by: Stephen Rothwell <[email protected]>
---
drivers/vhost/vhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 8cf259d798c0..b605a79533bb 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -374,7 +374,7 @@ static int vhost_worker(void *data)
}

complete(worker->exit_done);
- do_exit(0);
+ make_task_dead(0);
}

static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq)

This lead to:

ERROR: modpost: ".make_task_dead" [drivers/vhost/vhost.ko] undefined!

so I added the following as well.

From: Stephen Rothwell <[email protected]>
Date: Fri, 17 Dec 2021 18:30:09 +1100
Subject: [PATCH] fix 2 for "vhost: use user_worker to check RLIMITs"

Signed-off-by: Stephen Rothwell <[email protected]>
---
kernel/exit.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index 6c4b04531f17..dfa3e8f6ffeb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -890,6 +890,7 @@ void __noreturn make_task_dead(int signr)

do_exit(signr);
}
+EXPORT_SYMBOL_GPL(make_task_dead);

SYSCALL_DEFINE1(exit, int, error_code)
{

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (488.00 B)
OpenPGP digital signature

2021-12-17 16:54:00

by Eric W. Biederman

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the userns tree

Stephen Rothwell <[email protected]> writes:

> Hi all,
>
> After merging the userns tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> ERROR: modpost: ".do_exit" [drivers/vhost/vhost.ko] undefined!
>
> Caused by commit
>
> eb55e716ac1a ("exit: Stop exporting do_exit")
>
> interacting with commit
>
> bbf761db7dbb ("vhost: use user_worker to check RLIMITs")
>
> from the vhost tree.
>
> I have added the following merge fix patch.

Thanks.

I will dig in a little more but this is not the correct fix.

make_task_dead is for the guts of oops, when the process is borked.

I need to track down and see what is going on with the new
user_work_create/start thing.

This looks like we need a user_work_exit helper that does what these
new user work kernel threads need.

I will follow up because yikes! At first glance user_helpers look
like what kthreads were added to avoid. Getting userspace and kernel
space state confused.

Eric

> From: Stephen Rothwell <[email protected]>
> Date: Fri, 17 Dec 2021 18:24:30 +1100
> Subject: [PATCH] fix up for "vhost: use user_worker to check RLIMITs"
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> drivers/vhost/vhost.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 8cf259d798c0..b605a79533bb 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -374,7 +374,7 @@ static int vhost_worker(void *data)
> }
>
> complete(worker->exit_done);
> - do_exit(0);
> + make_task_dead(0);
> }
>
> static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq)
>
> This lead to:
>
> ERROR: modpost: ".make_task_dead" [drivers/vhost/vhost.ko] undefined!
>
> so I added the following as well.
>
> From: Stephen Rothwell <[email protected]>
> Date: Fri, 17 Dec 2021 18:30:09 +1100
> Subject: [PATCH] fix 2 for "vhost: use user_worker to check RLIMITs"
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> kernel/exit.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 6c4b04531f17..dfa3e8f6ffeb 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -890,6 +890,7 @@ void __noreturn make_task_dead(int signr)
>
> do_exit(signr);
> }
> +EXPORT_SYMBOL_GPL(make_task_dead);
>
> SYSCALL_DEFINE1(exit, int, error_code)
> {

2022-03-17 05:11:54

by Eric W. Biederman

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the userns tree

Stephen Rothwell <[email protected]> writes:

> Hi all,
>
> After merging the userns tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> kernel/sched/fair.c: In function 'init_numa_balancing':
> kernel/sched/fair.c:2884:9: error: implicit declaration of function 'init_task_work'; did you mean 'init_irq_work'? [-Werror=implicit-function-declaration]
> 2884 | init_task_work(&p->numa_work, task_numa_work);
> | ^~~~~~~~~~~~~~
> | init_irq_work
> kernel/sched/fair.c: In function 'task_tick_numa':
> kernel/sched/fair.c:2935:25: error: implicit declaration of function 'task_work_add' [-Werror=implicit-function-declaration]
> 2935 | task_work_add(curr, work, TWA_RESUME);
> | ^~~~~~~~~~~~~
> kernel/sched/fair.c:2935:51: error: 'TWA_RESUME' undeclared (first use in this function)
> 2935 | task_work_add(curr, work, TWA_RESUME);
> | ^~~~~~~~~~
>
> Maybe caused by commit
>
> 03248addadf1 ("resume_user_mode: Move to resume_user_mode.h")
> or
> 8ca07e17c9dd ("task_work: Remove unnecessary include from posix_timers.h")

Yes. That has the potential to have hidden a bug like this.

> interacting with (maybe) commit
>
> c4ad6fcb67c4 ("sched/headers: Reorganize, clean up and optimize kernel/sched/fair.c dependencies")
>
> from the tip tree.
>

It is commit 4ff8f2ca6ccd ("sched/headers: Reorganize, clean up and
optimize kernel/sched/sched.h dependencies") that ultimately removes the
include of task_work.h from "sched.h".

But yes ideally commit c4ad6fcb67c4 ("sched/headers: Reorganize, clean
up and optimize kernel/sched/fair.c dependencies") would have added an
include of task_work.h into kernel/sched/fair.c

Ingo any chance you can fix this in your tree? kernel/sched/fair.c
needs to include <linux/task_work.h> regardless. So I don't think this
is a bad thing.

Eric


> I have applied this merge fix patch.
>
> From: Stephen Rothwell <[email protected]>
> Date: Wed, 16 Mar 2022 16:41:42 +1100
> Subject: [PATCH] fixup for moving of linux/task_work.h
>
> Signed-off-by: Stephen Rothwell <[email protected]>
> ---
> kernel/sched/fair.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 89d21fda106c..7a6678fdffb0 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -31,6 +31,7 @@
> #include <linux/lockdep_api.h>
> #include <linux/softirq.h>
> #include <linux/refcount_api.h>
> +#include <linux/task_work.h>
> #include <linux/topology.h>
> #include <linux/sched/clock.h>
> #include <linux/sched/cond_resched.h>
> --
>
> 2.34.1