/* * vdso_test.c: Sample code to test parse_vdso.c on x86 * Copyright (c) 2011-2014 Andy Lutomirski * Subject to the GNU General Public License, version 2 * * You can amuse yourself by compiling with: * gcc -std=gnu99 -nostdlib * -Os -fno-asynchronous-unwind-tables -flto -lgcc_s * vdso_standalone_test_x86.c parse_vdso.c * to generate a small binary. On x86_64, you can omit -lgcc_s * if you want the binary to be completely standalone. */ #include #include #include #include extern void *vdso_sym(const char *version, const char *name); extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); extern void vdso_init_from_auxv(void *auxv); /* We need a libc functions... */ int strcmp(const char *a, const char *b) { /* This implementation is buggy: it never returns -1. */ while (*a || *b) { if (*a != *b) return 1; if (*a == 0 || *b == 0) return 1; a++; b++; } return 0; } /* ...and two syscalls. This is x86-specific. */ static inline long x86_syscall3(long nr, long a0, long a1, long a2) { long ret; #ifdef __x86_64__ asm volatile ("syscall" : "=a" (ret) : "a" (nr), "D" (a0), "S" (a1), "d" (a2) : "cc", "memory", "rcx", "r8", "r9", "r10", "r11" ); #else asm volatile ("int $0x80" : "=a" (ret) : "a" (nr), "b" (a0), "c" (a1), "d" (a2) : "cc", "memory" ); #endif return ret; } static inline long linux_write(int fd, const void *data, size_t len) { return x86_syscall3(__NR_write, fd, (long)data, (long)len); } static inline void linux_exit(int code) { x86_syscall3(__NR_exit, code, 0, 0); } void to_base10(char *lastdig, time_t n) { while (n) { *lastdig = (n % 10) + '0'; n /= 10; lastdig--; } } __attribute__((externally_visible)) void c_main(void **stack) { /* Parse the stack */ long argc = (long)*stack; stack += argc + 2; /* Now we're pointing at the environment. Skip it. */ while(*stack) stack++; stack++; /* Now we're pointing at auxv. Initialize the vDSO parser. */ vdso_init_from_auxv((void *)stack); /* Find gettimeofday. */ typedef long (*gtod_t)(struct timeval *tv, struct timezone *tz); gtod_t gtod = (gtod_t)vdso_sym("LINUX_2.6", "__vdso_gettimeofday"); if (!gtod) linux_exit(1); struct timeval tv; long ret = gtod(&tv, 0); if (ret == 0) { char buf[] = "The time is .000000\n"; to_base10(buf + 31, tv.tv_sec); to_base10(buf + 38, tv.tv_usec); linux_write(1, buf, sizeof(buf) - 1); } else { linux_exit(ret); } linux_exit(0); } /* * This is the real entry point. It passes the initial stack into * the C entry point. */ asm ( ".text\n" ".global _start\n" ".type _start,@function\n" "_start:\n\t" #ifdef __x86_64__ "mov %rsp,%rdi\n\t" "jmp c_main" #else "push %esp\n\t" "call c_main\n\t" "int $3" #endif ); 9cf3f'>drivers/usb/host/xhci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-09 13:22:54 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-09 13:22:54 -0800
commit55aac6ef53e114c28170ee3f79065cfa8ca9cf3f (patch)
tree7eac44b0f280f8faea96c9ff09d2f650f04e3d46 /drivers/usb/host/xhci.c
parent2b369478e1856e3809f439495567474725931585 (diff)
parentb22bc27868e8c11fe3f00937a341b44f80b50364 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target fixes from Nicholas Bellinger: "This target series for v4.10 contains fixes which address a few long-standing bugs that DATERA's QA + automation teams have uncovered while putting v4.1.y target code into production usage. We've been running the top three in our nightly automated regression runs for the last two months, and the COMPARE_AND_WRITE fix Mr. Gary Guo has been manually verifying against a four node ESX cluster this past week. Note all of them have CC' stable tags. Summary: - Fix a bug with ESX EXTENDED_COPY + SAM_STAT_RESERVATION_CONFLICT status, where target_core_xcopy.c logic was incorrectly returning SAM_STAT_CHECK_CONDITION for all non SAM_STAT_GOOD cases (Nixon Vincent) - Fix a TMR LUN_RESET hung task bug while other in-flight TMRs are being aborted, before the new one had been dispatched into tmr_wq (Rob Millner) - Fix a long standing double free OOPs, where a dynamically generated 'demo-mode' NodeACL has multiple sessions associated with it, and the /sys/kernel/config/target/$FABRIC/$WWN/ subsequently disables demo-mode, but never converts the dynamic ACL into a explicit ACL (Rob Millner) - Fix a long standing reference leak with ESX VAAI COMPARE_AND_WRITE when the second phase WRITE COMMIT command fails, resulting in CHECK_CONDITION response never being sent and se_cmd->cmd_kref never reaching zero (Gary Guo) Beyond these items on v4.1.y we've reproduced, fixed, and run through our regression test suite using iscsi-target exports, there are two additional outstanding list items: - Remove a >= v4.2 RCU conversion BUG_ON that would trigger when dynamic node NodeACLs where being converted to explicit NodeACLs. The patch drops the BUG_ON to follow how pre RCU conversion worked for this special case (Benjamin Estrabaud) - Add ibmvscsis target_core_fabric_ops->max_data_sg_nent assignment to match what IBM's Virtual SCSI hypervisor is already enforcing at transport layer. (Bryant Ly + Steven Royer)" * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: ibmvscsis: Add SGL limit target: Fix COMPARE_AND_WRITE ref leak for non GOOD status target: Fix multi-session dynamic se_node_acl double free OOPs target: Fix early transport_generic_handle_tmr abort scenario target: Use correct SCSI status during EXTENDED_COPY exception target: Don't BUG_ON during NodeACL dynamic -> explicit conversion
Diffstat (limited to 'drivers/usb/host/xhci.c')