[LTP] [PATCH v1] ioctl10.c: New case test PROCMAP_QUERY ioctl()

Wei Gao wegao@suse.com
Tue Jan 14 13:08:37 CET 2025


Test with 6.13.0-rc7-1.g9a3f661-vanilla kernel, the result is good.
susetest:~/ltp/testcases/kernel/syscalls/ioctl # ./ioctl10
tst_test.c:1900: TINFO: LTP version: 20240930-184-g21afd7d9b
tst_test.c:1904: TINFO: Tested kernel: 6.13.0-rc7-1.g9a3f661-vanilla #1 SMP
PREEMPT_DYNAMIC Mon Jan 13 11:16:27 UTC 2025 (9a3f661) x86_64
tst_kconfig.c:88: TINFO: Parsing kernel config '/proc/config.gz'
tst_kconfig.c:667: TINFO: CONFIG_LATENCYTOP kernel option detected which
might slow the execution
tst_test.c:1722: TINFO: Overall timeout per run is 0h 02m 00s
ioctl10.c:97: TPASS: parse_maps_file(path_buf, "*", &entry) passed
ioctl10.c:105: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
ioctl10.c:107: TPASS: q.query_addr == entry.vm_start (4194304)
ioctl10.c:108: TPASS: q.query_flags == 0 (0)
ioctl10.c:109: TPASS: q.vma_flags == entry.vm_flags (1)
ioctl10.c:110: TPASS: q.vma_start == entry.vm_start (4194304)
ioctl10.c:111: TPASS: q.vma_end == entry.vm_end (4210688)
ioctl10.c:112: TPASS: q.vma_page_size == getpagesize() (4096)
ioctl10.c:113: TPASS: q.vma_offset == entry.vm_pgoff (0)
ioctl10.c:114: TPASS: q.inode == entry.vm_inode (11443)
ioctl10.c:115: TPASS: q.dev_major == entry.vm_major (0)
ioctl10.c:116: TPASS: q.dev_minor == entry.vm_minor (35)
ioctl10.c:124: TPASS: ioctl(fd, PROCMAP_QUERY, &q) : ENOENT (2)
ioctl10.c:132: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
ioctl10.c:136: TPASS: parse_maps_file(path_buf, "*r-?p *", &entry) passed
ioctl10.c:142: TPASS: ioctl(fd, PROCMAP_QUERY, &q) : ENOENT (2)
ioctl10.c:152: TPASS: parse_maps_file(path_buf, pattern, &entry) passed
ioctl10.c:161: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
ioctl10.c:162: TPASS: q.vma_name_size == strlen(process_name) + 1 (50)
ioctl10.c:163: TPASS: (char *)q.vma_name_addr == process_name
(/root/ltp/testcases/kernel/syscalls/ioctl/ioctl10)

Summary:
passed   20
failed   0
broken   0
skipped  0
warnings 0

On Mon, Jan 13, 2025 at 1:57 PM Wei Gao <wegao@suse.com> wrote:

> On Mon, Jan 13, 2025 at 12:52:31AM -0500, Wei Gao wrote:
> > Signed-off-by: Wei Gao <wegao@suse.com>
> > ---
> >  configure.ac                               |   1 +
> >  runtest/syscalls                           |   1 +
> >  testcases/kernel/syscalls/ioctl/.gitignore |   1 +
> >  testcases/kernel/syscalls/ioctl/ioctl10.c  | 175 +++++++++++++++++++++
> >  4 files changed, 178 insertions(+)
> >  create mode 100644 testcases/kernel/syscalls/ioctl/ioctl10.c
>
> The test report error when i check tw in my env(wrong dev_minor number). I
> guess is kernel issue?
>
> susetest:~/ltp # uname -r
> 6.12.8-2-default
> susetest:~/ltp # cat /etc/os-release
> NAME="openSUSE Tumbleweed"
> # VERSION="20250109"
> ID="opensuse-tumbleweed"
> ID_LIKE="opensuse suse"
> VERSION_ID="20250109"
> PRETTY_NAME="openSUSE Tumbleweed"
> ANSI_COLOR="0;32"
> # CPE 2.3 format, boo#1217921
> CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20250109:*:*:*:*:*:*:*"
> #CPE 2.2 format
> #CPE_NAME="cpe:/o:opensuse:tumbleweed:20250109"
> BUG_REPORT_URL="https://bugzilla.opensuse.org"
> SUPPORT_URL="https://bugs.opensuse.org"
> HOME_URL="https://www.opensuse.org"
> DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
> LOGO="distributor-logo-Tumbleweed"
>
> tst_test.c:1893: TINFO: LTP version: 20240524-413-g96a255983
> tst_test.c:1897: TINFO: Tested kernel: 6.12.8-2-default #1 SMP
> PREEMPT_DYNAMIC Mon Jan  6 06:45:37 UTC 2025 (90b0f5b) x86_64
> tst_test.c:1730: TINFO: Timeout per run is 0h 00m 30s
> line=00400000-00431000 r-xp 00000000 00:30 14632
>     /root/ioctl09
>
> ioctl09.c:100: TPASS: parse_maps_file(path_buf, "*", &entry) passed
> ID of containing device:  [0,15]
> ioctl09.c:120: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
> ioctl09.c:122: TPASS: q.query_addr == entry.vm_start (4194304)
> ioctl09.c:123: TPASS: q.query_flags == 0 (0)
> ioctl09.c:124: TPASS: q.vma_flags == entry.vm_flags (5)
> ioctl09.c:125: TPASS: q.vma_start == entry.vm_start (4194304)
> ioctl09.c:126: TPASS: q.vma_end == entry.vm_end (4395008)
> ioctl09.c:127: TPASS: q.vma_page_size == getpagesize() (4096)
> ioctl09.c:128: TPASS: q.vma_offset == entry.vm_pgoff (0)
> ioctl09.c:129: TPASS: q.inode == entry.vm_inode (14632)
> ioctl09.c:130: TPASS: q.dev_major == entry.vm_major (0)
> ioctl09.c:131: TFAIL: q.dev_minor (35) != entry.vm_minor (48)
> <<<<<<<<<<<<<<<<<<<<<<<<
> ioctl09.c:139: TPASS: ioctl(fd, PROCMAP_QUERY, &q) : ENOENT (2)
> ioctl09.c:147: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
> line=00400000-00431000 r-xp 00000000 00:30 14632
>     /root/ioctl09
>
> ioctl09.c:151: TPASS: parse_maps_file("/proc/self/maps", "*r-?p *",
> &entry) passed
> ioctl09.c:157: TPASS: ioctl(fd, PROCMAP_QUERY, &q) : ENOENT (2)
> line=00400000-00431000 r-xp 00000000 00:30 14632
>     /root/ioctl09
>
> ioctl09.c:166: TPASS: parse_maps_file("/proc/self/maps", pattern, &entry)
> passed
> ioctl09.c:175: TPASS: ioctl(fd, PROCMAP_QUERY, &q) passed
> ioctl09.c:176: TPASS: q.vma_name_size == strlen(process_name) + 1 (14)
> ioctl09.c:177: TPASS: (char *)q.vma_name_addr == process_name
> (/root/ioctl09)
>
> stat /root/ioctl09
>   File: /root/ioctl09
>   Size: 873728          Blocks: 1712       IO Block: 4096   regular file
> Device: 0,48  <<<<<<  Inode: 14632       Links: 1
> Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
> Access: 2025-01-12 22:29:01.378310333 -0500
> Modify: 2025-01-12 22:28:58.043307554 -0500
> Change: 2025-01-12 22:28:58.043307554 -0500
>  Birth: 2025-01-12 21:37:52.621841127 -0500
>
>


More information about the ltp mailing list