Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 23:44:10 -0700
From:      Waitman Gobble <gobble.wa@gmail.com>
To:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>
Subject:   Re: kvm_nlist failing on arm?
Message-ID:  <CAFuo_fx2kt9motaHMNLLOUakw_NQMO2nZcaQXJGbEyajwj5B-Q@mail.gmail.com>
In-Reply-To: <CAFuo_fxMpwkbcEVdF0Sgh20ypJwnEF_7bKvV7JiAa%2BEUSoFZpw@mail.gmail.com>
References:  <CAFuo_fx-q=rjYcrgt_jq78bEOwQk6mYDqQ8gk5C5YDsHbLBUXg@mail.gmail.com> <CAFuo_fxMpwkbcEVdF0Sgh20ypJwnEF_7bKvV7JiAa%2BEUSoFZpw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 6, 2015 at 7:09 PM, Waitman Gobble <gobble.wa@gmail.com> wrote:
> On Mon, Apr 6, 2015 at 5:32 PM, Waitman Gobble <gobble.wa@gmail.com> wrote:
>> Hi,
>>
>> I'm having an issue with kvm_nlist failing on armv6 machine, but works
>> on amd64 machines. Anyone have an idea about this?
>>
>>
>> simple example
>>
>> static struct nlist     nl[] = {
>> #define N_HCI_RAW       0
>>         { "_ng_btsocket_hci_raw_sockets" },
>> };
>>
>> kvm_t   *kvmd = NULL;
>> kvmd = kvm_openfiles(NULL, memf, NULL, O_RDONLY, errbuf);
>> kvm_nlist(kvmd, nl);
>> if (nl[0].n_type == 0) {
>>                 /* bomb - problem */
>> }
>>
>>
>>
>> # uname -a
>> FreeBSD ARTiming150301 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279488:
>> Sun Mar  1 10:27:33 PST 2015
>> waitman@rpidev.waitman.net:/usr/home/waitman/crochet-freebsd/work/obj/arm.armv6/usr/src/sys/TMRDEV
>>  arm
>>
>>
>> Thanks,
>>
>> --
>> Waitman Gobble
>> Los Altos California USA
>> 510-830-7975
>
>
> OOPs, the error:
>
> kvm_nlist: no namelist
>
>
> --
> Waitman Gobble
> Los Altos California USA
> 510-830-7975



I'm not yet sure if this is a netgraph or bluetooth kernel module
issue, or something else.

kvm_nlist does not seem to resolve netgraph/bluetooth names on RPI/armv6
which causes btsockstat in base to fail with error.

# btsockstat
btsockstat: kvm_nlist: no namelist

 uname -a
FreeBSD ARTiming150301 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279488:
Sun Mar  1 10:27:33 PST 2015
waitman@rpidev.waitman.net:/usr/home/waitman/crochet-freebsd/work/obj/arm.armv6/usr/src/sys/TMRDEV
 arm

# kldstat | grep ng_
 5    1 0xc2ba0000 e000     ng_ubt.ko
 7    1 0xc2bcb000 12000    ng_hci.ko
 8    3 0xc2bde000 a000     ng_bluetooth.ko
13    1 0xc2cc0000 16000    ng_l2cap.ko
14    1 0xc2cd8000 24000    ng_btsocket.ko
15    1 0xc2d05000 c000     ng_socket.ko


test, some things we know should not resolve and some things should.


#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <fcntl.h>
#include <kvm.h>
#include <limits.h>
#include <nlist.h>


static struct nlist     nl[] = {
        { "kernel_l1pa" },
        { "KPML4phys" },
        { "_rtstat" },
        { "booha" },
        { "_ng_btsocket_hci_raw_debug_level" },
        { "_ng_btsocket_hci_raw_sockets" },
        { "_ng_btsocket_l2cap_raw_sockets" },
        { "_ng_btsocket_l2cap_sockets" },
        { "_ng_btsocket_l2cap_raw_rt" },
        { "_ng_btsocket_l2cap_rt" },
        { "_ng_btsocket_rfcomm_sockets" },
        { "_ng_btsocket_rfcomm_sessions" },
        { "_rttrash" },
        { "_rt_tables" },
        { "" },
};


int
main(int argc, char *argv[])
{

        int     i;
        kvm_t   *kvmd = NULL;
        char     errbuf[_POSIX2_LINE_MAX];

        kvmd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
        kvm_nlist(kvmd, nl);
        for (i=0;i<14;i++)
        {
                if (nl[i].n_type == 0) {
                        printf("error: no match %i (%s)\n",i,nl[i].n_name);
                } else {
                        printf("OK: %i %s\n",i,nl[i].n_name);
                }
        }
        return(0);
}

# clang -lkvm -o test test.c
# ./test

OK: 0 kernel_l1pa
error: no match 1 (KPML4phys)
OK: 2 _rtstat
error: no match 3 (booha)
error: no match 4 (_ng_btsocket_hci_raw_debug_level)
error: no match 5 (_ng_btsocket_hci_raw_sockets)
error: no match 6 (_ng_btsocket_l2cap_raw_sockets)
error: no match 7 (_ng_btsocket_l2cap_sockets)
error: no match 8 (_ng_btsocket_l2cap_raw_rt)
error: no match 9 (_ng_btsocket_l2cap_rt)
error: no match 10 (_ng_btsocket_rfcomm_sockets)
error: no match 11 (_ng_btsocket_rfcomm_sessions)
OK: 12 _rttrash
OK: 13 _rt_tables


Hopefully someone can shed some light on this problem.

Thank you,

-- 
Waitman Gobble
Los Altos California USA
510-830-7975



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFuo_fx2kt9motaHMNLLOUakw_NQMO2nZcaQXJGbEyajwj5B-Q>