我的系统是Ubuntu,uname -r = 4.15.0-23-generic.我已经为内核安装了调试符号.
我的问题是:
I am trying to use
socket(AF_PACKET,SOCK_DGRAM,0)
for transmision
purpose. Forsendto(fd,0)
syscall I’ve gotEINVAL
(Invalid Argument) and I am trying to investigate what the cause is.
因此,要找出返回EINVAL的内容,我正在使用SystemTap.下面的脚本跟踪tpacket_snd函数的语句执行语句.
我的探测程序:info.stp
probe kernel.statement("tpacket_snd@*:*") { tokenize(pp(),"@"); printf("HIT %s\n",tokenize("","@")) }
这是我执行这种传输的sudo stap info.stp的输出:
HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2619") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2627") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2628") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2636") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2638") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2640") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2641") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2656") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2659") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2658") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2662") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2663") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2669") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2671") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2674") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2672") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2675") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2680") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2688") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2692") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2694") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2693") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2706") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2710") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2707") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2708") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2709") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2712") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2743") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2728") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2736") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2735") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2785") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2787") HIT /build/linux-uT8zSN/linux-4.15.0/net/packet/af_packet.c:2789")
[https://elixir.bootlin.com/linux/v4.15/source/net/packet/af_packet.c#L2618]
>首先,
指出af_packet.c:2707行是在2710之后执行的
2710不包含跳转指令.
>其次,
根据我的调查,我可以提出这样的条件:[第2741-2745行]
if(po-> has_vnet_hdr&& virtio_net_hdr_to_skb(skb,vnet_hdr,vio_le())){
tp_len = -EINVAL;
转到tpacket_error;
}
评估了SystemTap指出第2743行已执行的真实情况.但是,从另一方面我已经用SystemTap调查过po-> has_vnet_hdr等于0所以如果是body则不可能执行.但是,SystemTap指出了它.
我的问题是:
如何修复它或我做错了什么?