https://bugs.kde.org/show_bug.cgi?id=528451
Bug ID: 528451
Summary: mseal01 LTP testcase fails when run under Valgrind
Classification: Developer tools
Product: valgrind
Version First unspecified
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 198154
--> https://bugs.kde.org/attachment.cgi?id=198154&action=edit
LTP patch making debugging this under Valgrind easier bu avoiding forking.
When the mseal01 LTP testcase (LTP commit 07a90230855) is run natively, it
does pass. But running it under Valgrind (valgrind-3.29.0.GIT, upstream commit
fd2587eec) makes it fail:
...
mseal01.c:88: TFAIL: mremap(mem_addr, mem_size, new_size, MREMAP_MAYMOVE |
MREMAP_FIXED, new_addr) expected EPERM: ENOMEM (12)
...
The testcase allocates memory and seals portion of it using the mseal()
syscall. Then it tries to mremap() it. Natively (without Valgrind) such
attempt ends up with EPERM, but under Valgrind it ends up with ENOMEM, which
seems wrong. Here is how this is handled in the linux kernel in
mm/mremap.c:1780:
1780 static int check_prep_vma(struct vma_remap_struct *vrm)
1781 {
1782 struct vm_area_struct *vma = vrm->vma;
1783 struct mm_struct *mm = current->mm;
1784 unsigned long addr = vrm->addr;
1785 unsigned long old_len, new_len, pgoff;
1786
1787 if (!vma)
1788 return -EFAULT;
1789
1790 /* If mseal()'d, mremap() is prohibited. */
1791 if (vma_is_sealed(vma))
1792 return -EPERM;
I've confirmed this using systemtap:
# stap -d kernel -e 'probe kernel.function("check_prep_vma")
{println(execname()); print_backtrace_fileline()}'
Using a compile server.
Module signed with MOK, fingerprint "[ ... stuff deleted ... ]"
mseal01
0xffffffffa07d2da0 : check_prep_vma+0x0/0x330 [kernel]
0xffffffffa07d556c : do_mremap+0x2bc/0x3f0 [kernel]
0xffffffffa07d5767 : __do_sys_mremap+0xb7/0xe0 [kernel]
0xffffffffa17baa92 : do_syscall_64+0xe2/0x570 [kernel]
0xffffffffa000012f : entry_SYSCALL_64_after_hwframe+0x76/0x7e [kernel]
--
You are receiving this mail because:
You are watching all bug changes.