lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180429161620.qrtjehd4qozixgfx@ast-mbp>
Date:   Sun, 29 Apr 2018 09:16:22 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     John Fastabend <john.fastabend@...il.com>
Cc:     daniel@...earbox.net, ast@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 2/4] bpf: sockmap, add hash map support

On Sat, Apr 28, 2018 at 08:41:28PM -0700, John Fastabend wrote:
> Sockmap is currently backed by an array and enforces keys to be
> four bytes. This works well for many use cases and was originally
> modeled after devmap which also uses four bytes keys. However,
> this has become limiting in larger use cases where a hash would
> be more appropriate. For example users may want to use the 5-tuple
> of the socket as the lookup key.
> 
> To support this add hash support.
> 
> Signed-off-by: John Fastabend <john.fastabend@...il.com>
...
>  enum bpf_prog_type {
> @@ -1835,7 +1836,10 @@ struct bpf_stack_build_id {
>  	FN(msg_pull_data),		\
>  	FN(bind),			\
>  	FN(xdp_adjust_tail),		\
> -	FN(skb_get_xfrm_state),
> +	FN(skb_get_xfrm_state),		\
> +	FN(sock_hash_update),		\
> +	FN(msg_redirect_hash),		\
> +	FN(sk_redirect_hash),

Documentation for new helpers is missing. Please add it in this commit.

Also running test_sockmap in the latest bpf-next I see:
[TEST 81]: (10, 1024, 256, sendpage, pass,apply,): [   14.227128] WARNING: CPU: 1 PID: 202 at ../net/core/stream.c:206 sk_stream_kill_queues+0x3ca/0x540
[   14.228209] Modules linked in:
[   14.228583] CPU: 1 PID: 202 Comm: test_sockmap Not tainted 4.17.0-rc2-00438-gfcf85729d8ef #941
[   14.229595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.el7.centos 04/01/2014
[   14.230649] RIP: 0010:sk_stream_kill_queues+0x3ca/0x540
[   14.231251] RSP: 0018:ffff880111717d00 EFLAGS: 00010202
[   14.231855] RAX: 0000000000000000 RBX: ffff8801127f8978 RCX: 1ffff100224ff138
[   14.232664] RDX: 0000000000000000 RSI: 0000000000000f01 RDI: ffff8801127f89c0
[   14.233521] RBP: ffff8801127f8948 R08: ffffed00224ff122 R09: ffffed00224ff121
[   14.234342] R10: ffff8801127f890b R11: ffffed00224ff122 R12: ffff8801127f8998
[   14.235169] R13: ffff8801127f88a8 R14: ffff8801127f8880 R15: ffff8801127f8930
[   14.235987] FS:  00007f3d46898700(0000) GS:ffff88011b080000(0000) knlGS:0000000000000000
[   14.236946] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   14.237607] CR2: 00007f3d45e3caf0 CR3: 0000000112da0001 CR4: 00000000000606e0
[   14.238433] Call Trace:
[   14.238741]  ? tcp_v4_destroy_sock+0x273/0x4d0
[   14.239259]  inet_csk_destroy_sock+0x157/0x390
[   14.239815]  tcp_close+0x683/0xf60
[   14.240214]  inet_release+0xd6/0x1b0
[   14.240636]  sock_release+0x7e/0x190
[   14.241090]  sock_close+0xe/0x20
[   14.241593]  __fput+0x22f/0x720
[   14.241981]  task_work_run+0x10b/0x190
[   14.242425]  exit_to_usermode_loop+0xd2/0xf0
[   14.242963]  do_syscall_64+0x1d5/0x270
[   14.243410]  ? page_fault+0x8/0x30
[   14.243830]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

and

[TEST 84]: (1, 1, 1, sendmsg, pass,cork,): [   14.317100] WARNING: CPU: 1 PID: 66 at ../net/ipv4/af_inet.c:156 inet_sock_destruct+0x570/0x7b0
[   14.318147] Modules linked in:
[   14.318522] CPU: 1 PID: 66 Comm: kworker/1:1 Tainted: G        W         4.17.0-rc2-00438-gfcf85729d8ef #941
[   14.319674] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.el7.centos 04/01/2014
[   14.320764] Workqueue: events smap_gc_work
[   14.321262] RIP: 0010:inet_sock_destruct+0x570/0x7b0
[   14.321829] RSP: 0018:ffff880118617d08 EFLAGS: 00010206
[   14.322415] RAX: 0000000000000ffc RBX: ffff8801127f9980 RCX: ffffffff82c7ac64
[   14.323221] RDX: 1ffff100224ff34f RSI: 0000000000000004 RDI: ffff8801127f9a78
[   14.324054] RBP: ffff8801127f9ac4 R08: ffffed00224ff359 R09: ffffed00224ff358
[   14.324860] R10: ffff8801127f9ac7 R11: ffffed00224ff359 R12: ffff880111107688
[   14.325661] R13: dffffc0000000000 R14: ffff880111107688 R15: dead000000000100
[   14.326503] FS:  0000000000000000(0000) GS:ffff88011b080000(0000) knlGS:0000000000000000
[   14.327413] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   14.328091] CR2: 00007f3d45e3caf0 CR3: 0000000003a0e004 CR4: 00000000000606e0
[   14.328936] Call Trace:
[   14.329225]  __sk_destruct+0x45/0x460
[   14.329646]  smap_gc_work+0x69f/0x950
[   14.330102]  process_one_work+0x7be/0x1230
[   14.330600]  worker_thread+0xd9/0x1080
[   14.331059]  ? rescuer_thread+0xd70/0xd70
[   14.331543]  kthread+0x29e/0x390
[   14.331945]  ? kthread_create_worker_on_cpu+0xb0/0xb0
[   14.332555]  ret_from_fork+0x1f/0x30

Please send a fix for this issue first.
I'd like to see test_sockmap being clean before adding hash support to sockmap.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