Re: ioctl get_info: Bad address
Brought to you by:
aeb,
bencollins
From: Stefan R. <st...@s5...> - 2011-08-10 14:34:57
|
On Aug 10 Clemens Ladisch wrote: > Stefan Richter wrote: > > size before size after delta > > --------------------------------------------------------------- > > core-cdev.s 342946 352407 +9461 > > core-cdev.o 126544 130600 +4056 > > Is this with debug information? Yes it is; not sure why I didn't go on to test without it yesterday. > Because I cannot see how this many > bytes could be actual code, even with inlining (is_compat_task()'s > current_thread_info() call should end up as one pointer read). > > So I'd guess the actual cost (.code section) is not nearly that high. FWIW, this is from one of the six u64_to_uptr call sites, ioctl_get_info(): ==== before: .LBB942: .loc 1 439 0 movq 8(%rbx), %rax # <variable>.device, temp.1345 mov 4(%r12), %edx # <variable>.get_info.rom_length, <variable>.get_info.rom_length movq 752(%rax), %r15 # <variable>.config_rom_length, <variable>.config_rom_length movq 744(%rax), %r13 # <variable>.config_rom, D.30770 salq $2, %r15 #, tmp77 cmpq %rdx, %r15 # <variable>.get_info.rom_length, tmp77 cmova %rdx, %r15 # tmp77,, <variable>.get_info.rom_length, tmp77 call might_fault # movq %r13, %rsi # D.30770, movl %r15d, %edx # tmp77, movq %r14, %rdi # D.30762, call _copy_to_user # ==== after: .LBB1062: .loc 1 457 0 movq 8(%rbx), %rcx # <variable>.device, temp.1345 mov 4(%r12), %r15d # <variable>.get_info.rom_length, D.30774 mov %eax, %r13d # D.30771, D.30771 movq 752(%rcx), %rdx # <variable>.config_rom_length, movq %rdx, -104(%rbp) #, %sfp movq 744(%rcx), %r14 # <variable>.config_rom, D.30779 movq %gs:kernel_stack,%rdx #, pfo_ret__ testb $2, -8132(%rdx) #, <variable>.status cmove %rax, %r13 # D.30771,, D.30771, D.33010 call might_fault # movq -104(%rbp), %rdx # %sfp, tmp84 movq %r13, %rdi # D.33010, movq %r14, %rsi # D.30779, salq $2, %rdx #, tmp84 cmpq %r15, %rdx # D.30774, tmp84 cmova %r15, %rdx # tmp84,, D.30774, tmp84 call _copy_to_user # ==== And this appear to be the two uptr_to_u64 call sites: ==== before: .L197: .loc 1 1055 0 movq (%rbx), %r14 # <variable>.queue_iso.packets, p mov 16(%rbx), %eax # <variable>.queue_iso.size, D.31346 movq %gs:kernel_stack,%rcx #, pfo_ret__ movq %r14, %rdx # p, roksum add %rax,%rdx ; sbb %rsi,%rsi ; cmp %rdx,-8120(%rcx) ; sbb $0,%rsi # D.31346, roksum,, <variable>.addr_limit.seg ==== after: .L197: .loc 1 1073 0 movq (%rbx), %rax # <variable>.queue_iso.packets, D.31353 movq %gs:kernel_stack,%rcx #, pfo_ret__ testb $2, -8132(%rcx) #, <variable>.status mov %eax, %r14d # D.31353, D.31353 cmove %rax, %r14 # D.31353,, D.31353, p mov 16(%rbx), %eax # <variable>.queue_iso.size, D.31355 movq %r14, %rdx # p, roksum add %rax,%rdx ; sbb %rsi,%rsi ; cmp %rdx,-8120(%rcx) ; sbb $0,%rsi # D.31355, roksum,, <variable>.addr_limit.seg ==== > > Is it worthwhile? > > Arch-independent code should not depend on knowledge of compat_ptr()'s > implementation details. If we don't use compat_ptr(), we don't depend on its details. ;-) -- Stefan Richter -=====-==-== =--- -=-=- http://arcgraph.de/sr/ |