tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.siginfo head: 0750e58bf37a521086fdd30c98fc32b8523b1ef0 commit: 697f33da6cab848962d668e895590b3db6f232c1 [1/6] get rid of field-by-field copyout in copy_siginfo_to_user() config: mips-bmips_stb_defconfig (attached as .config) compiler: mipsel-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 697f33da6cab848962d668e895590b3db6f232c1 # save the attached .config to linux build tree make.cross ARCH=mips All warnings (new ones prefixed by >>): kernel/signal.c: In function 'copy_siginfo_to_user': >> kernel/signal.c:2708:0: warning: "END" redefined #define END(field) return copy_to_user(to, &v, OFF(field)) ? -EFAULT : 0 In file included from arch/mips/include/asm/r4kcache.h:17:0, from arch/mips/include/asm/bmips.h:48, from arch/mips/include/asm/mach-bmips/dma-coherence.h:18, from arch/mips/include/asm/dma-mapping.h:9, from include/linux/dma-mapping.h:173, from include/linux/skbuff.h:34, from kernel/audit.h:24, from kernel/signal.c:52: arch/mips/include/asm/asm.h:74:0: note: this is the location of the previous definition #define END(function) \ vim +/END +2708 kernel/signal.c 2682 2683 int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from) 2684 { 2685 struct siginfo v; 2686 int err; 2687 2688 if (from->si_code < 0) 2689 return copy_to_user(to, from, sizeof(siginfo_t)) 2690 ? -EFAULT : 0; 2691 /* 2692 * If you change siginfo_t structure, please be sure 2693 * this code is fixed accordingly. 2694 * Please remember to update the signalfd_copyinfo() function 2695 * inside fs/signalfd.c too, in case siginfo_t changes. 2696 * It should never copy any pad contained in the structure 2697 * to avoid security leaks, but must copy the generic 2698 * 3 ints plus the relevant union member. 2699 */ 2700 2701 #define OFF(field) offsetof(struct siginfo, field) + sizeof(v.field) 2702 #define COPY(field) v.field = from->field 2703 #define COMMON(field) \ 2704 memset(&v, 0, OFF(field)); \ 2705 COPY(si_signo); \ 2706 COPY(si_errno); \ 2707 v.si_code = (short)from->si_code > 2708 #define END(field) return copy_to_user(to, &v, OFF(field)) ? -EFAULT : 0 2709 2710 switch (from->si_code & __SI_MASK) { 2711 default: /* this is just in case for now ... */ 2712 case __SI_KILL: 2713 COMMON(si_uid); 2714 COPY(si_pid); 2715 COPY(si_uid); 2716 END(si_uid); 2717 case __SI_TIMER: 2718 COMMON(si_ptr); 2719 COPY(si_tid); 2720 COPY(si_overrun); 2721 COPY(si_ptr); 2722 END(si_ptr); 2723 case __SI_POLL: 2724 COMMON(si_fd); 2725 COPY(si_band); 2726 COPY(si_fd); 2727 END(si_fd); 2728 case __SI_FAULT: 2729 COMMON(si_upper); 2730 COPY(si_addr); 2731 #ifdef __ARCH_SI_TRAPNO 2732 COPY(si_trapno); 2733 #endif 2734 #ifdef BUS_MCEERR_AO 2735 /* 2736 * Other callers might not initialize the si_lsb field, 2737 * so check explicitly for the right codes here. 2738 */ 2739 if (from->si_signo == SIGBUS && 2740 (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) 2741 COPY(si_addr_lsb); 2742 #endif 2743 #ifdef SEGV_BNDERR 2744 if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) { 2745 COPY(si_lower); 2746 COPY(si_upper); 2747 } 2748 #endif 2749 #ifdef SEGV_PKUERR 2750 if (from->si_signo == SIGSEGV && from->si_code == SEGV_PKUERR) 2751 COPY(si_pkey); 2752 #endif 2753 END(si_upper); 2754 case __SI_CHLD: 2755 COMMON(si_stime); 2756 COPY(si_pid); 2757 COPY(si_uid); 2758 COPY(si_status); 2759 COPY(si_utime); 2760 COPY(si_stime); 2761 END(si_stime); 2762 case __SI_RT: /* This is not generated by the kernel as of now. */ 2763 case __SI_MESGQ: /* But this is */ 2764 COMMON(si_ptr); 2765 COPY(si_pid); 2766 COPY(si_uid); 2767 COPY(si_ptr); 2768 END(si_ptr); 2769 #ifdef __ARCH_SIGSYS 2770 case __SI_SYS: 2771 COMMON(si_arch); 2772 COPY(si_call_addr); 2773 COPY(si_syscall); 2774 COPY(si_arch); 2775 END(si_arch); 2776 #endif 2777 } 2778 return err; 2779 #undef COMMON 2780 #undef END 2781 #undef COPY 2782 #undef OFF 2783 } 2784 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip