netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [sparc64] nft bus error
@ 2019-07-13 18:45 Anatoly Pugachev
       [not found] ` <20190713190320.pmu33mx2lm75fihd@breakpoint.cc>
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Pugachev @ 2019-07-13 18:45 UTC (permalink / raw)
  To: netfilter-devel; +Cc: coreteam, debian-sparc

Hello!

Getting nft (libnftnl) bus error with sparc64 linux machine.

using git version of libnftnl and nftables (installed under /opt/nft):
mator@ttip:/1/mator/libnftnl$ git desc
libnftnl-1.1.3-7-ga6a2d0c
mator@ttip:/1/mator/libnftnl$ cd ../nftables/
mator@ttip:/1/mator/nftables$ git desc
v0.9.1-25-g87c0bee

# which nft
/opt/nft/sbin/nft
# nft  list tables
table ip sshguard
table ip6 sshguard
(loading some rules)
# nft -f /etc/nft.rules
# nft  list tables
Bus error
(run under gdb)
# gdb -q /opt/nft/sbin/nft
Reading symbols from /opt/nft/sbin/nft...done.
(gdb) set args list tables
(gdb) run
Starting program: /opt/nft/sbin/nft list tables

Program received signal SIGBUS, Bus error.
0xfff8000100946490 in nftnl_udata_get_u32 (attr=0x10000106e30) at udata.c:127
127             return *data;
(gdb) bt
#0  0xfff8000100946490 in nftnl_udata_get_u32 (attr=0x10000106e30) at
udata.c:127
#1  0xfff8000100168db8 in netlink_delinearize_set (ctx=0x7feffffee08,
nls=0x100001076e0) at netlink.c:568
#2  0xfff800010016929c in list_set_cb (nls=0x100001076e0,
arg=0x7feffffee08) at netlink.c:647
#3  0xfff800010094083c in nftnl_set_list_foreach
(set_list=0x10000107640, cb=0xfff8000100169278 <list_set_cb>,
data=0x7feffffee08) at set.c:780
#4  0xfff80001001693a4 in netlink_list_sets (ctx=0x7feffffee08,
h=0x10000107160) at netlink.c:668
#5  0xfff800010013ba90 in cache_init_objects (ctx=0x7feffffee08,
flags=127) at rule.c:161
#6  0xfff800010013be98 in cache_init (ctx=0x7feffffee08, flags=127) at
rule.c:220
#7  0xfff800010013c0b8 in cache_update (nft=0x10000106a20, flags=127,
msgs=0x7fefffff140) at rule.c:258
#8  0xfff800010018cca4 in nft_evaluate (nft=0x10000106a20,
msgs=0x7fefffff140, cmds=0x7fefffff130) at libnftables.c:406
#9  0xfff800010018cf4c in nft_run_cmd_from_buffer (nft=0x10000106a20,
buf=0x10000106d40 "list tables") at libnftables.c:447
#10 0x0000010000002088 in main (argc=3, argv=0x7fefffff618) at main.c:316
(gdb)




# cat /etc/nft.rules
# Translated by iptables-restore-translate v1.8.3 on Sat Jul 13 10:53:36 2019
add table ip filter
add chain ip filter INPUT { type filter hook input priority 0; policy accept; }
add chain ip filter FORWARD { type filter hook forward priority 0;
policy accept; }
add chain ip filter OUTPUT { type filter hook output priority 0;
policy accept; }
# -t filter -A INPUT -p tcp --dport 22 -m set --match-set sshguard4 src -j DROP
add rule ip filter INPUT iifname "lo" counter accept
add rule ip filter INPUT ct state related,established counter accept
add rule ip filter INPUT ct state new  tcp dport 22 counter accept
add rule ip filter INPUT ip saddr 10.8.1.0/24 counter accept
add rule ip filter INPUT ip protocol icmp counter accept
add rule ip filter INPUT ip protocol udp udp dport 33434-33529 counter accept
add rule ip filter INPUT iifname "eth0" ip saddr 10.190.2.0/24 ct
state new  tcp dport 445 counter accept
add rule ip filter INPUT iifname "eth0" ip saddr 10.190.2.0/24 ct
state new  udp dport 445 counter accept
add rule ip filter INPUT iifname "eth0" ip saddr 192.168.158.0/24 ct
state new  tcp dport 445 counter accept
add rule ip filter INPUT iifname "eth0" ip saddr 192.168.158.0/24 ct
state new  udp dport 445 counter accept
add rule ip filter INPUT ip protocol tcp tcp dport { 80,443} counter accept
add rule ip filter INPUT counter drop
add table ip nat
add chain ip nat PREROUTING { type nat hook prerouting priority -100;
policy accept; }
add chain ip nat INPUT { type nat hook input priority 100; policy accept; }
add chain ip nat OUTPUT { type nat hook output priority -100; policy accept; }
add chain ip nat POSTROUTING { type nat hook postrouting priority 100;
policy accept; }
# Completed on Sat Jul 13 10:53:36 2019


machine info:

nftables$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/sparc64-linux-gnu/8/lto-wrapper
Target: sparc64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
8.3.0-7' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=sparc64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libquadmath
--disable-libquadmath-support --enable-plugin --enable-default-pie
--with-system-zlib --disable-libphobos --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-cpu-32=ultrasparc
--enable-targets=all --with-long-double-128 --enable-multilib
--enable-checking=release --build=sparc64-linux-gnu
--host=sparc64-linux-gnu --target=sparc64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-7)

nftables$ ld -V
GNU ld (GNU Binutils for Debian) 2.32.51.20190707
  Supported emulations:
   elf64_sparc
   elf32_sparc

# ldconfig -V
ldconfig (Debian GLIBC 2.28-10) 2.28

# uname -a
Linux ttip 5.2.0-rc6-00001-g9014143bab2f #1064 SMP Sat Jul 13 21:36:42
MSK 2019 sparc64 GNU/Linux

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sparc64] nft bus error
       [not found] ` <20190713190320.pmu33mx2lm75fihd@breakpoint.cc>
