Bug 2243335

Summary: Systemtap compile error
Product: [Fedora] Fedora Reporter: Chung <cchung>
Component: systemtapAssignee: Frank Ch. Eigler <fche>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: amerey, fche, mcermak, mjw, scox, wcohen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemtap-5.0~pre16958465gca71442b-1.fc38 systemtap-5.0~pre16958465gca71442b-1.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-20 00:41:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chung 2023-10-11 18:59:44 UTC
stap fails to compile simple stp file.

Reproducible: Always

Steps to Reproduce:
1.Create the following stp file

cat > simple-test.stp 
# Script to test basic System Tap functionality.

global tickCounter = 0;
global vmallocCounter = 0;

function sayHello()
%{
    printk("systemtap script says hello\n");
%}

probe begin
{
    sayHello();
    printf("hello\n");
}

probe timer.ms(100)
{
    tickCounter++;
}

function sayGoodbye()
%{
    printk("systemtap script says goodbye\n");
%}

// Force use of some basic debug info.
probe kernel.function("vmalloc")
{
    vmallocCounter++;
}

probe end
{
    sayGoodbye();
    printf("counter = %d\nvmalloc = %d\nbye!\n", tickCounter, vmallocCounter);
}

2. stap -v -F -g --disable-cache ./simple-test.stp 

3.  
#  stap -v -F -g --disable-cache ./simple-test.stp 
Pass 1: parsed user script and 486 library scripts using 136468virt/107716res/15616shr/91400data kb, in 160usr/50sys/444real ms.
Pass 2: analyzed script: 4 probes, 2 functions, 0 embeds, 2 globals using 301204virt/203272res/20968shr/190432data kb, in 4390usr/610sys/51571real ms.
Pass 3: translated to C into "/tmp/stap07SM83/stap_1345_src.c" using 301220virt/203444res/21140shr/190448data kb, in 100usr/70sys/177real ms.
In file included from /usr/share/systemtap/runtime/linux/runtime.h:266,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stap07SM83/stap_1345_src.c:21:
/usr/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’:
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:36: error: passing argument 1 of ‘get_user_pages_remote’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                    ^~~
      |                                    |
      |                                    struct task_struct *
In file included from ./include/linux/kallsyms.h:13,
                 from ./include/linux/ftrace.h:13,
                 from ./include/linux/kprobes.h:28,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21:
./include/linux/mm.h:2397:46: note: expected ‘struct mm_struct *’ but argument is of type ‘struct task_struct *’
 2397 | long get_user_pages_remote(struct mm_struct *mm,
      |                            ~~~~~~~~~~~~~~~~~~^~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:41: error: passing argument 2 of ‘get_user_pages_remote’ makes integer from pointer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                         ^~
      |                                         |
      |                                         struct mm_struct *
./include/linux/mm.h:2398:42: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
 2398 |                            unsigned long start, unsigned long nr_pages,
      |                            ~~~~~~~~~~~~~~^~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:54: error: passing argument 5 of ‘get_user_pages_remote’ makes pointer from integer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                                      ^~~~~
      |                                                      |
      |                                                      int
./include/linux/mm.h:2399:66: note: expected ‘struct page **’ but argument is of type ‘int’
 2399 |                            unsigned int gup_flags, struct page **pages,
      |                                                    ~~~~~~~~~~~~~~^~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:61: error: passing argument 6 of ‘get_user_pages_remote’ makes pointer from integer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                                             ^
      |                                                             |
      |                                                             int
./include/linux/mm.h:2400:33: note: expected ‘int *’ but argument is of type ‘int’
 2400 |                            int *locked);
      |                            ~~~~~^~~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:13: error: too many arguments to function ‘get_user_pages_remote’
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |             ^~~~~~~~~~~~~~~~~~~~~
./include/linux/mm.h:2397:6: note: declared here
 2397 | long get_user_pages_remote(struct mm_struct *mm,
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:243: /tmp/stap07SM83/stap_1345_src.o] Error 1
make: *** [Makefile:2046: /tmp/stap07SM83] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_1345.ko" in 19290usr/2530sys/22658real ms.
Pass 4: compilation failed.  [man error::pass4]
[root@vm-10-0-185-68 ~]# cat simple-test.stp 
# Script to test basic System Tap functionality.


Actual Results:  

#  stap -v -F -g --disable-cache ./simple-test.stp 
Pass 1: parsed user script and 486 library scripts using 136468virt/107716res/15616shr/91400data kb, in 160usr/50sys/444real ms.
Pass 2: analyzed script: 4 probes, 2 functions, 0 embeds, 2 globals using 301204virt/203272res/20968shr/190432data kb, in 4390usr/610sys/51571real ms.
Pass 3: translated to C into "/tmp/stap07SM83/stap_1345_src.c" using 301220virt/203444res/21140shr/190448data kb, in 100usr/70sys/177real ms.
In file included from /usr/share/systemtap/runtime/linux/runtime.h:266,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stap07SM83/stap_1345_src.c:21:
/usr/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’:
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:36: error: passing argument 1 of ‘get_user_pages_remote’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                    ^~~
      |                                    |
      |                                    struct task_struct *
In file included from ./include/linux/kallsyms.h:13,
                 from ./include/linux/ftrace.h:13,
                 from ./include/linux/kprobes.h:28,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21:
./include/linux/mm.h:2397:46: note: expected ‘struct mm_struct *’ but argument is of type ‘struct task_struct *’
 2397 | long get_user_pages_remote(struct mm_struct *mm,
      |                            ~~~~~~~~~~~~~~~~~~^~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:41: error: passing argument 2 of ‘get_user_pages_remote’ makes integer from pointer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                         ^~
      |                                         |
      |                                         struct mm_struct *
./include/linux/mm.h:2398:42: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
 2398 |                            unsigned long start, unsigned long nr_pages,
      |                            ~~~~~~~~~~~~~~^~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:54: error: passing argument 5 of ‘get_user_pages_remote’ makes pointer from integer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                                      ^~~~~
      |                                                      |
      |                                                      int
./include/linux/mm.h:2399:66: note: expected ‘struct page **’ but argument is of type ‘int’
 2399 |                            unsigned int gup_flags, struct page **pages,
      |                                                    ~~~~~~~~~~~~~~^~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:61: error: passing argument 6 of ‘get_user_pages_remote’ makes pointer from integer without a cast [-Werror=int-conversion]
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |                                                             ^
      |                                                             |
      |                                                             int
./include/linux/mm.h:2400:33: note: expected ‘int *’ but argument is of type ‘int’
 2400 |                            int *locked);
      |                            ~~~~~^~~~~~
/usr/share/systemtap/runtime/linux/access_process_vm.h:57:13: error: too many arguments to function ‘get_user_pages_remote’
   57 |       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
      |             ^~~~~~~~~~~~~~~~~~~~~
./include/linux/mm.h:2397:6: note: declared here
 2397 | long get_user_pages_remote(struct mm_struct *mm,
      |      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:243: /tmp/stap07SM83/stap_1345_src.o] Error 1
make: *** [Makefile:2046: /tmp/stap07SM83] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_1345.ko" in 19290usr/2530sys/22658real ms.
Pass 4: compilation failed.  [man error::pass4]
[root@vm-10-0-185-68 ~]# cat simple-test.stp 
# Script to test basic System Tap functionality.


Expected Results:  
No error


This happen with the latest Fedora release with 37 and 38, kernel version 3.5.5
I can reproduce it in 1minutetip system,

Comment 1 Frank Ch. Eigler 2023-10-11 19:06:12 UTC
In a few weeks, a new version of systemtap will include the kernel compatibility fixes - along with better diagnostics for this annoying case.  Until then, we'll put up a testing channel targeted rebuild of a snapshot that is known to work with 5.5 kernels.

Comment 2 Fedora Update System 2023-10-11 19:22:15 UTC
FEDORA-2023-763a14526d has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-763a14526d

Comment 3 Fedora Update System 2023-10-11 19:26:24 UTC
FEDORA-2023-a640ad0d27 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-a640ad0d27

Comment 4 Fedora Update System 2023-10-12 02:25:07 UTC
FEDORA-2023-763a14526d has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-763a14526d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-763a14526d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-10-12 03:00:21 UTC
FEDORA-2023-a640ad0d27 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a640ad0d27`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a640ad0d27

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2023-10-20 00:41:53 UTC
FEDORA-2023-a640ad0d27 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2023-11-03 18:35:46 UTC
FEDORA-2023-763a14526d has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.