1. 28 Mar, 2018 2 commits
    • Eric W. Biederman's avatar
      ipc/shm: Fix pid freeing. · 2236d4d3
      Eric W. Biederman authored
      The 0day kernel test build report reported an oops:
      >
      >  IP: put_pid+0x22/0x5c
      >  PGD 19efa067 P4D 19efa067 PUD 0
      >  Oops: 0000 [#1]
      >  CPU: 0 PID: 727 Comm: trinity Not tainted 4.16.0-rc2-00010-g98f929b #1
      >  RIP: 0010:put_pid+0x22/0x5c
      >  RSP: 0018:ffff986719f73e48 EFLAGS: 00010202
      >  RAX: 00000006d765f710 RBX: ffff98671a4fa4d0 RCX: ffff986719f73d40
      >  RDX: 000000006f6e6125 RSI: 0000000000000000 RDI: ffffffffa01e6d21
      >  RBP: ffffffffa0955fe0 R08: 0000000000000020 R09: 0000000000000000
      >  R10: 0000000000000078 R11: ffff986719f73e76 R12: 0000000000001000
      >  R13: 00000000ffffffea R14: 0000000054000fb0 R15: 0000000000000000
      >  FS:  00000000028c2880(0000) GS:ffffffffa06ad000(0000) knlGS:0000000000000000
      >  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      >  CR2: 0000000677846439 CR3: 0000000019fc1005 CR4: 00000000000606b0
      >  Call Trace:
      >   ? ipc_update_pid+0x36/0x3e
      >   ? newseg+0x34c/0x3a6
      >   ? ipcget+0x5d/0x528
      >   ? entry_SYSCALL_64_after_hwframe+0x52/0xb7
      >   ? SyS_shmget+0x5a/0x84
      >   ? do_syscall_64+0x194/0x1b3
      >   ? entry_SYSCALL_64_after_hwframe+0x42/0xb7
      >  Code: ff 05 e7 20 9b 03 58 c9 c3 48 ff 05 85 21 9b 03 48 85 ff 74 4f 8b 47 04 8b 17 48 ff 05 7c 21 9b 03 48 83 c0 03 48 c1 e0 04 ff ca <48> 8b 44 07 08 74 1f 48 ff 05 6c 21 9b 03 ff 0f 0f 94 c2 48 ff
      >  RIP: put_pid+0x22/0x5c RSP: ffff986719f73e48
      >  CR2: 0000000677846439
      >  ---[ end trace ab8c5cb4389d37c5 ]---
      >  Kernel panic - not syncing: Fatal exception
      
      In newseg when changing shm_cprid and shm_lprid from pid_t to struct
      pid* I misread the kvmalloc as kvzalloc and thought shp was
      initialized to 0.  As that is not the case it is not safe to for the
      error handling to address shm_cprid and shm_lprid before they are
      initialized.
      
      Therefore move the cleanup of shm_cprid and shm_lprid from the no_file
      error cleanup path to the no_id error cleanup path.  Ensuring that an
      early error exit won't cause the oops above.
      Reported-by: default avatarkernel test robot <fengguang.wu@intel.com>
      Reviewed-by: default avatarNagarathnam Muthusamy <nagarathnam.muthusamy@oracle.com>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      2236d4d3
    • Stephen Rothwell's avatar
      ipc/shm: fix up for struct file no longer being available in shm.h · 8ecd2953
      Stephen Rothwell authored
      Stephen Rothewell <sfr@canb.auug.org.au> wrote:
      
      > After merging the userns tree, today's linux-next build (powerpc
      > ppc64_defconfig) produced this warning:
      >
      > In file included from include/linux/sched.h:16:0,
      >                  from arch/powerpc/lib/xor_vmx_glue.c:14:
      > include/linux/shm.h:17:35: error: 'struct file' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
      >  bool is_file_shm_hugepages(struct file *file);
      >                                    ^~~~
      >
      > and many, many more (most warnings, but some errors - arch/powerpc is
      > mostly built with -Werror)
      
      I dug through this and I discovered that the error was caused by the
      removal of struct shmid_kernel from shm.h when building on powerpc.
      Except for observing the existence of "struct file *shm_file" in
      struct shmid_kernel I have no clue why the structure move would cause
      such a failure.  I suspect shm.h always needed the forward declaration
      and someting had been confusing gcc into not issuing the warning. --EWB
      
      Fixes: a2e102cd ("shm: Move struct shmid_kernel into ipc/shm.c")
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      8ecd2953
  2. 27 Mar, 2018 5 commits
    • Eric W. Biederman's avatar
      ipc/smack: Tidy up from the change in type of the ipc security hooks · 0d79cbf8
      Eric W. Biederman authored
      Rename the variables shp, sma, msq to isp. As that is how the code already
      refers to those variables.
      
      Collapse smack_of_shm, smack_of_sem, and smack_of_msq into smack_of_ipc,
      as the three functions had become completely identical.
      
      Collapse smack_shm_alloc_security, smack_sem_alloc_security and
      smack_msg_queue_alloc_security into smack_ipc_alloc_security as the three
      functions had become identical.
      
      Collapse smack_shm_free_security, smack_sem_free_security and
      smack_msg_queue_free_security into smack_ipc_free_security as the
      three functions had become identical.
      Requested-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      0d79cbf8
    • Eric W. Biederman's avatar
      ipc: Directly call the security hook in ipc_ops.associate · 50ab44b1
      Eric W. Biederman authored
      After the last round of cleanups the shm, sem, and msg associate
      operations just became trivial wrappers around the appropriate security
      method.  Simplify things further by just calling the security method
      directly.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      50ab44b1
    • Eric W. Biederman's avatar
      ipc/sem: Fix semctl(..., GETPID, ...) between pid namespaces · 51d6f263
      Eric W. Biederman authored
      Today the last process to update a semaphore is remembered and
      reported in the pid namespace of that process.  If there are processes
      in any other pid namespace querying that process id with GETPID the
      result will be unusable nonsense as it does not make any
      sense in your own pid namespace.
      
      Due to ipc_update_pid I don't think you will be able to get System V
      ipc semaphores into a troublesome cache line ping-pong.  Using struct
      pids from separate process are not a problem because they do not share
      a cache line.  Using struct pid from different threads of the same
      process are unlikely to be a problem as the reference count update
      can be avoided.
      
      Further linux futexes are a much better tool for the job of mutual
      exclusion between processes than System V semaphores.  So I expect
      programs that  are performance limited by their interprocess mutual
      exclusion primitive will be using futexes.
      
      So while it is possible that enhancing the storage of the last
      rocess of a System V semaphore from an integer to a struct pid
      will cause a performance regression because of the effect
      of frequently updating the pid reference count.  I don't expect
      that to happen in practice.
      
      This change updates semctl(..., GETPID, ...) to return the
      process id of the last process to update a semphore inthe
      pid namespace of the calling process.
      
      Fixes: b488893a ("pid namespaces: changes to show virtual ids to user")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      51d6f263
    • Eric W. Biederman's avatar
      ipc/msg: Fix msgctl(..., IPC_STAT, ...) between pid namespaces · 39a4940e
      Eric W. Biederman authored
      Today msg_lspid and msg_lrpid are remembered in the pid namespace of
      the creator and the processes that last send or received a sysvipc
      message.  If you have processes in multiple pid namespaces that is
      just wrong.  The process ids reported will not make the least bit of
      sense.
      
      This fix is slightly more susceptible to a performance problem than
      the related fix for System V shared memory.  By definition the pids
      are updated by msgsnd and msgrcv, the fast path of System V message
      queues.  The only concern over the previous implementation is the
      incrementing and decrementing of the pid reference count.  As that is
      the only difference and multiple updates by of the task_tgid by
      threads in the same process have been shown in af_unix sockets to
      create a cache line ping-pong between cpus of the same processor.
      
      In this case I don't expect cache lines holding pid reference counts
      to ping pong between cpus.  As senders and receivers update different
      pids there is a natural separation there.  Further if multiple threads
      of the same process either send or receive messages the pid will be
      updated to the same value and ipc_update_pid will avoid the reference
      count update.
      
      Which means in the common case I expect msg_lspid and msg_lrpid to
      remain constant, and reference counts not to be updated when messages
      are sent.
      
      In rare cases it may be possible to trigger the issue which was
      observed for af_unix sockets, but it will require multiple processes
      with multiple threads to be either sending or receiving messages.  It
      just does not feel likely that anyone would do that in practice.
      
      This change updates msgctl(..., IPC_STAT, ...) to return msg_lspid and
      msg_lrpid in the pid namespace of the process calling stat.
      
      This change also updates cat /proc/sysvipc/msg to return print msg_lspid
      and msg_lrpid in the pid namespace of the process that opened the proc
      file.
      
      Fixes: b488893a ("pid namespaces: changes to show virtual ids to user")
      Reviewed-by: default avatarNagarathnam Muthusamy <nagarathnam.muthusamy@oracle.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      39a4940e
    • Eric W. Biederman's avatar
      ipc/shm: Fix shmctl(..., IPC_STAT, ...) between pid namespaces. · 98f929b1
      Eric W. Biederman authored
      Today shm_cpid and shm_lpid are remembered in the pid namespace of the
      creator and the processes that last touched a sysvipc shared memory
      segment.   If you have processes in multiple pid namespaces that
      is just wrong, and I don't know how this has been over-looked for
      so long.
      
      As only creation and shared memory attach and shared memory detach
      update the pids I do not expect there to be a repeat of the issues
      when struct pid was attached to each af_unix skb, which in some
      notable cases cut the performance in half.  The problem was threads of
      the same process updating same struct pid from different cpus causing
      the cache line to be highly contended and bounce between cpus.
      
      As creation, attach, and detach are expected to be rare operations for
      sysvipc shared memory segments I do not expect that kind of cache line
      ping pong to cause probems.  In addition because the pid is at a fixed
      location in the structure instead of being dynamic on a skb, the
      reference count of the pid does not need to be updated on each
      operation if the pid is the same.  This ability to simply skip the pid
      reference count changes if the pid is unchanging further reduces the
      likelihood of the a cache line holding a pid reference count
      ping-ponging between cpus.
      
      Fixes: b488893a ("pid namespaces: changes to show virtual ids to user")
      Reviewed-by: default avatarNagarathnam Muthusamy <nagarathnam.muthusamy@oracle.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      98f929b1
  3. 24 Mar, 2018 4 commits
    • Eric W. Biederman's avatar
      ipc/util: Helpers for making the sysvipc operations pid namespace aware · 03f1fc09
      Eric W. Biederman authored
      Capture the pid namespace when /proc/sysvipc/msg /proc/sysvipc/shm
      and /proc/sysvipc/sem are opened, and make it available through
      the new helper ipc_seq_pid_ns.
      
      This makes it possible to report the pids in these files in the
      pid namespace of the opener of the files.
      
      Implement ipc_update_pid.  A simple impline helper that will only update
      a struct pid pointer if the new value does not equal the old value.  This
      removes the need for wordy code sequences like:
      
      	old = object->pid;
      	object->pid = new;
      	put_pid(old);
      
      and
      
      	old = object->pid;
      	if (old != new) {
      		object->pid = new;
      		put_pid(old);
      	}
      
      Allowing the following to be written instead:
      
      	ipc_update_pid(&object->pid, new);
      
      Which is easier to read and ensures that the pid reference count is
      not touched the old and the new values are the same.  Not touching
      the reference count in this case is important to help avoid issues
      like af_unix experienced, where multiple threads of the same
      process managed to bounce the struct pid between cpu cache lines,
      but updating the pids reference count.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      03f1fc09
    • Eric W. Biederman's avatar
      ipc: Move IPCMNI from include/ipc.h into ipc/util.h · f83a396d
      Eric W. Biederman authored
      The definition IPCMNI is only used in ipc/util.h and ipc/util.c.  So
      there is no reason to keep it in a header file that the whole kernel
      can see.  Move it into util.h to simplify future maintenance.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      f83a396d
    • Eric W. Biederman's avatar
      msg: Move struct msg_queue into ipc/msg.c · 34b56df9
      Eric W. Biederman authored
      All of the users are now in ipc/msg.c so make the definition local to
      that file to make code maintenance easier.  AKA to prevent rebuilding
      the entire kernel when struct msg_queue changes.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      34b56df9
    • Eric W. Biederman's avatar
      shm: Move struct shmid_kernel into ipc/shm.c · a2e102cd
      Eric W. Biederman authored
      All of the users are now in ipc/shm.c so make the definition local to
      that file to make code maintenance easier.  AKA to prevent rebuilding
      the entire kernel when struct shmid_kernel changes.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      a2e102cd
  4. 23 Mar, 2018 4 commits
  5. 21 Mar, 2018 1 commit
  6. 19 Feb, 2018 1 commit
  7. 18 Feb, 2018 4 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0e06fb5b
      Linus Torvalds authored
      Pull x86 Kconfig fixes from Thomas Gleixner:
       "Three patchlets to correct HIGHMEM64G and CMPXCHG64 dependencies in
        Kconfig when CPU selections are explicitely set to M586 or M686"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/Kconfig: Explicitly enumerate i686-class CPUs in Kconfig
        x86/Kconfig: Exclude i586-class CPUs lacking PAE support from the HIGHMEM64G Kconfig group
        x86/Kconfig: Add missing i586-class CPUs to the X86_CMPXCHG64 Kconfig group
      0e06fb5b
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9ca2c16f
      Linus Torvalds authored
      Pull perf updates from Thomas Gleixner:
       "Perf tool updates and kprobe fixes:
      
         - perf_mmap overwrite mode fixes/overhaul, prep work to get 'perf
           top' using it, making it bearable to use it in large core count
           systems such as Knights Landing/Mill Intel systems (Kan Liang)
      
         - s/390 now uses syscall.tbl, just like x86-64 to generate the
           syscall table id -> string tables used by 'perf trace' (Hendrik
           Brueckner)
      
         - Use strtoull() instead of home grown function (Andy Shevchenko)
      
         - Synchronize kernel ABI headers, v4.16-rc1 (Ingo Molnar)
      
         - Document missing 'perf data --force' option (Sangwon Hong)
      
         - Add perf vendor JSON metrics for ARM Cortex-A53 Processor (William
           Cohen)
      
         - Improve error handling and error propagation of ftrace based
           kprobes so failures when installing kprobes are not silently
           ignored and create disfunctional tracepoints"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
        kprobes: Propagate error from disarm_kprobe_ftrace()
        kprobes: Propagate error from arm_kprobe_ftrace()
        Revert "tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h"
        perf s390: Rework system call table creation by using syscall.tbl
        perf s390: Grab a copy of arch/s390/kernel/syscall/syscall.tbl
        tools/headers: Synchronize kernel ABI headers, v4.16-rc1
        perf test: Fix test trace+probe_libc_inet_pton.sh for s390x
        perf data: Document missing --force option
        perf tools: Substitute yet another strtoull()
        perf top: Check the latency of perf_top__mmap_read()
        perf top: Switch default mode to overwrite mode
        perf top: Remove lost events checking
        perf hists browser: Add parameter to disable lost event warning
        perf top: Add overwrite fall back
        perf evsel: Expose the perf_missing_features struct
        perf top: Check per-event overwrite term
        perf mmap: Discard legacy interface for mmap read
        perf test: Update mmap read functions for backward-ring-buffer test
        perf mmap: Introduce perf_mmap__read_event()
        perf mmap: Introduce perf_mmap__read_done()
        ...
      9ca2c16f
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2d6c4e40
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "A small set of updates mostly for irq chip drivers:
      
         - MIPS GIC fix for spurious, masked interrupts
      
         - fix for a subtle IPI bug in GICv3
      
         - do not probe GICv3 ITSs that are marked as disabled
      
         - multi-MSI support for GICv2m
      
         - various small cleanups"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqdomain: Re-use DEFINE_SHOW_ATTRIBUTE() macro
        irqchip/bcm: Remove hashed address printing
        irqchip/gic-v2m: Add PCI Multi-MSI support
        irqchip/gic-v3: Ignore disabled ITS nodes
        irqchip/gic-v3: Use wmb() instead of smb_wmb() in gic_raise_softirq()
        irqchip/gic-v3: Change pr_debug message to pr_devel
        irqchip/mips-gic: Avoid spuriously handling masked interrupts
      2d6c4e40
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 59e47215
      Linus Torvalds authored
      Pull core fix from Thomas Gleixner:
       "A small fix which adds the missing for_each_cpu_wrap() stub for the UP
        case to avoid build failures"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpumask: Make for_each_cpu_wrap() available on UP as well
      59e47215
  8. 17 Feb, 2018 11 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20180217' of git://git.kernel.dk/linux-block · c786427f
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe pull request from Keith, with fixes all over the map for nvme.
         From various folks.
      
       - Classic polling fix, that avoids a latency issue where we still end
         up waiting for an interrupt in some cases. From Nitesh Shetty.
      
       - Comment typo fix from Minwoo Im.
      
      * tag 'for-linus-20180217' of git://git.kernel.dk/linux-block:
        block: fix a typo in comment of BLK_MQ_POLL_STATS_BKTS
        nvme-rdma: fix sysfs invoked reset_ctrl error flow
        nvmet: Change return code of discard command if not supported
        nvme-pci: Fix timeouts in connecting state
        nvme-pci: Remap CMB SQ entries on every controller reset
        nvme: fix the deadlock in nvme_update_formats
        blk: optimization for classic polling
        nvme: Don't use a stack buffer for keep-alive command
        nvme_fc: cleanup io completion
        nvme_fc: correct abort race condition on resets
        nvme: Fix discard buffer overrun
        nvme: delete NVME_CTRL_LIVE --> NVME_CTRL_CONNECTING transition
        nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process
        nvme: rename NVME_CTRL_RECONNECTING state to NVME_CTRL_CONNECTING
      c786427f
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · fa2139ef
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
      
       - meson-gx: Revert to earlier tuning process
      
       - bcm2835: Don't overwrite max frequency unconditionally
      
      * tag 'mmc-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: bcm2835: Don't overwrite max frequency unconditionally
        Revert "mmc: meson-gx: include tx phase in the tuning process"
      fa2139ef
    • Linus Torvalds's avatar
      Merge tag 'mtd/fixes-for-4.16-rc2' of git://git.infradead.org/linux-mtd · 4b6415f9
      Linus Torvalds authored
      Pull mtd fixes from Boris Brezillon:
      
       - add missing dependency to NAND_MARVELL Kconfig entry
      
       - use the appropriate OOB layout in the VF610 driver
      
      * tag 'mtd/fixes-for-4.16-rc2' of git://git.infradead.org/linux-mtd:
        mtd: nand: MTD_NAND_MARVELL should depend on HAS_DMA
        mtd: nand: vf610: set correct ooblayout
      4b6415f9
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · ee78ad78
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "The main attraction is a fix for a bug in the new drmem code, which
        was causing an oops on boot on some versions of Qemu.
      
        There's also a fix for XIVE (Power9 interrupt controller) on KVM, as
        well as a few other minor fixes.
      
        Thanks to: Corentin Labbe, Cyril Bur, Cédric Le Goater, Daniel Black,
        Nathan Fontenot, Nicholas Piggin"
      
      * tag 'powerpc-4.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/pseries: Check for zero filled ibm,dynamic-memory property
        powerpc/pseries: Add empty update_numa_cpu_lookup_table() for NUMA=n
        powerpc/powernv: IMC fix out of bounds memory access at shutdown
        powerpc/xive: Use hw CPU ids when configuring the CPU queues
        powerpc: Expose TSCR via sysfs only on powernv
      ee78ad78
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 74688a02
      Linus Torvalds authored
      Pull arm64 fixes from Catalin Marinas:
       "The bulk of this is the pte accessors annotation to READ/WRITE_ONCE
        (we tried to avoid pushing this during the merge window to avoid
        conflicts)
      
         - Updated the page table accessors to use READ/WRITE_ONCE and prevent
           compiler transformation that could lead to an apparent loss of
           coherency
      
         - Enabled branch predictor hardening for the Falkor CPU
      
         - Fix interaction between kpti enabling and KASan causing the
           recursive page table walking to take a significant time
      
         - Fix some sparse warnings"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: cputype: Silence Sparse warnings
        arm64: mm: Use READ_ONCE/WRITE_ONCE when accessing page tables
        arm64: proc: Set PTE_NG for table entries to avoid traversing them twice
        arm64: Add missing Falkor part number for branch predictor hardening
      74688a02
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.16a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · f73f047d
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - fixes for the Xen pvcalls frontend driver
      
       - fix for booting Xen pv domains
      
       - fix for the xenbus driver user interface
      
      * tag 'for-linus-4.16a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        pvcalls-front: wait for other operations to return when release passive sockets
        pvcalls-front: introduce a per sock_mapping refcount
        x86/xen: Calculate __max_logical_packages on PV domains
        xenbus: track caller request id
      f73f047d
    • Stefano Stabellini's avatar
      pvcalls-front: wait for other operations to return when release passive sockets · d1a75e08
      Stefano Stabellini authored
      Passive sockets can have ongoing operations on them, specifically, we
      have two wait_event_interruptable calls in pvcalls_front_accept.
      
      Add two wake_up calls in pvcalls_front_release, then wait for the
      potential waiters to return and release the sock_mapping refcount.
      Signed-off-by: default avatarStefano Stabellini <stefano@aporeto.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      d1a75e08
    • Stefano Stabellini's avatar
      pvcalls-front: introduce a per sock_mapping refcount · 64d68718
      Stefano Stabellini authored
      Introduce a per sock_mapping refcount, in addition to the existing
      global refcount. Thanks to the sock_mapping refcount, we can safely wait
      for it to be 1 in pvcalls_front_release before freeing an active socket,
      instead of waiting for the global refcount to be 1.
      Signed-off-by: default avatarStefano Stabellini <stefano@aporeto.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      64d68718
    • Prarit Bhargava's avatar
      x86/xen: Calculate __max_logical_packages on PV domains · 63e708f8
      Prarit Bhargava authored
      The kernel panics on PV domains because native_smp_cpus_done() is
      only called for HVM domains.
      
      Calculate __max_logical_packages for PV domains.
      
      Fixes: b4c0a732 ("x86/smpboot: Fix __max_logical_packages estimate")
      Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
      Tested-and-reported-by: default avatarSimon Gaiser <simon@invisiblethingslab.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Dou Liyang <douly.fnst@cn.fujitsu.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: xen-devel@lists.xenproject.org
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      63e708f8
    • Joao Martins's avatar
      xenbus: track caller request id · 29fee6ee
      Joao Martins authored
      Commit fd8aa909 ("xen: optimize xenbus driver for multiple concurrent
      xenstore accesses") optimized xenbus concurrent accesses but in doing so
      broke UABI of /dev/xen/xenbus. Through /dev/xen/xenbus applications are in
      charge of xenbus message exchange with the correct header and body. Now,
      after the mentioned commit the replies received by application will no
      longer have the header req_id echoed back as it was on request (see
      specification below for reference), because that particular field is being
      overwritten by kernel.
      
      struct xsd_sockmsg
      {
        uint32_t type;  /* XS_??? */
        uint32_t req_id;/* Request identifier, echoed in daemon's response.  */
        uint32_t tx_id; /* Transaction id (0 if not related to a transaction). */
        uint32_t len;   /* Length of data following this. */
      
        /* Generally followed by nul-terminated string(s). */
      };
      
      Before there was only one request at a time so req_id could simply be
      forwarded back and forth. To allow simultaneous requests we need a
      different req_id for each message thus kernel keeps a monotonic increasing
      counter for this field and is written on every request irrespective of
      userspace value.
      
      Forwarding again the req_id on userspace requests is not a solution because
      we would open the possibility of userspace-generated req_id colliding with
      kernel ones. So this patch instead takes another route which is to
      artificially keep user req_id while keeping the xenbus logic as is. We do
      that by saving the original req_id before xs_send(), use the private kernel
      counter as req_id and then once reply comes and was validated, we restore
      back the original req_id.
      
      Cc: <stable@vger.kernel.org> # 4.11
      Fixes: fd8aa909 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
      Reported-by: default avatarBhavesh Davda <bhavesh.davda@oracle.com>
      Signed-off-by: default avatarJoao Martins <joao.m.martins@oracle.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      29fee6ee
    • Robin Murphy's avatar
      arm64: cputype: Silence Sparse warnings · e1a50de3
      Robin Murphy authored
      Sparse makes a fair bit of noise about our MPIDR mask being implicitly
      long - let's explicitly describe it as such rather than just relying on
      the value forcing automatic promotion.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      e1a50de3
  9. 16 Feb, 2018 8 commits