Skip to content
Snippets Groups Projects
  1. Sep 21, 2023
  2. Sep 20, 2023
  3. Sep 19, 2023
    • Mikulas Patocka's avatar
      linux-user/hppa: lock both words of function descriptor · 5b1270ef
      Mikulas Patocka authored
      
      The code in setup_rt_frame reads two words at haddr, but locks only one.
      This patch fixes it to lock both.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarHelge Deller <deller@gmx.de>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      5b1270ef
    • Mikulas Patocka's avatar
      linux-user/hppa: clear the PSW 'N' bit when delivering signals · 2529497c
      Mikulas Patocka authored
      
      qemu-hppa may crash when delivering a signal. It can be demonstrated with
      this program. Compile the program with "hppa-linux-gnu-gcc -O2 signal.c"
      and run it with "qemu-hppa -one-insn-per-tb a.out". It reports that the
      address of the flag is 0xb4 and it crashes when attempting to touch it.
      
      #include <stdio.h>
      #include <stdlib.h>
      #include <sys/time.h>
      #include <signal.h>
      
      sig_atomic_t flag;
      
      void sig(int n)
      {
      	printf("&flag: %p\n", &flag);
      	flag = 1;
      }
      
      int main(void)
      {
      	struct sigaction sa;
      	struct itimerval it;
      
      	sa.sa_handler = sig;
      	sigemptyset(&sa.sa_mask);
      	sa.sa_flags = SA_RESTART;
      	if (sigaction(SIGALRM, &sa, NULL)) perror("sigaction"), exit(1);
      
      	it.it_interval.tv_sec = 0;
      	it.it_interval.tv_usec = 100;
      	it.it_value.tv_sec = it.it_interval.tv_sec;
      	it.it_value.tv_usec = it.it_interval.tv_usec;
      
      	if (setitimer(ITIMER_REAL, &it, NULL)) perror("setitimer"), exit(1);
      
      	while (1) {
      	}
      }
      
      The reason for the crash is that the signal handling routine doesn't clear
      the 'N' flag in the PSW. If the signal interrupts a thread when the 'N'
      flag is set, the flag remains set at the beginning of the signal handler
      and the first instruction of the signal handler is skipped.
      
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Acked-by: default avatarHelge Deller <deller@gmx.de>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      2529497c
  4. Sep 11, 2023
  5. Sep 01, 2023
  6. Aug 31, 2023
  7. Aug 23, 2023
  8. Aug 09, 2023
  9. Aug 08, 2023
Loading