diff options
author | Ola x Nilsson <olani@axis.com> | 2022-12-08 08:11:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-17 11:10:04 +0000 |
commit | c7b64446cbb69218e116947ffd1dedbce57a0b5f (patch) | |
tree | 07e96ccd3817ae8b250bf04974d973dd13017215 /meta | |
parent | d7a10cf6f9a49dcce9a0316a34be9b928d2ae5f1 (diff) | |
download | poky-c7b64446cbb69218e116947ffd1dedbce57a0b5f.tar.gz |
insane: Add QA check for 32 bit time and file offset functions
Check for known symbols that should have been redirected to 64bit
variants when -D_FILE_OFFSET_BITS=64 and -D_TIME_BITS=64 are set.
(From OE-Core rev: 8e2af04f24443fad2040bb32e6033d49e3120517)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes-global/insane.bbclass | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index df2c40c3c5..ada8a7ef4e 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
@@ -506,6 +506,134 @@ def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages): | |||
506 | trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "") | 506 | trimmed = path.replace(os.path.join (d.getVar("PKGDEST"), name), "") |
507 | oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name)) | 507 | oe.qa.add_message(messages, "symlink-to-sysroot", "Symlink %s in %s points to TMPDIR" % (trimmed, name)) |
508 | 508 | ||
509 | QAPATHTEST[32bit-time] = "check_32bit_symbols" | ||
510 | def check_32bit_symbols(path, packagename, d, elf, messages): | ||
511 | """ | ||
512 | Check that ELF files do not use any 32 bit time APIs from glibc. | ||
513 | """ | ||
514 | import re | ||
515 | # This list is manually constructed by searching the image folder of the | ||
516 | # glibc recipe for __USE_TIME_BITS64. There is no good way to do this | ||
517 | # automatically. | ||
518 | api32 = { | ||
519 | # /usr/include/time.h | ||
520 | "clock_getres", "clock_gettime", "clock_nanosleep", "clock_settime", | ||
521 | "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r", "localtime", | ||
522 | "localtime_r", "mktime", "nanosleep", "time", "timegm", "timelocal", | ||
523 | "timer_gettime", "timer_settime", "timespec_get", "timespec_getres", | ||
524 | # /usr/include/bits/time.h | ||
525 | "clock_adjtime", | ||
526 | # /usr/include/signal.h | ||
527 | "sigtimedwait", | ||
528 | # /usr/include/sys/time.h | ||
529 | "futimes", "futimesat", "getitimer", "gettimeofday", "lutimes", | ||
530 | "setitimer", "settimeofday", "utimes", | ||
531 | # /usr/include/sys/timex.h | ||
532 | "adjtimex", "ntp_adjtime", "ntp_gettime", "ntp_gettimex", | ||
533 | # /usr/include/sys/wait.h | ||
534 | "wait3", "wait4", | ||
535 | # /usr/include/sys/stat.h | ||
536 | "fstat", "fstat64", "fstatat", "fstatat64", "futimens", "lstat", | ||
537 | "lstat64", "stat", "stat64", "utimensat", | ||
538 | # /usr/include/sys/poll.h | ||
539 | "ppoll", | ||
540 | # /usr/include/sys/resource.h | ||
541 | "getrusage", | ||
542 | # /usr/include/sys/ioctl.h | ||
543 | "ioctl", | ||
544 | # /usr/include/sys/select.h | ||
545 | "select", "pselect", | ||
546 | # /usr/include/sys/prctl.h | ||
547 | "prctl", | ||
548 | # /usr/include/sys/epoll.h | ||
549 | "epoll_pwait2", | ||
550 | # /usr/include/sys/timerfd.h | ||
551 | "timerfd_gettime", "timerfd_settime", | ||
552 | # /usr/include/sys/socket.h | ||
553 | "getsockopt", "recvmmsg", "recvmsg", "sendmmsg", "sendmsg", | ||
554 | "setsockopt", | ||
555 | # /usr/include/sys/msg.h | ||
556 | "msgctl", | ||
557 | # /usr/include/sys/sem.h | ||
558 | "semctl", "semtimedop", | ||
559 | # /usr/include/sys/shm.h | ||
560 | "shmctl", | ||
561 | # /usr/include/pthread.h | ||
562 | "pthread_clockjoin_np", "pthread_cond_clockwait", | ||
563 | "pthread_cond_timedwait", "pthread_mutex_clocklock", | ||
564 | "pthread_mutex_timedlock", "pthread_rwlock_clockrdlock", | ||
565 | "pthread_rwlock_clockwrlock", "pthread_rwlock_timedrdlock", | ||
566 | "pthread_rwlock_timedwrlock", "pthread_timedjoin_np", | ||
567 | # /usr/include/semaphore.h | ||
568 | "sem_clockwait", "sem_timedwait", | ||
569 | # /usr/include/threads.h | ||
570 | "cnd_timedwait", "mtx_timedlock", "thrd_sleep", | ||
571 | # /usr/include/aio.h | ||
572 | "aio_cancel", "aio_error", "aio_read", "aio_return", "aio_suspend", | ||
573 | "aio_write", "lio_listio", | ||
574 | # /usr/include/mqueue.h | ||
575 | "mq_timedreceive", "mq_timedsend", | ||
576 | # /usr/include/glob.h | ||
577 | "glob", "glob64", "globfree", "globfree64", | ||
578 | # /usr/include/sched.h | ||
579 | "sched_rr_get_interval", | ||
580 | # /usr/include/fcntl.h | ||
581 | "fcntl", "fcntl64", | ||
582 | # /usr/include/utime.h | ||
583 | "utime", | ||
584 | # /usr/include/ftw.h | ||
585 | "ftw", "ftw64", "nftw", "nftw64", | ||
586 | # /usr/include/fts.h | ||
587 | "fts64_children", "fts64_close", "fts64_open", "fts64_read", | ||
588 | "fts64_set", "fts_children", "fts_close", "fts_open", "fts_read", | ||
589 | "fts_set", | ||
590 | # /usr/include/netdb.h | ||
591 | "gai_suspend", | ||
592 | } | ||
593 | |||
594 | ptrn = re.compile( | ||
595 | r''' | ||
596 | (?P<value>[\da-fA-F]+) \s+ | ||
597 | (?P<flags>[lgu! ][w ][C ][W ][Ii ][dD ]F) \s+ | ||
598 | (?P<section>\*UND\*) \s+ | ||
599 | (?P<alignment>(?P<size>[\da-fA-F]+)) \s+ | ||
600 | (?P<symbol> | ||
601 | ''' + | ||
602 | r'(?P<notag>' + r'|'.join(sorted(api32)) + r')' + | ||
603 | r''' | ||
604 | (@+(?P<tag>GLIBC_\d+\.\d+\S*))) | ||
605 | ''', re.VERBOSE | ||
606 | ) | ||
607 | |||
608 | # elf is a oe.qa.ELFFile object | ||
609 | if elf is not None: | ||
610 | phdrs = elf.run_objdump("-tw", d) | ||
611 | syms = re.finditer(ptrn, phdrs) | ||
612 | usedapis = {sym.group('notag') for sym in syms} | ||
613 | if usedapis: | ||
614 | elfpath = package_qa_clean_path(path, d, packagename) | ||
615 | # Remove any .debug dir, heuristic that probably works | ||
616 | # At this point, any symbol information is stripped into the debug | ||
617 | # package, so that is the only place we will find them. | ||
618 | elfpath = elfpath.replace('.debug/', '') | ||
619 | allowed = ( | ||
620 | d.getVarFlag( | ||
621 | 'INSANE_SKIP:' + d.getVar('PN'), elfpath.replace('/', '_') | ||
622 | ) or '' | ||
623 | ).split() | ||
624 | usedapis -= set(allowed) | ||
625 | if usedapis: | ||
626 | msgformat = elfpath + " uses 32-bit api '%s'" | ||
627 | for sym in usedapis: | ||
628 | oe.qa.add_message(messages, '32bit-time', msgformat % sym) | ||
629 | oe.qa.add_message( | ||
630 | messages, '32bit-time', | ||
631 | 'Suppress with INSANE_SKIP:%s[%s] = "%s"' % ( | ||
632 | d.getVar('PN'), elfpath.replace('/', '_'), | ||
633 | ' '.join(usedapis) | ||
634 | ) | ||
635 | ) | ||
636 | |||
509 | # Check license variables | 637 | # Check license variables |
510 | do_populate_lic[postfuncs] += "populate_lic_qa_checksum" | 638 | do_populate_lic[postfuncs] += "populate_lic_qa_checksum" |
511 | python populate_lic_qa_checksum() { | 639 | python populate_lic_qa_checksum() { |