Bug 19990 - on rawhide, the get_user_pages() function has changed
Summary: on rawhide, the get_user_pages() function has changed
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-25 14:42 UTC by David Smith
Modified: 2016-04-25 15:05 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2016-04-25 14:42:26 UTC
On rawhide (4.6.0-0.rc4.git3.1.fc25.x86_64), I'm getting the following compile error:

====
stap nd_sys.stp -c ./preadv
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h:35:29: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion]
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
                             ^~~
In file included from include/linux/pid_namespace.h:6:0,
                 from include/linux/ptrace.h:8,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
include/linux/mm.h:1253:6: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h:35:34: error: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion]
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
                                  ^~
In file included from include/linux/pid_namespace.h:6:0,
                 from include/linux/ptrace.h:8,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
include/linux/mm.h:1253:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h:35:47: error: passing argument 5 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion]
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
                                               ^~~~~
In file included from include/linux/pid_namespace.h:6:0,
                 from include/linux/ptrace.h:8,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
include/linux/mm.h:1253:6: note: expected ‘struct page **’ but argument is of type ‘int’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h:35:54: error: passing argument 6 of ‘get_user_pages’ makes pointer from integer without a cast [-Werror=int-conversion]
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
                                                      ^
In file included from include/linux/pid_namespace.h:6:0,
                 from include/linux/ptrace.h:8,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
include/linux/mm.h:1253:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘int’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
/usr/local/share/systemtap/runtime/linux/access_process_vm.h:35:13: error: too many arguments to function ‘get_user_pages’
       ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
             ^~~~~~~~~~~~~~
In file included from include/linux/pid_namespace.h:6:0,
                 from include/linux/ptrace.h:8,
                 from include/linux/ftrace.h:13,
                 from include/linux/kprobes.h:42,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/local/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.c:25:
include/linux/mm.h:1253:6: note: declared here
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^~~~~~~~~~~~~~

cc1: all warnings being treated as errors
scripts/Makefile.build:291: recipe for target '/tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.o' failed
make[1]: *** [/tmp/stap1vHU9T/stap_0b3271e6957c26e6ec5ff4ce3462c458_1435718_src.o] Error 1
Makefile:1431: recipe for target '_module_/tmp/stap1vHU9T' failed
make: *** [_module_/tmp/stap1vHU9T] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  [man error::pass4]
====

I believe this was caused by the following kernel commits:

====
commit a1f983174dd7e535e50ca850fcfb3b8d38149f39
Merge: 63a1281 c12d2da
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Thu Apr 14 19:31:34 2016 -0700

    Merge branch 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
    
    Pull mm gup cleanup from Ingo Molnar:
     "This removes the ugly get-user-pages API hack, now that all upstream
      code has been migrated to it"
    
    ("ugly" is putting it mildly. But it worked.. - Linus)
    
    * 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
      mm/gup: Remove the macro overload API migration helpers from the get_user*() APIs

commit c12d2da56d0e07d230968ee2305aaa86b93a6832
Author: Ingo Molnar <mingo@kernel.org>
Date:   Mon Apr 4 10:24:58 2016 +0200

    mm/gup: Remove the macro overload API migration helpers from the get_user*() APIs
    
    The pkeys changes brought about a truly hideous set of macros in:
    
      cde70140fed8 ("mm/gup: Overload get_user_pages() functions")
    
    ... which macros are (ab-)using the fact that __VA_ARGS__ can be used
    to shift parameter positions in macro arguments without breaking the
    build and so can be used to call separate C functions depending on
    the number of arguments of the macro.
    
    This allowed easy migration of these 3 GUP APIs, as both these variants
    worked at the C level:
    
      old:
        ret = get_user_pages(current, current->mm, address, 1, 1, 0, &page, NULL);
    
      new:
        ret = get_user_pages(address, 1, 1, 0, &page, NULL);
    
    ... while we also generated a (functionally harmless but noticeable) build
    time warning if the old API was used. As there are over 300 uses of these
    APIs, this trick eased the migration of the API and avoided excessive
    migration pain in linux-next.
    
    Now, with its work done, get rid of all of that complication and ugliness:
    
        3 files changed, 16 insertions(+), 140 deletions(-)
    
    ... where the linecount of the migration hack was further inflated by the
    fact that there are NOMMU variants of these GUP APIs as well.
    
    Much of the conversion was done in linux-next over the past couple of months,
    and Linus recently removed all remaining old API uses from the upstream tree
    in the following upstrea commit:
    
      cb107161df3c ("Convert straggling drivers to new six-argument get_user_pages()")
    
    There was one more old-API usage in mm/gup.c, in the CONFIG_HAVE_GENERIC_RCU_GUP
    code path that ARM, ARM64 and PowerPC uses.
    
    After this commit any old API usage will break the build.
    
    [ Also fixed a PowerPC/HAVE_GENERIC_RCU_GUP warning reported by Stephen Rothwell. ]
====
Comment 1 David Smith 2016-04-25 15:05:01 UTC
Fixed in commit e7c42c3.