Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alignment issues on some ARM implementations #7

Open
satta opened this issue Apr 14, 2022 · 0 comments
Open

Alignment issues on some ARM implementations #7

satta opened this issue Apr 14, 2022 · 0 comments

Comments

@satta
Copy link
Contributor

satta commented Apr 14, 2022

While building and testing pktanon on Debian, which is available for a large variety of architectures, we noticed that pktanon fails on ARM with a bus error:

-----------------------------------------------
pktanon --- profile-based traffic anonymization
-----------------------------------------------
initializing PktAnon,  configuration = 
/usr/share/doc/pktanon/examples/profiles/profile.xml
unknown element: pktanon-config: 37
unknown element: anonymizations: 102
istream: opened file 
/tmp/autopkgtest-lxc.tgw0nfyu/downtmp/build.ybV/src/profiles/sample.pcap
ostream: opened output file ./out.pcap
initialized
Bus error

See Debian issue ticket with more details here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=999620

We have tracked the problem down to an unaligned access via hton32() on a field that is not 4-byte aligned, and this architecture requires alignment:

# gdb --args pktanon -c /usr/share/doc/pktanon/examples/profiles/profile.xml ./profiles/sample.pcap ./out.pcap
[...]
Reading symbols from pktanon...
Reading symbols from /usr/lib/debug/.build-id/af/1ac53f46ae133c8898358966960cba95ac7a70.debug...
(gdb) run
Starting program: /usr/bin/pktanon -c /usr/share/doc/pktanon/examples/profiles/profile.xml ./profiles/sample.pcap ./out.pcap
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
-----------------------------------------------
pktanon --- profile-based traffic anonymization
-----------------------------------------------
initializing PktAnon,  configuration = /usr/share/doc/pktanon/examples/profiles/profile.xml
unknown element: pktanon-config: 37
unknown element: anonymizations: 102
istream: opened file ./profiles/sample.pcap
ostream: opened output file ./out.pcap
initialized

Program received signal SIGBUS, Bus error.
pktanon::TcpPacketTransformation::transform (this=<optimized out>, source_buffer=<optimized out>, destination_buffer=0xfffef35a "\212y\262X\335\300l\221", max_packet_length=40) at transformations/TcpPacketTransformation.cpp:88
88	  hton32 (output_header->ack_num);
(gdb) bt
#0  pktanon::TcpPacketTransformation::transform (this=<optimized out>, 
    source_buffer=<optimized out>, 
    destination_buffer=0xfffef35a "\212y\262X\335\300l\221", 
    max_packet_length=40) at transformations/TcpPacketTransformation.cpp:88
#1  0x0040b77c in pktanon::IPv4PacketTransformation::transform (this=0x4b4eb0, 
    source_buffer=<optimized out>, destination_buffer=0xfffef346 "E", 
    max_packet_length=<optimized out>)
    at transformations/IPv4PacketTransformation.cpp:153
#2  0x0040af64 in pktanon::EthernetPacketTransformation::transform (
    this=0x4ad780, source_buffer=<optimized out>, 
    destination_buffer=0xfffef338 "\376\212\a\213\001\254\303\341\372DI\355\b", max_packet_length=74) at transformations/EthernetPacketTransformation.cpp:53
#3  0x00416862 in pktanon::transform_packet (stats=..., 
    packet_len=<optimized out>, 
    transformed_packet=0xfffef338 "\376\212\a\213\001\254\303\341\372DI\355\b", original_packet=0xfffef438 "", record_header=...) at Utils.h:26
#4  pktanon::IstreamInput::read_packets (this=0x4b3ce0)
    at IstreamRecordsHandler.cpp:121
#5  0x00415130 in pktanon::PktAnonRuntime::run () at PktAnonRuntime.cpp:37
#6  0x00405bfa in main (argc=<optimized out>, argv=<optimized out>)
    at src/Main.cpp:73
(gdb) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant