Linux 3.16.43
I'm announcing the release of the 3.16.43 kernel.
All users of the 3.16 kernel series should upgrade.
The updated 3.16.y git tree can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.16.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git
The diff from 3.16.42 is attached to this message.
Ben.
------------
Documentation/networking/netlink_mmap.txt | 339 -------------- Makefile | 2 +- arch/mips/Makefile | 9 + arch/mips/include/asm/asmmacro-32.h | 6 + arch/mips/include/asm/asmmacro.h | 129 +++++- arch/mips/include/asm/fpregdef.h | 14 + arch/mips/include/asm/fpu.h | 15 +- arch/mips/include/asm/mipsregs.h | 26 +- arch/mips/include/asm/msa.h | 23 +- arch/mips/include/asm/uaccess.h | 5 +- arch/mips/kernel/asm-offsets.c | 1 + arch/mips/kernel/branch.c | 8 +- arch/mips/kernel/genex.S | 1 + arch/mips/kernel/r2300_fpu.S | 6 + arch/mips/kernel/r2300_switch.S | 5 + arch/mips/kernel/r4k_fpu.S | 29 +- arch/mips/kernel/r4k_switch.S | 24 +- arch/mips/kernel/r6000_fpu.S | 5 + arch/mips/kernel/traps.c | 39 +- arch/mips/math-emu/cp1emu.c | 6 +- arch/mips/ralink/prom.c | 9 +- crypto/Makefile | 2 + drivers/atm/iphase.c | 2 +- drivers/hid/hid-input.c | 2 +- drivers/mmc/host/sunxi-mmc.c | 5 +- drivers/tty/serial/samsung.c | 4 +- fs/aio.c | 1 + fs/compat.c | 10 +- fs/exec.c | 10 +- fs/internal.h | 2 +- fs/namespace.c | 26 +- fs/nfs/nfs4proc.c | 11 +- fs/open.c | 2 +- fs/proc/root.c | 2 +- fs/sysfs/mount.c | 3 +- include/linux/blkdev.h | 2 +- include/linux/fs.h | 3 + include/uapi/linux/netlink.h | 4 + include/uapi/linux/netlink_diag.h | 2 + kernel/sys.c | 3 +- mm/mmap.c | 4 +- mm/nommu.c | 2 +- net/netlink/Kconfig | 9 - net/netlink/af_netlink.c | 738 +----------------------------- net/netlink/af_netlink.h | 15 - net/netlink/diag.c | 39 -- security/keys/keyring.c | 6 +- security/security.c | 2 +- 48 files changed, 366 insertions(+), 1246 deletions(-)
Andre Przywara (1):
fs/nfs: fix new compiler warning about boolean in switch
Arnd Bergmann (2):
crypto: improve gcc optimization flags for serpent and wp512
mmc: sunxi: avoid invalid pointer calculation
Ben Hutchings (2):
keys: Guard against null match function in keyring_search_aux() Linux 3.16.43
Eric W. Biederman (1):
vfs: Commit to never having exectuables on proc and sysfs.
Fabio Estevam (1):
serial: samsung: Use %pa to print 'resource_size_t' type
Florian Westphal (1):
netlink: remove mmapped netlink support
James C Boyd (1):
HID: hid-input: Add parentheses to quell gcc warning
James Hogan (2):
MIPS: mipsregs.h: Add write_32bit_cp1_register()
MIPS: traps: Fix inline asm ctc1 missing .set hardfloat
Jann Horn (1):
aio: mark AIO pseudo-fs noexec
John Crispin (1):
MIPS: ralink: Cosmetic change to prom_init().
Linus Torvalds (1):
blk: rq_data_dir() should not return a boolean
Manuel Lauss (1):
MIPS: Fix build with binutils 2.24.51+
Paul Burton (9):
MIPS: allow msa.h to be included in assembly files
MIPS: save/restore MSACSR register on context switch
MIPS: preserve scalar FP CSR when switching vector context
MIPS: save/disable MSA in lose_fpu
MIPS: init upper 64b of vector registers when MSA is first used
MIPS: Push .set mips64r* into the functions needing it
MIPS: assume at as source/dest of MSA copy/insert instructions
MIPS: remove MSA macro recursion
MIPS: wrap cfcmsa & ctcmsa accesses for toolchains with MSA support
Ralf Baechle (1):
MIPS: Zero variable read by get_user / __get_user in case of an error.
Tillmann Heidsieck (1):
atm: iphase: fix misleading indention
Tim Gardner (1):
fs: namespace: suppress 'may be used uninitialized' warnings
Documentation/networking/netlink_mmap.txt deleted +0 -339
@@ -1,339 +0,0 @@ -This file documents how to use memory mapped I/O with netlink. - -Author: Patrick McHardy <[email protected]> - -Overview --------- - -Memory mapped netlink I/O can be used to increase throughput and decrease -overhead of unicast receive and transmit operations. Some netlink subsystems -require high throughput, these are mainly the netfilter subsystems -nfnetlink_queue and nfnetlink_log, but it can also help speed up large -dump operations of f.i. the routing database. - -Memory mapped netlink I/O used two circular ring buffers for RX and TX which -are mapped into the processes address space. - -The RX ring is used by the kernel to directly construct netlink messages into -user-space memory without copying them as done with regular socket I/O, -additionally as long as the ring contains messages no recvmsg() or poll() -syscalls have to be issued by user-space to get more message. - -The TX ring is used to process messages directly from user-space memory, the -kernel processes all messages contained in the ring using a single sendmsg() -call. - -Usage overview --------------- - -In order to use memory mapped netlink I/O, user-space needs three main changes: - -- ring setup -- conversion of the RX path to get messages from the ring instead of recvmsg() -- conversion of the TX path to construct messages into the ring - -Ring setup is done using setsockopt() to provide the ring parameters to the -kernel, then a call to mmap() to map the ring into the processes address space: - -- setsockopt(fd, SOL_NETLINK, NETLINK_RX_RING, ¶ms, sizeof(params)); -- setsockopt(fd, SOL_NETLINK, NETLINK_TX_RING, ¶ms, sizeof(params)); -- ring = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0) - -Usage of either ring is optional, but even if only the RX ring is used the -mapping still needs to be writable in order to update the frame status after -processing. - -Conversion of the reception path involves calling poll() on the file -descriptor, once the socket is readable the frames from the ring are -processed in order until no more messages are available, as indicated by -a status word in the frame header. - -On kernel side, in order to make use of memory mapped I/O on receive, the -originating netlink subsystem needs to support memory mapped I/O, otherwise -it will use an allocated socket buffer as usual and the contents will be - copied to the ring on transmission, nullifying most of the performance gains. -Dumps of kernel databases automatically support memory mapped I/O. - -Conversion of the transmit path involves changing message construction to -use memory from the TX ring instead of (usually) a buffer declared on the -stack and setting up the frame header appropriately. Optionally poll() can -be used to wait for free frames in the TX ring. - -Structured and definitions for using memory mapped I/O are contained in -<linux/netlink.h>. - -RX and TX rings ----------------- - -Each ring contains a number of continuous memory blocks, containing frames of -fixed size dependent on the parameters used for ring setup. - -Ring: [ block 0 ] - [ frame 0 ] - [ frame 1 ] - [ block 1 ] - [ frame 2 ] - [ frame 3 ] - ... - [ block n ] - [ frame 2 * n ] - [ frame 2 * n + 1 ] - -The blocks are only visible to the kernel, from the point of view of user-space -the ring just contains the frames in a continuous memory zone. - -The ring parameters used for setting up the ring are defined as follows: - -struct nl_mmap_req { - unsigned int nm_block_size; - unsigned int nm_block_nr; - unsigned int nm_frame_size; - unsigned int nm_frame_nr; -}; - -Frames are grouped into blocks, where each block is a continuous region of memory -and holds nm_block_size / nm_frame_size frames. The total number of frames in -the ring is nm_frame_nr. The following invariants hold: - -- frames_per_block = nm_block_size / nm_frame_size - -- nm_frame_nr = frames_per_block * nm_block_nr - -Some parameters are constrained, specifically: - -- nm_block_size must be a multiple of the architectures memory page size. - The getpagesize() function can be used to get the page size. - -- nm_frame_size must be equal or larger to NL_MMAP_HDRLEN, IOW a frame must be - able to hold at least the frame header - -- nm_frame_size must be smaller or equal to nm_block_size - -- nm_frame_size must be a multiple of NL_MMAP_MSG_ALIGNMENT - -- nm_frame_nr must equal the actual number of frames as specified above. - -When the kernel can't allocate physically continuous memory for a ring block, -it will fall back to use physically discontinuous memory. This might affect -performance negatively, in order to avoid this the nm_frame_size parameter -should be chosen to be as small as possible for the required frame size and -the number of blocks should be increased instead. - -Ring frames ------------- - -Each frames contain a frame header, consisting of a synchronization word and some -meta-data, and the message itself. - -Frame: [ header message ] - -The frame header is defined as follows: - -struct nl_mmap_hdr { - unsigned int nm_status; - unsigned int nm_len; - __u32 nm_group; - /* credentials */ - __u32 nm_pid; - __u32 nm_uid; - __u32 nm_gid; -}; - -- nm_status is used for synchronizing processing between the kernel and user- - space and specifies ownership of the frame as well as the operation to perform - -- nm_len contains the length of the message contained in the data area - -- nm_group specified the destination multicast group of message - -- nm_pid, nm_uid and nm_gid contain the netlink pid, UID and GID of the sending - process. These values correspond to the data available using SOCK_PASSCRED in - the SCM_CREDENTIALS cmsg. - -The possible values in the status word are: - -- NL_MMAP_STATUS_UNUSED: - RX ring: frame belongs to the kernel and contains no message - for user-space. Approriate action is to invoke poll() - to wait for new messages. - - TX ring: frame belongs to user-space and can be used for - message construction. - -- NL_MMAP_STATUS_RESERVED: - RX ring only: frame is currently used by the kernel for message - construction and contains no valid message yet. - Appropriate action is to invoke poll() to wait for - new messages. - -- NL_MMAP_STATUS_VALID: - RX ring: frame contains a valid message. Approriate action is - to process the message and release the frame back to - the kernel by setting the status to - NL_MMAP_STATUS_UNUSED or queue the frame by setting the - status to NL_MMAP_STATUS_SKIP. - - TX ring: the frame contains a valid message from user-space to - be processed by the kernel. After completing processing - the kernel will release the frame back to user-space by - setting the status to NL_MMAP_STATUS_UNUSED. - -- NL_MMAP_STATUS_COPY: - RX ring only: a message is ready to be processed but could not be - stored in the ring, either because it exceeded the - frame size or because the originating subsystem does - not support memory mapped I/O. Appropriate action is - to invoke recvmsg() to receive the message and release - the frame back to the kernel by setting the status to - NL_MMAP_STATUS_UNUSED. - -- NL_MMAP_STATUS_SKIP: - RX ring only: user-space queued the message for later processing, but - processed some messages following it in the ring. The - kernel should skip this frame when looking for unused - frames. - -The data area of a frame begins at a offset of NL_MMAP_HDRLEN relative to the -frame header. - -TX limitations --------------- - -Kernel processing usually involves validation of the message received by -user-space, then processing its contents. The kernel must assure that -userspace is not able to modify the message contents after they have been -validated. In order to do so, the message is copied from the ring frame -to an allocated buffer if either of these conditions is false: - -- only a single mapping of the ring exists -- the file descriptor is not shared between processes - -This means that for threaded programs, the kernel will fall back to copying. - -Example -------- - -Ring setup: - - unsigned int block_size = 16 * getpagesize(); - struct nl_mmap_req req = { - .nm_block_size = block_size, - .nm_block_nr = 64, - .nm_frame_size = 16384, - .nm_frame_nr = 64 * block_size / 16384, - }; - unsigned int ring_size; - void *rx_ring, *tx_ring; - - /* Configure ring parameters */ - if (setsockopt(fd, SOL_NETLINK, NETLINK_RX_RING, &req, sizeof(req)) < 0) - exit(1); - if (setsockopt(fd, SOL_NETLINK, NETLINK_TX_RING, &req, sizeof(req)) < 0) - exit(1) - - /* Calculate size of each individual ring */ - ring_size = req.nm_block_nr * req.nm_block_size; - - /* Map RX/TX rings. The TX ring is located after the RX ring */ - rx_ring = mmap(NULL, 2 * ring_size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, 0); - if ((long)rx_ring == -1L) - exit(1); - tx_ring = rx_ring + ring_size: - -Message reception: - -This example assumes some ring parameters of the ring setup are available. - - unsigned int frame_offset = 0; - struct nl_mmap_hdr *hdr; - struct nlmsghdr *nlh; - unsigned char buf[16384]; - ssize_t len; - - while (1) { - struct pollfd pfds[1]; - - pfds[0].fd = fd; - pfds[0].events = POLLIN | POLLERR; - pfds[0].revents = 0; - - if (poll(pfds, 1, -1) < 0 && errno != -EINTR) - exit(1); - - /* Check for errors. Error handling omitted */ - if (pfds[0].revents & POLLERR) - <handle error> - - /* If no new messages, poll again */ - if (!(pfds[0].revents & POLLIN)) - continue; - - /* Process all frames */ - while (1) { - /* Get next frame header */ - hdr = rx_ring + frame_offset; - - if (hdr->nm_status == NL_MMAP_STATUS_VALID) { - /* Regular memory mapped frame */ - nlh = (void *)hdr + NL_MMAP_HDRLEN; - len = hdr->nm_len; - - /* Release empty message immediately. May happen - * on error during message construction. - */ - if (len == 0) - goto release; - } else if (hdr->nm_status == NL_MMAP_STATUS_COPY) { - /* Frame queued to socket receive queue */ - len = recv(fd, buf, sizeof(buf), MSG_DONTWAIT); - if (len <= 0) - break; - nlh = buf; - } else - /* No more messages to process, continue polling */ - break; - - process_msg(nlh); -release: - /* Release frame back to the kernel */ - hdr->nm_status = NL_MMAP_STATUS_UNUSED; - - /* Advance frame offset to next frame */ - frame_offset = (frame_offset + frame_size) % ring_size; - } - } - -Message transmission: - -This example assumes some ring parameters of the ring setup are available. -A single message is constructed and transmitted, to send multiple messages -at once they would be constructed in consecutive frames before a final call -to sendto(). - - unsigned int frame_offset = 0; - struct nl_mmap_hdr *hdr; - struct nlmsghdr *nlh; - struct sockaddr_nl addr = { - .nl_family = AF_NETLINK, - }; - - hdr = tx_ring + frame_offset; - if (hdr->nm_status != NL_MMAP_STATUS_UNUSED) - /* No frame available. Use poll() to avoid. */ - exit(1); - - nlh = (void *)hdr + NL_MMAP_HDRLEN; - - /* Build message */ - build_message(nlh); - - /* Fill frame header: length and status need to be set */ - hdr->nm_len = nlh->nlmsg_len; - hdr->nm_status = NL_MMAP_STATUS_VALID; - - if (sendto(fd, NULL, 0, 0, &addr, sizeof(addr)) < 0) - exit(1); - - /* Advance frame offset to next frame */ - frame_offset = (frame_offset + frame_size) % ring_size;
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 16 -SUBLEVEL = 42 +SUBLEVEL = 43 EXTRAVERSION = NAME = Museum of Fishiegoodies
arch/mips/Makefile +9 -0
@@ -93,6 +93,15 @@ LDFLAGS_vmlinux += -G 0 -static -n -nostdlib KBUILD_AFLAGS_MODULE += -mlong-calls KBUILD_CFLAGS_MODULE += -mlong-calls +# +# pass -msoft-float to GAS if it supports it. However on newer binutils +# (specifically newer than 2.24.51.20140728) we then also need to explicitly +# set ".set hardfloat" in all files which manipulate floating point registers. +# +ifneq ($(call as-option,-Wa$(comma)-msoft-float,),) + cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float +endif + cflags-y += -ffreestanding #
arch/mips/include/asm/asmmacro-32.h +6 -0
@@ -13,6 +13,8 @@#include <asm/mipsregs.h> .macro fpu_save_single thread tmp=t0 + .set push +SET_HARDFLOAT cfc1 \tmp, fcr31 swc1 $f0, THREAD_FPR0_LS64(\thread) swc1 $f1, THREAD_FPR1_LS64(\thread)
@@ -47,9 +49,12 @@ swc1 $f30, THREAD_FPR30_LS64(\thread) swc1 $f31, THREAD_FPR31_LS64(\thread) sw \tmp, THREAD_FCR31(\thread) + .set pop .endm .macro fpu_restore_single thread tmp=t0 + .set push +SET_HARDFLOAT lw \tmp, THREAD_FCR31(\thread) lwc1 $f0, THREAD_FPR0_LS64(\thread) lwc1 $f1, THREAD_FPR1_LS64(\thread)
@@ -84,6 +89,7 @@ lwc1 $f30, THREAD_FPR30_LS64(\thread) lwc1 $f31, THREAD_FPR31_LS64(\thread) ctc1 \tmp, fcr31 + .set pop .endm .macro cpu_save_nonscratch thread
arch/mips/include/asm/asmmacro.h +107 -22
265 lines not on this page · raw message
arch/mips/include/asm/fpregdef.h +14 -0
@@ -14,6 +14,20 @@#include <asm/sgidefs.h> +/* +* starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing +* hardfloat and softfloat object files. The kernel build uses soft-float by +* default, so we also need to pass -msoft-float along to GAS if it supports it. +* But this in turn causes assembler errors in files which access hardfloat +* registers. We detect if GAS supports "-msoft-float" in the Makefile and +* explicitly put ".set hardfloat" where floating point registers are touched. +*/ +#ifdef GAS_HAS_SET_HARDFLOAT +#define SET_HARDFLOAT .set hardfloat +#else +#define SET_HARDFLOAT +#endif +#if _MIPS_SIM == _MIPS_SIM_ABI32/*
arch/mips/include/asm/fpu.h +12 -3
@@ -21,6 +21,7 @@#include <asm/hazards.h> #include <asm/processor.h> #include <asm/current.h> +#include <asm/msa.h> #ifdef CONFIG_MIPS_MT_FPAFF #include <asm/mips_mt.h>
@@ -141,13 +142,21 @@ static inline int own_fpu(int restore)static inline void lose_fpu (int save) {preempt_disable (); -if (is_fpu_owner ()) { +if (is_msa_enabled ()) { +if (save) { +save_msa (current); + current->thread.fpu.fcr31 = +read_32bit_cp1_register (CP1_STATUS ); + } +disable_msa (); +clear_thread_flag (TIF_USEDMSA ); + }else if (is_fpu_owner ()) {if (save)_save_fp (current); -KSTK_STATUS (current) &= ~ST0_CU1 ; -clear_thread_flag (TIF_USEDFPU );__disable_fpu (); } +KSTK_STATUS (current) &= ~ST0_CU1 ; +clear_thread_flag (TIF_USEDFPU );preempt_enable (); }
arch/mips/include/asm/mipsregs.h +25 -1
@@ -1270,7 +1270,7 @@ do { \/* * Macros to access the floating point coprocessor control registers */ -#define read_32bit_cp1_register (source) \ +#define _read_32bit_cp1_register (source, gas_hardfloat) \ ({ \ int __res; \ \
@@ -1280,12 +1280,36 @@ do { \" # gas fails to assemble cfc1 for some archs, \n" \" # like Octeon. \n" \" .set mips1 \n" \ + " "STR(gas_hardfloat)" \n" \ " cfc1 %0,"STR(source)" \n" \ " .set pop \n" \ : "=r" (__res)); \ __res; \ }) +#define _write_32bit_cp1_register (dest, val, gas_hardfloat) \ +do { \ + __asm__ __volatile__( \ + " .set push \n" \ + " .set reorder \n" \ + " "STR(gas_hardfloat)" \n" \ + " ctc1 %0,"STR(dest)" \n" \ + " .set pop \n" \ + : : "r" (val)); \ +} while (0) + +#ifdef GAS_HAS_SET_HARDFLOAT +#define read_32bit_cp1_register (source) \ + _read_32bit_cp1_register(source, .set hardfloat) +#define write_32bit_cp1_register (dest, val) \ + _write_32bit_cp1_register(dest, val, .set hardfloat) +#else +#define read_32bit_cp1_register (source) \ + _read_32bit_cp1_register(source, ) +#define write_32bit_cp1_register (dest, val) \ + _write_32bit_cp1_register(dest, val, ) +#endif +#ifdef HAVE_AS_DSP #define rddsp (mask) \ ({ \
arch/mips/include/asm/msa.h +14 -9
@@ -12,8 +12,11 @@#include <asm/mipsregs.h> +#ifndef __ASSEMBLY__ +extern void _save_msa (struct task_struct *);extern void _restore_msa (struct task_struct *); +extern void _init_msa_upper (void );static inline void enable_msa (void ) {
@@ -133,15 +136,6 @@ static inline void write_msa_##name(unsigned int val) \#endif /* !TOOLCHAIN_SUPPORTS_MSA */ -#define MSA_IR 0 -#define MSA_CSR 1 -#define MSA_ACCESS 2 -#define MSA_SAVE 3 -#define MSA_MODIFY 4 -#define MSA_REQUEST 5 -#define MSA_MAP 6 -#define MSA_UNMAP 7 - __BUILD_MSA_CTL_REG(ir, 0) __BUILD_MSA_CTL_REG(csr, 1)__BUILD_MSA_CTL_REG (access,2 )
@@ -151,6 +145,17 @@ __BUILD_MSA_CTL_REG(request, 5) __BUILD_MSA_CTL_REG(map, 6) __BUILD_MSA_CTL_REG(unmap, 7) +#endif /* !__ASSEMBLY__ */ + +#define MSA_IR 0 +#define MSA_CSR 1 +#define MSA_ACCESS 2 +#define MSA_SAVE 3 +#define MSA_MODIFY 4 +#define MSA_REQUEST 5 +#define MSA_MAP 6 +#define MSA_UNMAP 7 +/* MSA Implementation Register (MSAIR) */ #define MSA_IR_REVB 0#define MSA_IR_REVF (_ULCAST_(0xff) << MSA_IR_REVB)
arch/mips/include/asm/uaccess.h +4 -1
@@ -302,7 +302,8 @@ do { \__get_kernel_common ((x), size, __gu_ptr); \ else \ __get_user_common((x), size, __gu_ptr); \ - } \ + }else \ + (x) =0 ; \ \ __gu_err; \ })
@@ -317,6 +318,7 @@ do { \" .insn \n" \" .section .fixup,\"ax\" \n" \"3: li %0, %4 \n" \ +" move %1, $0 \n" \" j 2b \n" \" .previous \n" \" .section __ex_table,\"a\" \n" \
@@ -631,6 +633,7 @@ do { \" .insn \n" \" .section .fixup,\"ax\" \n" \"3: li %0, %4 \n" \ +" move %1, $0 \n" \" j 2b \n" \" .previous \n" \" .section __ex_table,\"a\" \n" \
arch/mips/kernel/asm-offsets.c +1 -0
@@ -234,6 +234,7 @@ void output_thread_fpu_defines(void) thread.fpu.fpr[31].val64[FPR_IDX(64, 0)]);OFFSET (THREAD_FCR31 , task_struct, thread.fpu.fcr31); +OFFSET (THREAD_MSA_CSR , task_struct, thread.fpu.msacsr);BLANK (); }
arch/mips/kernel/branch.c +2 -6
@@ -144,7 +144,7 @@ int __mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,case mm_bc1t_op:preempt_disable ();if (is_fpu_owner ()) - asmvolatile ("cfc1\t%0,$31" :"=r" (fcr31)); + fcr31 =read_32bit_cp1_register (CP1_STATUS );else fcr31 = current->thread.fpu.fcr31;preempt_enable ();
@@ -562,11 +562,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,case cop1_op:preempt_disable ();if (is_fpu_owner ()) - asmvolatile ( -".set push\n" -"\t.set mips1\n" -"\tcfc1\t%0,$31\n" -"\t.set pop" :"=r" (fcr31)); + fcr31 =read_32bit_cp1_register (CP1_STATUS );else fcr31 = current->thread.fpu.fcr31;preempt_enable ();
arch/mips/kernel/genex.S +1 -0
@@ -358,6 +358,7 @@ NESTED(nmi_handler, PT_SIZE, sp) .set push /* gas fails to assemble cfc1 for some archs (octeon).*/ \ .set mips1 + SET_HARDFLOAT cfc1 a1, fcr31 li a2, ~(0x3f << 12) and a2, a1
arch/mips/kernel/r2300_fpu.S +6 -0
@@ -28,6 +28,8 @@ .set mips1 /* Save floating point context */ LEAF(_save_fp_context) + .set push + SET_HARDFLOAT li v0, 0 # assume success cfc1 t1,fcr31 EX(swc1 $f0,(SC_FPREGS+0)(a0))
@@ -65,6 +67,7 @@ LEAF(_save_fp_context) EX(sw t1,(SC_FPC_CSR)(a0)) cfc1 t0,$0 # implementation/version jr ra + .set pop .set nomacro EX(sw t0,(SC_FPC_EIR)(a0)) .set macro
@@ -80,6 +83,8 @@ LEAF(_save_fp_context) * stack frame which might have been changed by the user. */ LEAF(_restore_fp_context) + .set push + SET_HARDFLOAT li v0, 0 # assume success EX(lw t0,(SC_FPC_CSR)(a0)) EX(lwc1 $f0,(SC_FPREGS+0)(a0))
@@ -116,6 +121,7 @@ LEAF(_restore_fp_context) EX(lwc1 $f31,(SC_FPREGS+248)(a0)) jr ra ctc1 t0,fcr31 + .set pop END(_restore_fp_context) .set reorder
arch/mips/kernel/r2300_switch.S +5 -0
@@ -120,6 +120,9 @@ LEAF(_restore_fp) #define FPU_DEFAULT 0x00000000 + .set push + SET_HARDFLOAT + LEAF(_init_fpu) mfc0 t0, CP0_STATUS li t1, ST0_CU1
@@ -165,3 +168,5 @@ LEAF(_init_fpu) mtc1 t0, $f31 jr ra END(_init_fpu) + + .set pop
arch/mips/kernel/r4k_fpu.S +26 -3
@@ -19,8 +19,12 @@ #include <asm/asm-offsets.h> #include <asm/regdef.h> +/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ +#undef fp + .macro EX insn, reg, src .set push + SET_HARDFLOAT .set nomacro .ex\@: \insn \reg, \src .set pop
@@ -30,15 +34,19 @@ .endm .set noreorder - .set arch=r4000 LEAF(_save_fp_context) + .set push + SET_HARDFLOAT cfc1 t1, fcr31 + .set pop #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) .set push + SET_HARDFLOAT #ifdef CONFIG_CPU_MIPS32_R2 - .set mips64r2 + .set mips32r2 + .set fp=64 mfc0 t0, CP0_STATUS sll t0, t0, 5 bgez t0, 1f # skip storing odd if FR=0
@@ -64,6 +72,8 @@ LEAF(_save_fp_context) 1: .set pop #endif + .set push + SET_HARDFLOAT /* Store the 16 even double precision registers */ EX sdc1 $f0, SC_FPREGS+0(a0) EX sdc1 $f2, SC_FPREGS+16(a0)
@@ -84,11 +94,15 @@ LEAF(_save_fp_context) EX sw t1, SC_FPC_CSR(a0) jr ra li v0, 0 # success + .set pop END(_save_fp_context) #ifdef CONFIG_MIPS32_COMPAT /* Save 32-bit process floating point context */ LEAF(_save_fp_context32) + .set push + .set arch=r4000 + SET_HARDFLOAT cfc1 t1, fcr31 mfc0 t0, CP0_STATUS
@@ -134,6 +148,7 @@ LEAF(_save_fp_context32) EX sw t1, SC32_FPC_CSR(a0) cfc1 t0, $0 # implementation/version EX sw t0, SC32_FPC_EIR(a0) + .set pop jr ra li v0, 0 # success
@@ -150,8 +165,10 @@ LEAF(_restore_fp_context) #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) .set push + SET_HARDFLOAT #ifdef CONFIG_CPU_MIPS32_R2 - .set mips64r2 + .set mips32r2 + .set fp=64 mfc0 t0, CP0_STATUS sll t0, t0, 5 bgez t0, 1f # skip loading odd if FR=0
@@ -175,6 +192,8 @@ LEAF(_restore_fp_context) EX ldc1 $f31, SC_FPREGS+248(a0) 1: .set pop #endif + .set push + SET_HARDFLOAT EX ldc1 $f0, SC_FPREGS+0(a0) EX ldc1 $f2, SC_FPREGS+16(a0) EX ldc1 $f4, SC_FPREGS+32(a0)
@@ -192,6 +211,7 @@ LEAF(_restore_fp_context) EX ldc1 $f28, SC_FPREGS+224(a0) EX ldc1 $f30, SC_FPREGS+240(a0) ctc1 t1, fcr31 + .set pop jr ra li v0, 0 # success END(_restore_fp_context)
@@ -199,6 +219,8 @@ LEAF(_restore_fp_context) #ifdef CONFIG_MIPS32_COMPAT LEAF(_restore_fp_context32) /* Restore an o32 sigcontext. */ + .set push + SET_HARDFLOAT EX lw t1, SC32_FPC_CSR(a0) mfc0 t0, CP0_STATUS
@@ -242,6 +264,7 @@ LEAF(_restore_fp_context32) ctc1 t1, fcr31 jr ra li v0, 0 # success + .set pop END(_restore_fp_context32) #endif
arch/mips/kernel/r4k_switch.S +22 -2
@@ -22,6 +22,9 @@ #include <asm/asmmacro.h> +/* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ +#undef fp + /* * Offset to the current process status flags, the first 32 bytes of the * stack are not used.
@@ -64,8 +67,14 @@ /* Check whether we're saving scalar or vector context. */ bgtz a3, 1f - /* Save 128b MSA vector context. */ + /* Save 128b MSA vector context + scalar FP control & status. */ + .set push + SET_HARDFLOAT + cfc1 t1, fcr31 msa_save_all a0 + .set pop /* SET_HARDFLOAT */ + + sw t1, THREAD_FCR31(a0) b 2f 1: /* Save 32b/64b scalar FP context. */
@@ -142,6 +151,11 @@ LEAF(_restore_msa) jr ra END(_restore_msa) +LEAF(_init_msa_upper) + msa_init_all_upper + jr ra + END(_init_msa_upper) + #endif /*
@@ -154,6 +168,9 @@ LEAF(_restore_msa) #define FPU_DEFAULT 0x00000000 + .set push + SET_HARDFLOAT + LEAF(_init_fpu) mfc0 t0, CP0_STATUS li t1, ST0_CU1
@@ -225,7 +242,8 @@ LEAF(_init_fpu) #ifdef CONFIG_CPU_MIPS32_R2 .set push - .set mips64r2 + .set mips32r2 + .set fp=64 sll t0, t0, 5 # is Status.FR set? bgez t0, 1f # no: skip setting upper 32b
@@ -284,3 +302,5 @@ LEAF(_init_fpu) #endif jr ra END(_init_fpu) + + .set pop /* SET_HARDFLOAT */
arch/mips/kernel/r6000_fpu.S +5 -0
@@ -18,6 +18,9 @@ .set noreorder .set mips2 + .set push + SET_HARDFLOAT + /* Save floating point context */ LEAF(_save_fp_context) mfc0 t0,CP0_STATUS
@@ -85,3 +88,5 @@ 1: jr ra nop END(_restore_fp_context) + + .set pop /* SET_HARDFLOAT */
arch/mips/kernel/traps.c +33 -6
@@ -1094,13 +1094,15 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,static int enable_restore_fp_context (int msa) { -int err, was_fpu_owner; +int err, was_fpu_owner, prior_msa;if (!used_math ()) {/* First time FP context user. */ err =init_fpu (); -if (msa && !err) +if (msa && !err) {enable_msa (); +_init_msa_upper (); + }if (!err)set_used_math ();return err;
@@ -1152,13 +1154,38 @@ static int enable_restore_fp_context(int msa)/* * If this is the first time that the task is using MSA and it has * previously used scalar FP in this time slice then we already nave -* FP context which we shouldn't clobber. +* FP context which we shouldn't clobber. We do however need to clear +* the upper 64b of each vector register so that this task has no +* opportunity to see data left behind by another. */ -if (!test_and_set_thread_flag (TIF_MSA_CTX_LIVE ) && was_fpu_owner) + prior_msa =test_and_set_thread_flag (TIF_MSA_CTX_LIVE ); +if (!prior_msa && was_fpu_owner) { +_init_msa_upper ();return 0 ; + } + +if (!prior_msa) { +/* +* Restore the least significant 64b of each vector register +* from the existing scalar FP context. +*/ +_restore_fp (current); -/* We need to restore the vector context. */ -restore_msa (current); +/* +* The task has not formerly used MSA, so clear the upper 64b +* of each vector register such that it cannot see data left +* behind by another task. +*/ +_init_msa_upper (); + }else { +/* We need to restore the vector context. */ +restore_msa (current); + +/* Restore the scalar FP control & status register */ +if (!was_fpu_owner) +write_32bit_cp1_register (CP1_STATUS , + current->thread.fpu.fcr31); + }return 0 ; }
arch/mips/math-emu/cp1emu.c +1 -5
@@ -586,11 +586,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,if (insn.i_format.rs == bc_op) {preempt_disable ();if (is_fpu_owner ()) - asmvolatile ( -".set push\n" -"\t.set mips1\n" -"\tcfc1\t%0,$31\n" -"\t.set pop" :"=r" (fcr31)); + fcr31 =read_32bit_cp1_register (CP1_STATUS );else fcr31 = current->thread.fpu.fcr31;preempt_enable ();
arch/mips/ralink/prom.c +4 -5
@@ -24,8 +24,10 @@ const char *get_system_type(void)return soc_info.sys_type; } -static __init void prom_init_cmdline (int argc,char **argv) +static __init void prom_init_cmdline (void ) { +int argc; +char **argv;int i; pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
@@ -54,14 +56,11 @@ static __init void prom_init_cmdline(int argc, char **argv)void __init prom_init (void ) { -int argc; -char **argv; -prom_soc_init (&soc_info);pr_info ("SoC Type: %s\n" ,get_system_type ()); -prom_init_cmdline (argc, argv); +prom_init_cmdline (); }void __init prom_free_prom_memory (void )
crypto/Makefile +2 -0
@@ -47,6 +47,7 @@ obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o obj-$(CONFIG_CRYPTO_WP512) += wp512.o +CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o obj-$(CONFIG_CRYPTO_ECB) += ecb.o
@@ -67,6 +68,7 @@ obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o +CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149 obj-$(CONFIG_CRYPTO_AES) += aes_generic.o obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
drivers/atm/iphase.c +1 -1
@@ -1175,7 +1175,7 @@ static int rx_pkt(struct atm_dev *dev)if (!(skb =atm_alloc_charge (vcc, len,GFP_ATOMIC ))) {if (vcc->vci <32 )printk ("Drop control packets\n" ); - goto out_free_desc; + goto out_free_desc; }skb_put (skb,len);// pwang_test
drivers/hid/hid-input.c +1 -1
@@ -1119,7 +1119,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, structreturn ;/* report the usage code as scancode if the key status has changed */ -if (usage->type ==EV_KEY && !!test_bit (usage->code, input->key) != value) +if (usage->type ==EV_KEY && (!!test_bit (usage->code, input->key)) != value)input_event (input,EV_MSC ,MSC_SCAN , usage->hid);input_event (input, usage->type, usage->code, value);
drivers/mmc/host/sunxi-mmc.c +3 -2
@@ -294,7 +294,7 @@ static void sunxi_mmc_init_idma_des(struct sunxi_mmc_host *host, struct mmc_data *data) {struct sunxi_idma_des *pdes = (struct sunxi_idma_des *)host->sg_cpu; -struct sunxi_idma_des *pdes_pa = (struct sunxi_idma_des *)host->sg_dma; +dma_addr_t next_desc = host->sg_dma;int i, max_len = (1 << host->idma_des_size_bits);for (i =0 ; i < data->sg_len; i++) {
@@ -306,8 +306,9 @@ static void sunxi_mmc_init_idma_des(struct sunxi_mmc_host *host,else pdes[i].buf_size = data->sg[i].length; + next_desc +=sizeof (struct sunxi_idma_des ); pdes[i].buf_addr_ptr1 =sg_dma_address (&data->sg[i]); - pdes[i].buf_addr_ptr2 = (u32)&pdes_pa[i +1 ]; + pdes[i].buf_addr_ptr2 = (u32 )next_desc; } pdes[0 ].config |=SDXC_IDMAC_DES0_FD ;
drivers/tty/serial/samsung.c +2 -2
@@ -1231,8 +1231,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,wr_regl (port,S3C64XX_UINTSP ,0xf ); } -dbg ("port: map=%08x, mem=%p, irq=%d (%d,%d), clock=%u\n" , - port->mapbase, port->membase, port->irq, +dbg ("port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n" , + &port->mapbase, port->membase, port->irq, ourport->rx_irq, ourport->tx_irq, port->uartclk);/* reset the fifos (and setup the uart) */
fs/aio.c +1 -0
@@ -226,6 +226,7 @@ static int __init aio_setup(void) .name = "aio", .mount = aio_mount, .kill_sb = kill_anon_super, + .fs_flags = FS_NOEXEC, }; aio_mnt =kern_mount (&aio_fs);if (IS_ERR (aio_mnt))
fs/compat.c +6 -4
@@ -797,8 +797,9 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,struct filename *dir;int retval; - retval =copy_mount_string (type, &kernel_type); -if (retval <0 ) + kernel_type =copy_mount_string (type); + retval =PTR_ERR (kernel_type); +if (IS_ERR (kernel_type)) goto out; dir =getname (dir_name);
@@ -806,8 +807,9 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,if (IS_ERR (dir)) goto out1; - retval =copy_mount_string (dev_name, &kernel_dev); -if (retval <0 ) + kernel_dev =copy_mount_string (dev_name); + retval =PTR_ERR (kernel_dev); +if (IS_ERR (kernel_dev)) goto out2; retval =copy_mount_options (data, &data_page);
fs/exec.c +8 -2
@@ -98,6 +98,12 @@ static inline void put_binfmt(struct linux_binfmt * fmt)module_put (fmt->module); } +bool path_noexec (const struct path *path) +{ +return (path->mnt->mnt_flags &MNT_NOEXEC ) || + (path->mnt->mnt_sb->s_type->fs_flags &FS_NOEXEC ); +} +#ifdef CONFIG_USELIB /* * Note that a shared library must be both readable and executable due to
@@ -132,7 +138,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) goto exit; error = -EACCES ; -if (file->f_path.mnt->mnt_flags &MNT_NOEXEC ) +if (path_noexec (&file->f_path)) goto exit;fsnotify_open (file);
@@ -773,7 +779,7 @@ static struct file *do_open_exec(struct filename *name)if (!S_ISREG (file_inode (file)->i_mode)) goto exit; -if (file->f_path.mnt->mnt_flags &MNT_NOEXEC ) +if (path_noexec (&file->f_path)) goto exit;fsnotify_open (file);
fs/internal.h +1 -1
@@ -51,7 +51,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,* namespace.c */ extern int copy_mount_options (const void __user *,unsigned long *); -extern int copy_mount_string (const void __user *,char **); +extern char *copy_mount_string (const void __user *);extern struct vfsmount *lookup_mnt (struct path *);extern int finish_automount (struct vfsmount *,struct path *);
fs/namespace.c +8 -18
@@ -2482,21 +2482,9 @@ int copy_mount_options(const void __user * data, unsigned long *where)return 0 ; } -int copy_mount_string (const void __user *data,char **where) +char *copy_mount_string (const void __user *data) { -char *tmp; - -if (!data) { - *where =NULL ; -return 0 ; - } - - tmp =strndup_user (data,PAGE_SIZE ); -if (IS_ERR (tmp)) -return PTR_ERR (tmp); - - *where = tmp; -return 0 ; +return data ?strndup_user (data,PAGE_SIZE ) :NULL ; }/*
@@ -2766,8 +2754,9 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,char *kernel_dev;unsigned long data_page; - ret =copy_mount_string (type, &kernel_type); -if (ret <0 ) + kernel_type =copy_mount_string (type); + ret =PTR_ERR (kernel_type); +if (IS_ERR (kernel_type)) goto out_type; kernel_dir =getname (dir_name);
@@ -2776,8 +2765,9 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, goto out_dir; } - ret =copy_mount_string (dev_name, &kernel_dev); -if (ret <0 ) + kernel_dev =copy_mount_string (dev_name); + ret =PTR_ERR (kernel_dev); +if (IS_ERR (kernel_dev)) goto out_dev; ret =copy_mount_options (data, &data_page);
fs/nfs/nfs4proc.c +4 -7
@@ -3000,16 +3000,13 @@ int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle,struct nfs_fsinfo *info, bool auth_probe) { - int status; + int status = 0; -switch (auth_probe) { -case false: +if (!auth_probe) status =nfs4_lookup_root (server, fhandle, info); -if (status != -NFS4ERR_WRONGSEC ) -break ; -default : + +if (auth_probe || status ==NFS4ERR_WRONGSEC ) status =nfs4_do_find_root_sec (server, fhandle, info); - }if (status ==0 ) status =nfs4_server_capabilities (server, fhandle);
fs/open.c +1 -1
@@ -359,7 +359,7 @@ retry:* with the "noexec" flag. */ res = -EACCES ; -if (path.mnt->mnt_flags &MNT_NOEXEC ) +if (path_noexec (&path)) goto out_path_release; }
fs/proc/root.c +1 -1
@@ -161,7 +161,7 @@ static struct file_system_type proc_fs_type = { .name = "proc", .mount = proc_mount, .kill_sb = proc_kill_sb, - .fs_flags = FS_USERNS_VISIBLE | FS_USERNS_MOUNT, + .fs_flags = FS_USERNS_VISIBLE | FS_USERNS_MOUNT | FS_NOEXEC, };void __init proc_root_init (void )
fs/sysfs/mount.c +2 -1
@@ -40,6 +40,7 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, SYSFS_MAGIC, &new_sb, ns);if (IS_ERR (root) || !new_sb)kobj_ns_drop (KOBJ_NS_TYPE_NET , ns); +return root; }
@@ -55,7 +56,7 @@ static struct file_system_type sysfs_fs_type = { .name = "sysfs", .mount = sysfs_mount, .kill_sb = sysfs_kill_sb, - .fs_flags = FS_USERNS_VISIBLE | FS_USERNS_MOUNT, + .fs_flags = FS_USERNS_VISIBLE | FS_USERNS_MOUNT | FS_NOEXEC, };int __init sysfs_init (void )
include/linux/blkdev.h +1 -1
@@ -620,7 +620,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)#define list_entry_rq (ptr) list_entry((ptr), struct request, queuelist) -#define rq_data_dir (rq) (((rq)->cmd_flags & 1) != 0) +#define rq_data_dir (rq) ((int)((rq)->cmd_flags & 1))/* * Driver can handle struct request, if it either has an old style
include/linux/fs.h +3 -0
@@ -1767,6 +1767,7 @@ struct file_system_type {#define FS_USERNS_MOUNT 8/* Can be mounted by userns root */ #define FS_USERNS_DEV_MOUNT 16/* A userns mount does not imply MNT_NODEV */ #define FS_USERNS_VISIBLE 32/* FS must already be visible */ +#define FS_NOEXEC 64/* Ignore executables on this fs */ #define FS_RENAME_DOES_D_MOVE 32768/* FS will handle d_move() during rename() internally. */ struct dentry *(*mount) (struct file_system_type *,int ,const char *,void *);
@@ -2782,4 +2783,6 @@ static inline bool dir_relax(struct inode *inode) return !IS_DEADDIR(inode); } +extern bool path_noexec (const struct path *path); +#endif /* _LINUX_FS_H */
include/uapi/linux/netlink.h +4 -0
@@ -106,8 +106,10 @@ struct nlmsgerr {#define NETLINK_PKTINFO 3#define NETLINK_BROADCAST_ERROR 4#define NETLINK_NO_ENOBUFS 5 +#ifndef __KERNEL__#define NETLINK_RX_RING 6#define NETLINK_TX_RING 7 +#endif struct nl_pktinfo {__u32 group;
@@ -130,6 +132,7 @@ struct nl_mmap_hdr {__u32 nm_gid; }; +#ifndef __KERNEL__enum nl_mmap_status {NL_MMAP_STATUS_UNUSED , NL_MMAP_STATUS_RESERVED,
@@ -141,6 +144,7 @@ enum nl_mmap_status {#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO#define NL_MMAP_MSG_ALIGN (sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) +#endif #define NET_MAJOR 36/* Major 36 is reserved for networking */
include/uapi/linux/netlink_diag.h +2 -0
@@ -48,6 +48,8 @@ enum {#define NDIAG_SHOW_MEMINFO 0x00000001/* show memory info of a socket */ #define NDIAG_SHOW_GROUPS 0x00000002/* show groups of a netlink socket */ +#ifndef __KERNEL__#define NDIAG_SHOW_RING_CFG 0x00000004/* show ring configuration */ +#endif #endif
kernel/sys.c +1 -2
@@ -1646,8 +1646,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)* overall picture. */ err = -EACCES ; -if (!S_ISREG (inode->i_mode) || - exe.file->f_path.mnt->mnt_flags &MNT_NOEXEC ) +if (!S_ISREG (inode->i_mode) ||path_noexec (&exe.file->f_path)) goto exit; err =inode_permission (inode,MAY_EXEC );
mm/mmap.c +2 -2
@@ -1250,7 +1250,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,* mounted, in which case we dont add PROT_EXEC.) */ if ((prot &PROT_READ ) && (current->personality &READ_IMPLIES_EXEC )) -if (!(file && (file->f_path.mnt->mnt_flags &MNT_NOEXEC ))) +if (!(file &&path_noexec (&file->f_path))) prot |=PROT_EXEC ;if (!len)
@@ -1322,7 +1322,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,case MAP_PRIVATE :if (!(file->f_mode &FMODE_READ ))return -EACCES ; -if (file->f_path.mnt->mnt_flags &MNT_NOEXEC ) { +if (path_noexec (&file->f_path)) {if (vm_flags &VM_EXEC )return -EPERM ; vm_flags &= ~VM_MAYEXEC ;
mm/nommu.c +1 -1
@@ -1043,7 +1043,7 @@ static int validate_mmap_request(struct file *file,/* handle executable mappings and implied executable * mappings */ -if (file->f_path.mnt->mnt_flags &MNT_NOEXEC ) { +if (path_noexec (&file->f_path)) {if (prot &PROT_EXEC )return -EPERM ; }else if ((prot &PROT_READ ) && !(prot &PROT_EXEC )) {
net/netlink/Kconfig +0 -9
@@ -2,15 +2,6 @@ # Netlink Sockets # -config NETLINK_MMAP - bool "NETLINK: mmaped IO" - ---help--- - This option enables support for memory mapped netlink IO. This - reduces overhead by avoiding copying data between kernel- and - userspace. - - If unsure, say N. - config NETLINK_DIAG tristate "NETLINK: socket monitoring interface" default n
net/netlink/af_netlink.c +9 -729
836 lines not on this page · raw message
net/netlink/af_netlink.h +0 -15
@@ -41,12 +41,6 @@ struct netlink_sock {int (*netlink_bind)(int group);void (*netlink_unbind)(int group);struct module *module; -#ifdef CONFIG_NETLINK_MMAP -struct mutex pg_vec_lock; -struct netlink_ring rx_ring; -struct netlink_ring tx_ring; -atomic_t mapped; -#endif /* CONFIG_NETLINK_MMAP */ };static inline struct netlink_sock *nlk_sk (struct sock *sk)
@@ -67,15 +61,6 @@ struct nl_portid_hash {u32 rnd; }; -static inline bool netlink_skb_is_mmaped (const struct sk_buff *skb) -{ -#ifdef CONFIG_NETLINK_MMAP -return NETLINK_CB (skb).flags &NETLINK_SKB_MMAPED ; -#else -return false; -#endif /* CONFIG_NETLINK_MMAP */ -} -struct netlink_table {struct nl_portid_hash hash;struct hlist_head mc_list;
net/netlink/diag.c +0 -39
@@ -7,41 +7,6 @@#include "af_netlink.h" -#ifdef CONFIG_NETLINK_MMAP -static int sk_diag_put_ring (struct netlink_ring *ring,int nl_type, -struct sk_buff *nlskb) -{ -struct netlink_diag_ring ndr; - - ndr.ndr_block_size = ring->pg_vec_pages <<PAGE_SHIFT ; - ndr.ndr_block_nr = ring->pg_vec_len; - ndr.ndr_frame_size = ring->frame_size; - ndr.ndr_frame_nr = ring->frame_max +1 ; - -return nla_put (nlskb, nl_type,sizeof (ndr), &ndr); -} - -static int sk_diag_put_rings_cfg (struct sock *sk,struct sk_buff *nlskb) -{ -struct netlink_sock *nlk =nlk_sk (sk); -int ret; - -mutex_lock (&nlk->pg_vec_lock); - ret =sk_diag_put_ring (&nlk->rx_ring,NETLINK_DIAG_RX_RING , nlskb); -if (!ret) - ret =sk_diag_put_ring (&nlk->tx_ring,NETLINK_DIAG_TX_RING , - nlskb); -mutex_unlock (&nlk->pg_vec_lock); - -return ret; -} -#else -static int sk_diag_put_rings_cfg (struct sock *sk,struct sk_buff *nlskb) -{ -return 0 ; -} -#endif -static int sk_diag_dump_groups (struct sock *sk,struct sk_buff *nlskb) {struct netlink_sock *nlk =nlk_sk (sk);
@@ -86,10 +51,6 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, sock_diag_put_meminfo(sk, skb, NETLINK_DIAG_MEMINFO)) goto out_nlmsg_trim; -if ((req->ndiag_show &NDIAG_SHOW_RING_CFG ) && -sk_diag_put_rings_cfg (sk, skb)) - goto out_nlmsg_trim; -return nlmsg_end (skb, nlh); out_nlmsg_trim:
security/keys/keyring.c +3 -3
@@ -848,6 +848,9 @@ key_ref_t keyring_search_aux(key_ref_t keyring_ref,return ERR_PTR (err); } +if (!ctx->match) +return ERR_PTR (-ENOKEY ); +rcu_read_lock (); ctx->now =current_kernel_time ();if (search_nested_keyrings (keyring, ctx))
@@ -879,9 +882,6 @@ key_ref_t keyring_search(key_ref_t keyring, KEYRING_SEARCH_DO_STATE_CHECK), }; -if (!ctx.match) -return ERR_PTR (-ENOKEY ); -return keyring_search_aux (keyring, &ctx); }EXPORT_SYMBOL (keyring_search);
security/security.c +1 -1
@@ -728,7 +728,7 @@ static inline unsigned long mmap_prot(struct file *file, unsigned long prot)* ditto if it's not on noexec mount, except that on !MMU we need * BDI_CAP_EXEC_MMAP (== VM_MAYEXEC) in this case */ -if (!(file->f_path.mnt->mnt_flags &MNT_NOEXEC )) { +if (!path_noexec (&file->f_path)) {#ifndef CONFIG_MMU unsigned long caps =0 ;struct address_space *mapping = file->f_mapping;