Re: mmotm 2021-08-02-18-51 uploaded (struct user_struct when CONFIG_EPOLL is not set)

From: Randy Dunlap
Date: Tue Aug 03 2021 - 01:50:04 EST


On 8/2/21 10:41 PM, Randy Dunlap wrote:
On 8/2/21 6:52 PM, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
The mm-of-the-moment snapshot 2021-08-02-18-51 has been uploaded to

    https://www.ozlabs.org/~akpm/mmotm/

mmotm-readme.txt says

README for mm-of-the-moment:

https://www.ozlabs.org/~akpm/mmotm/

This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
more than once a week.

You will need quilt to apply these patches to the latest Linus release (5.x
or 5.x-rcY).  The series file is in broken-out.tar.gz and is duplicated in
https://ozlabs.org/~akpm/mmotm/series

The file broken-out.tar.gz contains two datestamp files: .DATE and
.DATE-yyyy-mm-dd-hh-mm-ss.  Both contain the string yyyy-mm-dd-hh-mm-ss,
followed by the base kernel version against which this patch series is to
be applied.


I am seeing build errors on i386 or x86_64 when CONFIG_EPOLL is not set:

../kernel/user.c: In function ‘free_user’:
../kernel/user.c:141:30: error: ‘struct user_struct’ has no member named ‘epoll_watches’; did you mean ‘nr_watches’?
  percpu_counter_destroy(&up->epoll_watches);
                              ^~~~~~~~~~~~~
                              nr_watches
In file included from ../include/linux/sched/user.h:7:0,
                 from ../kernel/user.c:17:
../kernel/user.c: In function ‘alloc_uid’:
../kernel/user.c:189:33: error: ‘struct user_struct’ has no member named ‘epoll_watches’; did you mean ‘nr_watches’?
   if (percpu_counter_init(&new->epoll_watches, 0, GFP_KERNEL)) {
                                 ^
../include/linux/percpu_counter.h:38:25: note: in definition of macro ‘percpu_counter_init’
   __percpu_counter_init(fbc, value, gfp, &__key);  \
                         ^~~
../kernel/user.c:203:33: error: ‘struct user_struct’ has no member named ‘epoll_watches’; did you mean ‘nr_watches’?
    percpu_counter_destroy(&new->epoll_watches);
                                 ^~~~~~~~~~~~~
                                 nr_watches
In file included from ../include/linux/sched/user.h:7:0,
                 from ../kernel/user.c:17:
../kernel/user.c: In function ‘uid_cache_init’:
../kernel/user.c:225:37: error: ‘struct user_struct’ has no member named ‘epoll_watches’; did you mean ‘nr_watches’?
  if (percpu_counter_init(&root_user.epoll_watches, 0, GFP_KERNEL))
                                     ^
../include/linux/percpu_counter.h:38:25: note: in definition of macro ‘percpu_counter_init’
   __percpu_counter_init(fbc, value, gfp, &__key);  \
                         ^~~



Also do this change in kernel/user.c please:

if (percpu_counter_init(&root_user.epoll_watches, 0, GFP_KERNEL))
- panic("percpu cpunter alloc failed");
+ panic("percpu counter alloc failed");


--
~Randy
Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
https://people.kernel.org/tglx/notes-about-netiquette