@ 2019-07-13 19:26   ` Anatoly Pugachev
  0 siblings, 0 replies; 2+ messages in thread
From: Anatoly Pugachev @ 2019-07-13 19:26 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, coreteam, debian-sparc

On Sat, Jul 13, 2019 at 10:03 PM Florian Westphal <fw@strlen.de> wrote:
> Anatoly Pugachev <matorola@gmail.com> wrote:
> > Program received signal SIGBUS, Bus error.
> > 0xfff8000100946490 in nftnl_udata_get_u32 (attr=0x10000106e30) at udata.c:127
> > 127             return *data;
>
> struct nftnl_udata {
>        uint8_t         type;
>        uint8_t         len;
>        unsigned char   value[];
> } __attribute__((__packed__));
>
> Sparc doesn't like doing:
>
> uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
> {
>         uint32_t *data = (uint32_t *)attr->value;
>
>         return *data;
> }
>
> Anatoly, does this help?
>
> diff --git a/src/udata.c b/src/udata.c
> --- a/src/udata.c
> +++ b/src/udata.c
> @@ -122,9 +122,11 @@ void *nftnl_udata_get(const struct nftnl_udata *attr)
>  EXPORT_SYMBOL(nftnl_udata_get_u32);
>  uint32_t nftnl_udata_get_u32(const struct nftnl_udata *attr)
>  {
> -       uint32_t *data = (uint32_t *)attr->value;
> +       uint32_t data;
>
> -       return *data;
> +       memcpy(&data, attr->value, sizeof(data));
> +
> +       return data;
>  }
>
>  EXPORT_SYMBOL(nftnl_udata_next);

Florian,

yes, works beautifully!

Thanks!

PS: missed CC list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-13 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-13 18:45 [sparc64] nft bus error Anatoly Pugachev
     [not found] ` <20190713190320.pmu33mx2lm75fihd@breakpoint.cc>
2019-07-13 19:26   ` Anatoly Pugachev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).