/* * Copyright 2015, Michael Neuling, IBM Corp. * Licensed under GPLv2. * * Test the kernel's signal return code to ensure that it doesn't * crash when both the transactional and suspend MSR bits are set in * the signal context. * * For this test, we send ourselves a SIGUSR1. In the SIGUSR1 handler * we modify the signal context to set both MSR TM S and T bits (which * is "reserved" by the PowerISA). When we return from the signal * handler (implicit sigreturn), the kernel should detect reserved MSR * value and send us with a SIGSEGV. */ #include #include #include #include #include "utils.h" #include "tm.h" int segv_expected = 0; void signal_segv(int signum) { if (segv_expected && (signum == SIGSEGV)) _exit(0); _exit(1); } void signal_usr1(int signum, siginfo_t *info, void *uc) { ucontext_t *ucp = uc; /* Link tm checkpointed context to normal context */ ucp->uc_link = ucp; /* Set all TM bits so that the context is now invalid */ #ifdef __powerpc64__ ucp->uc_mcontext.gp_regs[PT_MSR] |= (7ULL << 32); #else ucp->uc_mcontext.uc_regs->gregs[PT_MSR] |= (7ULL); #endif /* Should segv on return becuase of invalid context */ segv_expected = 1; } int tm_signal_msr_resv() { struct sigaction act; SKIP_IF(!have_htm()); act.sa_sigaction = signal_usr1; sigemptyset(&act.sa_mask); act.sa_flags = SA_SIGINFO; if (sigaction(SIGUSR1, &act, NULL) < 0) { perror("sigaction sigusr1"); exit(1); } if (signal(SIGSEGV, signal_segv) == SIG_ERR) exit(1); raise(SIGUSR1); /* We shouldn't get here as we exit in the segv handler */ return 1; } int main(void) { return test_harness(tm_signal_msr_resv, "tm_signal_msr_resv"); } 365135d43f861003555c963b309672d053a2228'>refslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:44:32 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:44:32 -0800
commit3365135d43f861003555c963b309672d053a2228 (patch)
treebfef4adec5da118bf1b3df7e5cff74f45af9e02d /include/media/blackfin
parent5906374446386fd16fe562b042429d905d231ec3 (diff)
parente0d76fa4475ef2cf4b52d18588b8ce95153d021b (diff)
Merge tag 'xfs-for-linus-4.10-rc6-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs uodates from Darrick Wong: "I have some more fixes this week: better input validation, corruption avoidance, build fixes, memory leak fixes, and a couple from Christoph to avoid an ENOSPC failure. Summary: - Fix race conditions in the CoW code - Fix some incorrect input validation checks - Avoid crashing fs by running out of space when freeing inodes - Fix toctou race wrt whether or not an inode has an attr - Fix build error on arm - Fix page refcount corruption when readahead fails - Don't corrupt userspace in the bmap ioctl" * tag 'xfs-for-linus-4.10-rc6-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: prevent quotacheck from overloading inode lru xfs: fix bmv_count confusion w/ shared extents xfs: clear _XBF_PAGES from buffers when readahead page xfs: extsize hints are not unlikely in xfs_bmap_btalloc xfs: remove racy hasattr check from attr ops xfs: use per-AG reservations for the finobt xfs: only update mount/resv fields on success in __xfs_ag_resv_init xfs: verify dirblocklog correctly xfs: fix COW writeback race
Diffstat (limited to 'include/media/blackfin')