[PATCH net] netlink: not trim skb for mmaped socket when dump

2016-01-28 Thread Ken-ichirou MATSUZAWA
size to avoid MSG_TRUNC) Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 81dc1bb..f1ffb34 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink

Re: [PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-09-02 Thread Ken-ichirou MATSUZAWA
On Wed, Sep 02, 2015 at 05:56:36PM +0200, Daniel Borkmann wrote: > you suggest or not), for two reasons: I think (will start experimenting > more with it tomorrow), you would get an out of bounds access here in > case the skb->data is the last slot in the ring buffer and reaches > exactly to the ri

Re: [PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-09-02 Thread Ken-ichirou MATSUZAWA
Thank you for the reply. On Wed, Sep 02, 2015 at 11:47:26AM +0200, Daniel Borkmann wrote: > On 09/02/2015 02:04 AM, Ken-ichirou MATSUZAWA wrote: > >Talking about skb_copy path, original skb's shared info is accessed > >only in copy_skb_header, to get gso related field. As a

Re: [PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-09-01 Thread Ken-ichirou MATSUZAWA
On Wed, Aug 19, 2015 at 04:29:32PM +0200, Daniel Borkmann wrote: > On 08/17/2015 11:02 PM, David Miller wrote: > >From: Daniel Borkmann > >Date: Fri, 14 Aug 2015 12:38:21 +0200 > > > >>diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c > >>index 67d2104..4307446 100644 > >>--- a/net/

[PATCH net] netlink: rx mmap: fix POLLIN condition

2015-08-30 Thread Ken-ichirou MATSUZAWA
urn immediately even though there are VALID frames. To avoid situations like above, I think we need to scan all frames to find VALID frames at poll() like netlink_alloc_skb(), netlink_forward_ring() finding an UNUSED frame at skb allocation. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netl

Re: [PATCH net] netlink: mmap: fix status setting in skb destructor

2015-08-28 Thread Ken-ichirou MATSUZAWA
On Tue, Aug 25, 2015 at 08:22:03PM -0700, David Miller wrote: > From: Ken-ichirou MATSUZAWA > > I don't know the intension of setting VALID status in the skb > > destructor. But I think it need to be set UNUSED status in case of > > I think the idea is to have the user

[PATCH net] netlink: mmap: fix lookup frame position

2015-08-28 Thread Ken-ichirou MATSUZAWA
the "ring->head != head" loop test fails. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a774985..39fa91f 100644 --- a/net/ne

Re: [PATCH net] netlink: rx mmap: fix POLLIN condition

2015-08-28 Thread Ken-ichirou MATSUZAWA
Thank you for the reply. On Tue, Aug 25, 2015 at 08:17:12PM -0700, David Miller wrote: > So if netlink_forward_ring() _actually_ sees an entry that we should > advance past, it will cycle through the whole ring, advancing ring->head > until it equals the "ring->head != head" loop test fails. >

[PATCH net] netlink: mmap: fix status setting in skb destructor

2015-08-20 Thread Ken-ichirou MATSUZAWA
I don't know the intension of setting VALID status in the skb destructor. But I think it need to be set UNUSED status in case of error then release skb, or rx ring might be filled with RESERVED frames. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file ch

[PATCH net] netlink: rx mmap: fix POLLIN condition

2015-08-19 Thread Ken-ichirou MATSUZAWA
urn immediately even though there are VALID frames. To avoid situations like above, I think we need to scan all frames to find a VALID frame at poll() like netlink_alloc_skb(), netlink_forward_ring() finding an UNUSED frame at skb allocation. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netl

[PATCH net] netlink: mmap: fix tx type check

2015-08-19 Thread Ken-ichirou MATSUZAWA
single_range(WRITE, ... iov_iter_init(1, WRITE, ... call path, so that we need to check the type by iter_is_iovec() to accept the WRITE. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/

Re: [PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-08-14 Thread Ken-ichirou MATSUZAWA
Hi, Thank you for taking your time and trying to understand, even though one of samples is wrong. correct one is: rx only mmaped nflog sample: https://gist.github.com/chamaken/dc0f80c14862e8061c06/raw/365c8a106840368f313a3791958da9be0f5fbed0/rxring-nflog.c > >Currently, what happens is

Re: [PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-08-14 Thread Ken-ichirou MATSUZAWA
Hi, Thank you for taking your time. Please let me explain these with code samples on gist. I can not describe and arrange it well, sorry. normal socket nflog sample: https://gist.github.com/chamaken/dc0f80c14862e8061c06/raw/2d6da8fff31ef61af77e68713fdb1d71978746a6/nflog.c set iptables

[PATCHv1 net-next 5/5] netlink: mmap: notify only when NL_MMAP_STATUS_VALID frame exists

2015-08-12 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index d8f5151..9f9e9ac 100644 --- a/net/netlink/af_netlink.c +++ b/net

[PATCHv1 net-next 4/5] netlink: mmap: update tx type check

2015-08-12 Thread Ken-ichirou MATSUZAWA
We need to accept msg_iter.type 1(WRITE) which is set in sendto/sendmsg. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index c03fad0..d8f5151 100644

[PATCHv1 net-next 3/5] netlink: mmap: fix status for not delivered skb

2015-08-12 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 45c8502..c03fad0 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -864,7

[PATCHv1 net-next 2/5] netlink: mmap: apply mmaped skb helper functions

2015-08-12 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netfilter/nfnetlink_log.c|2 +- net/netfilter/nfnetlink_queue_core.c |6 +++--- net/netlink/af_netlink.c | 26 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/net/netfilter

[PATCHv1 net-next 1/5] netlink: mmap: introduce mmaped skb helper functions

2015-08-12 Thread Ken-ichirou MATSUZAWA
It seems that we need helper functions for skb which is allocated at netlink_alloc_skb() since it does not have skb_shared_info. Signed-off-by: Ken-ichirou MATSUZAWA --- include/linux/netlink.h | 21 +- net/netlink/af_netlink.c | 55

[PATCHv1 net-next 0/5] netlink: mmap: kernel panic and some issues

2015-08-12 Thread Ken-ichirou MATSUZAWA
Hi, It would be better if someone else is working on this. Or could you help me out? It's a tough work for me. Changes from RFC: * remove netlink_skb_zerocopy() I made a big mistake, and ``len <= skb_tailroom(to)'' for mmaped skb is always true in nfqnl_build_packet_message() * copy

[RFC PATCH 4/5] netlink: mmap: update tx type check

2015-07-22 Thread Ken-ichirou MATSUZAWA
We need to accept msg_iter.type 1(WRITE) which is set in sendto/sendmsg. Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a6fba4c..7e1610e 100644

[RFC PATCH 5/5] netlink: rx mmap: notify only when NL_MMAP_STATUS_VALID frame exists

2015-07-22 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c | 28 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7e1610e..8901acd 100644 --- a/net/netlink/af_netlink.c +++ b/net

[RFC PATCH 3/5] netlink: mmap: fix status for not delivered skb

2015-07-22 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netlink/af_netlink.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 5632ad0..a6fba4c 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -847,7

[RFC PATCH 2/5] netlink: mmap: apply mmaped skb helper functions

2015-07-22 Thread Ken-ichirou MATSUZAWA
Signed-off-by: Ken-ichirou MATSUZAWA --- net/netfilter/nfnetlink_log.c|2 +- net/netfilter/nfnetlink_queue_core.c |8 net/netlink/af_netlink.c | 26 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/net/netfilter

[RFC PATCH 1/5] netlink: mmap: introduce mmaped skb helper functions

2015-07-22 Thread Ken-ichirou MATSUZAWA
It seems that we need helper functions for skb which is allocated at netlink_alloc_skb() since it does not have skb_shared_info. Signed-off-by: Ken-ichirou MATSUZAWA --- include/linux/netlink.h | 22 - net/netlink/af_netlink.c | 81

[RFC PATCH 0/5] netlink: mmap kernel panic and some issues

2015-07-22 Thread Ken-ichirou MATSUZAWA
Hello, I got a kernel panic below when I dumped using mmaped netlink socket while monitoring it by nlmon tap device. I realized it is because mmaped netlink skb does not have skb_shared_info but don't know how to fix it in sane. This patch series seems to work fine for me but I'm not sure it's ri

Re: checksum of lsrr

2007-08-18 Thread Ken-ichirou MATSUZAWA
Hello, I'm sorry I make a fuss. Only FYI, one of my box has 3Com NIC 00:0c.0 Ethernet controller: 3Com Corporation 3c905C-TX/TX-M [Tornado] (rev 78) Subsystem: 3Com Corporation 3C905C-TX Fast Etherlink for PC Management NIC Flags: bus master, medium devsel, latency 32, IRQ 11

Re: Oops in xfrm_bundle_ok

2007-07-24 Thread Ken-ichirou MATSUZAWA
Hello, From: Ken-ichirou MATSUZAWA <[EMAIL PROTECTED]> Subject: Oops in xfrm_bundle_ok Date: Thu, 05 Jul 2007 02:47:10 +0900 (JST) > I got Oops like below. I glanced xfrm_bundle_ok() in > xfrm_policy.c and __xfrm4.bundle_create() in xfrm4_policy.c. It seems this was fixed by bel

Re: checksum of lsrr

2007-07-22 Thread Ken-ichirou MATSUZAWA
Hello, From: Ken-ichirou MATSUZAWA <[EMAIL PROTECTED]> Subject: checksum of lsrr Date: Wed, 04 Jul 2007 22:28:24 +0900 (JST) > if we change destination address, we need recompute not only ip > checksum but also tcp's, don't we? I was ashamed of myself for much confus

Oops in xfrm_bundle_ok

2007-07-04 Thread Ken-ichirou MATSUZAWA
Hello, I got Oops like below. I glanced xfrm_bundle_ok() in xfrm_policy.c and __xfrm4.bundle_create() in xfrm4_policy.c. In __xfrm4.bundle_create(), xfrm_dst->next may be null but in xfrm_bundle_ok(), later loop does not check null, only break `if (last == first)'. I tried to solve with only che

checksum of lsrr

2007-07-04 Thread Ken-ichirou MATSUZAWA
Hello, I tried source routing with netcat just for my interest but it did not work. tcpdump output follows: 00:07:40:53:bd:55 > 00:01:8e:b3:82:1c, ethertype IPv4 (0x0800), length 86: (tos 0x0, ttl 64, id 50437, offset 0, flags [DF], proto: TCP (6), length: 72, options (LSRR 172.27.129.2 172.2

[PATCH] fix unbalanced lock

2005-11-09 Thread Ken-ichirou MATSUZAWA
Hello, ip6ip6_lock is not unlocked in error path. --- net/ipv6/ip6_tunnel.c.orig 2005-11-09 22:01:31.0 +0900 +++ net/ipv6/ip6_tunnel.c 2005-11-09 22:04:06.0 +0900 @@ -525,6 +525,7 @@ if ((t = ip6ip6_tnl_lookup(&ipv6h->saddr, &ipv6h->daddr)) != NULL) {

BUG: using smp_processor_id() in preemptible [00000001] code: ipcomp/2801

2005-08-17 Thread Ken-ichirou MATSUZAWA
Hello, It seems that because ipcomp_alloc_tfms() calls smp_processor_id(), but a comment says not need locking. Is this right? BUG: using smp_processor_id() in preemptible [0001] code: ipcomp/2801 caller is ipcomp_init_state+0x170/0x490 Call Trace:{debug_smp_processor_id+182} {ipcomp

MASQUERADE and IPSec tunnel

2005-07-20 Thread Ken-ichirou MATSUZAWA
Hello, I set up IPSec tunnel and iptables as follows: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE spdadd 172.27.210.0/24 172.27.86.0/24 any -P in ipsec esp/tunnel/172.27.1.3-172.27.1.10/require ah/tunnel/172.27.1.3-172.27.1.10/require; spdadd 172.27.86.

Re: ALIGN at crypt/cipher.c

2005-07-14 Thread Ken-ichirou MATSUZAWA
I am sorry for my sending many times with a trifle. From: Ken-ichirou MATSUZAWA <[EMAIL PROTECTED]> Subject: Re: ALIGN at crypt/cipher.c Date: Thu, 14 Jul 2005 22:59:35 +0900 (JST) > Is ``notl 32bit reg'' right? Is this a problem of gcc? No, I think I can understand. align

Re: ALIGN at crypt/cipher.c

2005-07-14 Thread Ken-ichirou MATSUZAWA
Hello, I can't understand asm so would you help to see things going well? I changed crypto_init_cipher_ops() in crypt/cipher.c # thanks to ``HOWTO find oops location'' ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm); align = crypto_tfm_alg_alignmask(tfm) + 1; asm("#1"); addr = (

Re: ALIGN at crypt/cipher.c

2005-07-12 Thread Ken-ichirou MATSUZAWA
Hello, I was sorry for my less information. From: Andi Kleen <[EMAIL PROTECTED]> Subject: Re: ALIGN at crypt/cipher.c Date: Mon, 11 Jul 2005 18:35:31 +0200 > > $ uname -a > > Linux toptor 2.6.13-rc2-git1 #8 SMP Tue Jul 12 00:10:46 JST 2005 x86_64 > > GNU/Linux > > I got oops at esp_output in ne