S390-HWBKPT v5: S390 architecture specific
A message that is not in the archive (sent off-list or not yet received): 20100729003112.GA13088@nowhere
Quoted 26 lines · Frederic Weisbecker
Quoted 16 lines · Heiko Carstens
Quoted 16 lines
(quoted diff) +16
-0+/* + * Check for virtual address in kernel space. + */ +int arch_check_bp_in_kernelspace(struct perf_event *bp) +{ + unsigned long hbp_len; + unsigned long va; + + struct arch_hw_breakpoint *info = counter_arch_bp(bp); + + va = info->address; + hbp_len = info->len; + + if (kernel_text_address(va)) + return kernel_text_address(va + hbp_len - 1); +Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ return 0; +}How is this supposed to work on s390? By just passing an address it is impossible to tell if it is user space or kernel space. s390 has distinct address spaces for kernel/user space where in each space the accessible addresses are in the range from 0x-0xffff...... The same is true for other architectures (e.g. powerpc and sparc, if I remember correctly).
Quoted 3 lines
So it's something I was really not aware of. It basically means one address can have two different meanings, one in userspace and one in kernelspace?
Exactly.
Quoted 2 lines
Ok, I'm trying to understand how your
copy_from_user()works, but I gave up on the asm incopy_from_user_std():)
The (over-)simplified explanation how this works on s390:
we have two control registers. One points to the page table of the kernel address space the second one to the page table of the user address space. The user address space is _not_ part of the kernel address space. If the kernel wants to access user space addresses it has to use special priviledged instructions.
Quoted 4 lines
Then yeah, s390 breakpoints must always be either
exclude_kernelorexclude_userfor the necessary disambiguation.Having 0 on both must end in
-EINVAL.
Ok, that should work.
Thanks!