pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/59111: keepassxc segfaults on aarch64



>Number:         59111
>Category:       pkg
>Synopsis:       keepassc segfaults on aarch64
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 28 07:40:00 +0000 2025
>Originator:     Michael van Elst
>Release:        NetBSD 10.99.12
>Organization:
	
>Environment:
	
	
System: NetBSD arnold 10.99.12 NetBSD 10.99.12 (EGGHED64) #0: Fri Feb 28 06:10:23 UTC 2025 mlelstv@slowpoke:/home/netbsd-current/obj.evbarm64-el/scratch/netbsd-current/src/sys/arch/evbarm/compile/EGGHED64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
Running keepassxc from pkgsrc-2024Q4 crashes immediately with a segfault.

Reading symbols from /usr/pkg/bin/keepassxc...
(No debugging symbols found in /usr/pkg/bin/keepassxc)
[New process 3889]
[New process 307]
[New process 306]
Core was generated by `keepassxc'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000f2d86370e638 in Botan::OS::get_auxval(unsigned long) ()
--Type <RET> for more, q to quit, c to continue without paging--c
   from /usr/pkg/lib/libbotan-3.so.6
[Current thread is 1 (process 3889)]
(gdb) bt
#0  0x0000f2d86370e638 in Botan::OS::get_auxval(unsigned long) ()
   from /usr/pkg/lib/libbotan-3.so.6
#1  0x0000f2d86370247c in Botan::CPUID::CPUID_Data::detect_cpu_features(unsigned int) () from /usr/pkg/lib/libbotan-3.so.6


This is caused by libbotan from botan3-3.6.1nb2. It tries to identify
CPU features by searching the auxinfo vector for AT_HWCAP (something
we do not provide) with this function:

unsigned long OS::get_auxval(unsigned long id) {
#if defined(BOTAN_TARGET_OS_HAS_GETAUXVAL)
   return ::getauxval(id);
#elif defined(BOTAN_TARGET_OS_HAS_ELF_AUX_INFO)
   unsigned long auxinfo = 0;
   ::elf_aux_info(static_cast<int>(id), &auxinfo, sizeof(auxinfo));
   return auxinfo;
#elif defined(BOTAN_TARGET_OS_HAS_AUXINFO)
   for(const AuxInfo* auxinfo = static_cast<AuxInfo*>(::_dlauxinfo()); auxinfo !
= AT_NULL; ++auxinfo) {
      if(id == auxinfo->a_type)
         return auxinfo->a_v;
   }
   
   return 0;
#else
   BOTAN_UNUSED(id);
   return 0;
#endif
}  

The build uses the BOTAN_TARGET_OS_HAS_AUXINFO case. You can see
that it scans the auxinfo vector for an entry and it runs over
the end and finally crashes when it reaches an unmapped page.

A fix here is not really sufficient. The detect_cpu_features
function relies on auxinfo data as soon as BOTAN_TARGET_OS_HAS_ELF_AUX_INFO
is defined:

bool OS::has_auxval() {
#if defined(BOTAN_TARGET_OS_HAS_GETAUXVAL)
   return true;
#elif defined(BOTAN_TARGET_OS_HAS_ELF_AUX_INFO)
   return true;
#elif defined(BOTAN_TARGET_OS_HAS_AUXINFO)
   return true;
#else
   return false;
#endif
}

It will then not enable any hardware acceleration when no
Linux compatible AT_HWCAP entry is found.

If botan is built without any auxval support, it will fall back
to code that probes various CPU instructions.

>How-To-Repeat:
Run keepassxc from pkgsrc-2024Q4 on aarch64.
>Fix:
	

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index