Re: [uml-devel] How to properly load debug symbols for module and set breakpoint

2016-07-11 Thread Richard Weinberger
On Wed, Jul 6, 2016 at 1:31 PM, Mark Kica  wrote:
> I have build custom 64bit UML Linux kernel with TUN/TAP kernel module
> (tun.ko) and then I have installed it on small root filesystem with busybox
> . These module and kernel seems to work and I would like to make simple
> changes in TUN module and measure it's performance .
>
> So I have tried to follow guide from
> http://user-mode-linux.sourceforge.net/hacking.html which explains how to
> attach gdb to UML and set breakpoint for module init function .
>
> (gdb) p modules
> $1 = {next = 0x6385cf38, prev = 0x6385cf38}
>
> (gdb) p *((struct module *)0x6385cf30)
> $2 = {state = MODULE_STATE_LIVE, list = {next = 0x6036aee0, prev =
> 0x6036aee0}, name = "tun", '\000' , mkobj = {kobj = {name
> = 0x62e95b00 "tun", entry = {next = 0x62c30440, prev = 0x62c30148}, parent =
> 0x62c30450,
> kset = 0x62c30440, ktype = 0x603694d0, sd = 0x62dd6fa0, kref = {refcount =
> {counter = 3}}, state_initialized = 1, state_in_sysfs = 1,
> state_add_uevent_sent = 1, state_remove_uevent_sent = 0, uevent_suppress =
> 0},
> mod = 0x6385cf30, drivers_dir = 0x0, mp = 0x0}, modinfo_attrs = 0x62ea0400,
> version = 0x0, srcversion = 0x0, holders_dir = 0x62da7400, syms = 0x0, crcs
> = 0x0, num_syms = 0, kp = 0x0, num_kp = 0, num_gpl_syms = 1,
> gpl_syms = 0x6385c260, gpl_crcs = 0x0, gpl_future_syms = 0x0,
> gpl_future_crcs = 0x0, num_gpl_future_syms = 0, num_exentries = 0, extable =
> 0x0, init = 0x6386, module_init = 0x0, module_core = 0x6385a000,
> init_size = 0,
> core_size = 13990, init_text_size = 0, core_text_size = 8244, init_ro_size =
> 127, core_ro_size = 11432, arch = {}, taints = 0, num_bugs =
> 0, bug_list = {next = 0x60376a40, prev = 0x60376a40}, bug_table = 0x0,
> symtab = 0x6385d120, core_symtab = 0x6385d120, num_symtab = 37,
> core_num_syms = 37, strtab = 0x6385d498 "", core_strtab = 0x6385d498 "",
> sect_attrs = 0x62c52000, notes_attrs = 0x62e98240, args = 0x62e95b20 " ",
> source_list = {
> next = 0x6385d0e0, prev = 0x6385d0e0}, target_list = {next = 0x6385d0f0,
> prev = 0x6385d0f0}, waiter = 0x62ea10c0, exit = 0x6385a101, refptr =
> 0x62176ca0}
>
> (gdb) add-symbol-file
> /home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko 0x6385a000
> add symbol table from file
> "/home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko" at
> .text_addr = 0x6385a000
> (y or n)
> Please answer y or n.
> (y or n) y
> Reading symbols from
> /home/mark/playground/linux-2.6.39.3/drivers/net/tun.ko...done.

Try extracting the addresses from /sys/module/tun/sections/

> (gdb) p tun_init
> $3 = {int (void)} 0x24 
>
>
> (gdb) break tun_init
> Cannot access memory at address 0x24
>
>
>
> I don't understand why tun_init is located at 0x24 and not at 0x6385a000 ?
> Can somebody point what I am doing wrong and how to load debug symbols and
> set breakpoint ?
>
>
> --
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> ___
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
>



-- 
Thanks,
//richard

--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH v1 0/3] Fix seccomp for UM (next)

2016-07-11 Thread Kees Cook
On Mon, Jul 11, 2016 at 5:56 PM, Mickaël Salaün  wrote:
> Hi,
>
> This series fix the recent seccomp update for the User-mode Linux architecture
> (32-bit and 64-bit) since commit 26703c636c1f3272b39bd0f6d04d2e970984f1b6
> (close the hole where ptrace can change a syscall out from under seccomp).
>
> Regards,
>
> Mickaël Salaün (3):
>   um/ptrace: Fix the syscall_trace_leave call
>   um/ptrace: Fix the syscall number update after a ptrace
>   seccomp: Remove 2-phase API documentation
>
>  arch/Kconfig  | 11 ---
>  arch/um/kernel/skas/syscall.c | 10 +++---
>  arch/x86/um/ptrace_32.c   |  3 +++
>  arch/x86/um/ptrace_64.c   |  4 
>  4 files changed, 10 insertions(+), 18 deletions(-)

Ah, perfect! Thanks for fixing this! James, can you pick this up for -next?

Acked-by: Kees Cook 

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel