kvm_nlist failing on arm?
Waitman Gobble
gobble.wa at gmail.com
Fri Apr 10 06:44:12 UTC 2015
On Mon, Apr 6, 2015 at 7:09 PM, Waitman Gobble <gobble.wa at gmail.com> wrote:
> On Mon, Apr 6, 2015 at 5:32 PM, Waitman Gobble <gobble.wa at 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 at 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 at 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
More information about the freebsd-arm
mailing list