pkcs11-destroy dumps core when wrong PIN is used
The PIN is set to 1234
but when I set the slot and label to correct values, but PIN to a wrong one, I get abort:
root@e07d99029738:~/bind9# gdb /root/bind9/bin/pkcs11/pkcs11-destroy
GNU gdb (Debian 8.3.1-1) 8.3.1
...
This GDB was configured as "x86_64-linux-gnu".
...
Reading symbols from /root/bind9/bin/pkcs11/pkcs11-destroy...
(gdb) set args -s 1604939466 -l softhsm2 -p 1
(gdb) start
Temporary breakpoint 1 at 0x5470: file pkcs11-destroy.c, line 84.
Starting program: /root/bind9/bin/pkcs11/pkcs11-destroy -s 1604939466 -l softhsm2 -p 1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Temporary breakpoint 1, main (argc=7, argv=0x7fffffffec18) at pkcs11-destroy.c:84
84 CK_ATTRIBUTE search_template[] = {
(gdb) c
Continuing.
pk11.c:442: fatal error: pkcs_C_Login: Error = 0x000000A0
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) thread apply all bt full
Thread 1 (Thread 0x7ffff59e32c0 (LWP 19145)):
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
set = {__val = {0, 6731770221030783915, 0, 0, 0, 0, 93824992530064, 140737313896445, 140737314140848, 93824992546288, 72, 72, 93824992540192, 93823577358337, 93824992541680, 8064899351085853440}}
pid = <optimized out>
tid = <optimized out>
ret = <optimized out>
#1 0x00007ffff794c535 in __GI_abort () at abort.c:79
save_stage = 1
act = {__sigaction_handler = {sa_handler = 0x7ffff7ae1703 <_IO_2_1_stderr_+131>, sa_sigaction = 0x7ffff7ae1703 <_IO_2_1_stderr_+131>}, sa_mask = {__val = {140737348773216, 3432, 140737347469334, 0, 1, 140737348769408, 140737488348808, 1, 0, 0, 140737347476889, 10, 140737347477907, 140737348769856, 140737348769408, 140737348773216}}, sa_flags = -140930118, sa_restorer = 0x55555559ebd0}
sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x000055555555cb48 in isc_error_fatal (file=file@entry=0x555555565314 "pk11.c", line=line@entry=442, format=format@entry=0x5555555654d3 "%s: Error = 0x%.8lX\n") at error.c:67
args = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffffffe760, reg_save_area = 0x7fffffffe6a0}}
#3 0x000055555555b178 in pk11_error_fatalcheck (file=file@entry=0x555555565314 "pk11.c", line=line@entry=442, funcname=funcname@entry=0x5555555655f4 "pkcs_C_Login", rv=<optimized out>) at pk11.c:987
No locals.
#4 0x000055555555b9f3 in token_login (sp=<optimized out>, sp=<optimized out>) at pk11.c:442
rv = <optimized out>
token = 0x55555559ebd0
#5 0x000055555555bd3e in pk11_get_session (ctx=0x7fffffffe870, optype=OP_ANY, need_services=<optimized out>, rw=<optimized out>, logon=<optimized out>, pin=<optimized out>, slot=<optimized out>) at pk11.c:334
token = <optimized out>
freelist = <optimized out>
sp = 0x55555559eb00
ret = 0
#6 0x00005555555596c3 in main (argc=7, argv=<optimized out>) at pkcs11-destroy.c:150
result = <optimized out>
rv = <optimized out>
slot = 1604939466
hSession = <optimized out>
attr_id = "66"
akey = {26577600, 140737488349620, 2, 9223372036854775822, 0, 0, 0, 0, 0, 0, 2, 9223372036854775822, 0, 140737347945865, 140737348766784, 592, 0, 140737347515177, 0, 140737347500374, 0, 93824992337920, 624, 140737348766880, 140737488349976, 140737488350032, 140737354131248, 896, 140737354132160, 18446744073709551528, 592, 140737348766880, 576, 140737348766784, 37, 140737347504347, 0, 35, 0, 0, 576, 0, 72704, 72703, 121, 9, 244813135909, 1136, 5085241283009, 93824992300661}
pctx = {handle = 0x0, session = 0, ontoken = 0 '\000', object = 0}
lib_name = 0x0
label = <optimized out>
pin = 0x7fffffffee80 "1"
error = 0
id = <optimized out>
i = 0
wait = 5
c = <optimized out>
errflg = 0
ulObjectCount = 280375481794560
search_template = {{type = 3, pValue = 0x7fffffffee74, ulValueLen = 8}}
j = <optimized out>
len = <optimized out>
This is on updated Debian GNU/Linux bullseye/sid (sid Docker image from our repository).
BIND was configured with --enable-native-pkcs11 --with-pkcs11=/usr/lib/softhsm/libsofthsm2.so
.