aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* defconfig: less debugMoyster2016-09-141-1/+1
|
* defconfig: enable iosched_fiops but don't use it as default yetMoyster2016-09-131-0/+2
|
* block, bdi: an active gendisk always has a request_queue associated with itTejun Heo2016-09-137-21/+5
| | | | | | | | | | | | | | | | | | | | | | | bdev_get_queue() returns the request_queue associated with the specified block_device. blk_get_backing_dev_info() makes use of bdev_get_queue() to determine the associated bdi given a block_device. All the callers of bdev_get_queue() including blk_get_backing_dev_info() assume that bdev_get_queue() may return NULL and implement NULL handling; however, bdev_get_queue() requires the passed in block_device is opened and attached to its gendisk. Because an active gendisk always has a valid request_queue associated with it, bdev_get_queue() can never return NULL and neither can blk_get_backing_dev_info(). Make it clear that neither of the two functions can return NULL and remove NULL handling from all the callers. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Chris Mason <clm@fb.com> Cc: Dave Chinner <david@fromorbit.com> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* bdi: reimplement bdev_inode_switch_bdi()Tejun Heo2016-09-133-23/+12
| | | | | | | | | | | | | | | | | A block_device may be attached to different gendisks and thus different bdis over time. bdev_inode_switch_bdi() is used to switch the associated bdi. The function assumes that the inode could be dirty and transfers it between bdis if so. This is a bit nasty in that it reaches into bdi internals. This patch reimplements the function so that it writes out the inode if dirty. This is a lot simpler and can be implemented without exposing bdi internals. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* bdi: explain the dirty list transferring in bdi_destroy()Tejun Heo2016-09-131-2/+11
| | | | | | | | | | | | | | | | | | bdi_destroy() has code to transfer the remaining dirty inodes to the default_backing_dev_info; however, given the shutdown sequence, it isn't clear how such condition would happen. Also, it isn't a full solution as the transferred inodes stlil point to the bdi which is being destroyed. Operations on those inodes can end up accessing already released fields such as the percpu stat fields. Digging through the history, it seems that the code was added as a quick workaround for a bug report without fully root-causing the issue. We probably want to remove the code in time but for now let's add a comment noting that it is a quick workaround. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* bdi: make backing_dev_info->wb.dwork canceling stricterTejun Heo2016-09-131-13/+2
| | | | | | | | | | | | | | | | | | | | | Canceling of bdi->wb.dwork is currently a bit mushy. bdi_wb_shutdown() performs cancel_delayed_work_sync() at the end after shutting down and flushing the delayed_work and bdi_destroy() tries yet again after bdi_unregister(). bdi->wb.dwork is queued only after checking BDI_registered while holding bdi->wb_lock and bdi_wb_shutdown() clears the flag while holding the same lock and then flushes the delayed_work. There's no way the delayed_work can be queued again after that. Replace the two unnecessary cancel_delayed_work_sync() invocations with WARNs on pending. This simplifies and clarifies the code a bit and will help future changes in further isolating bdi_writeback handling. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* bdi: remove bdi->wb_lock locking around bdi->dev clearing in bdi_unregister()Tejun Heo2016-09-131-8/+2
| | | | | | | | | | | | | | | The only places where NULL test on bdi->dev is used are bdi_[un]register(). The functions can't be called in parallel anyway and there's no point in protecting bdi->dev clearing with a lock. Remove bdi->wb_lock grabbing around bdi->dev clearing and move it after device_unregister() call so that bdi->dev doesn't have to be cached in a local variable. This patch shouldn't introduce any behavior difference. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* debug: remove: remove some dmesg logspam from Linux mainline 3.4 fsktoonsez2016-09-131-1/+1
| | | | Signed-off-by: engstk <eng.stk@sapo.pt>
* pstore: pmsg: return -ENOMEM on vmalloc failureMark Salyzyn2016-09-131-0/+2
| | | | | | | Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 23385441 Change-Id: I294cb72c25bddafbba4e64fdb0a18ae46655a05d Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
* CHROMIMU: arm64: psci: lower the cpu_kill notification when racing with cpu_dieJoseph Lo2016-09-131-1/+1
| | | | | | | | | | | | | | | To avoid polluting the kernel log when cpuquiet is active, lower the pr_info to pr_debug. This is due to the cpu_kill could race with cpu_die, so the loop colud be tried a few times. BUG=chrome-os-partner:40516 TEST=Less console spew on Smaug with cpuquiet enabled. Change-Id: Iaed946e0ff6667c02e08798fd99691f7141e4e00 Signed-off-by: Joseph Lo <josephl@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/286287 Reviewed-by: Andrew Bresticker <abrestic@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org>
* block: Fix format string mismatch in cfq-iosched.cMasanari Iida2016-09-131-1/+1
| | | | | | | | Fix format string mismatch in cfq_var_show() Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* ARM: rwsem: use asm-generic rwsem implementationWill Deacon2016-09-132-4/+2
| | | | | | | | | | asm-generic offers an atomic-add based rwsem implementation, which can avoid the need for heavier, spinlock-based synchronisation on the fast path. This patch makes use of the optimised implementation for ARM CPUs. Signed-off-by: Will Deacon <will.deacon@arm.com>
* asm-generic: rwsem: ensure sem->cnt is only accessed via atomic_long_*Will Deacon2016-09-131-1/+1
| | | | | | | | | The asm-generic rwsem implementation directly acceses sem->cnt when performing a __down_read_trylock operation. Whilst this is probably safe on all architectures, we should stick to the atomic_long_* API and use atomic_long_read instead. Signed-off-by: Will Deacon <will.deacon@arm.com>
* ARM: alignment: correctly decode instructions in BE8 mode.Ben Dooks2016-09-131-2/+7
| | | | | | | | | | | | | | | | | | If we are in BE8 mode, we must deal with the instruction stream being in LE order when data is being loaded in BE order. Ensure the data is swapped before processing to avoid thre following: Change to using <asm/opcodes.h> to provide the necessary conversion functions to change the byte ordering. This stops the following warning messages from the kernel on a fault: Unhandled fault: alignment exception (0x001) at 0xbfa09567 Alignment trap: not handling instruction 030091e8 at [<80333e8c>] Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Dave Martin <Dave.Martin@arm.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* ARM: optimize memset_io()/memcpy_fromio()/memcpy_toio()Russell King2016-09-131-0/+25
| | | | | | | | | If we are building for a LE platform, and we haven't overriden the MMIO ops, then we can optimize the mem*io operations using the standard string functions. Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
* ARM: 8167/1: extend the reserved memory for initrd to be page alignedYalin Wang2016-09-132-0/+10
| | | | | | | | | | | This patch extends the start and end address of initrd to be page aligned, so that we can free all memory including the un-page aligned head or tail page of initrd, if the start or end address of initrd are not page aligned, the page can't be freed by free_initrd_mem() function. Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
* arm: irq: Tone down kernel loggingmyfluxi2016-09-131-1/+1
| | | | Change-Id: Ie31190bd65d1379de41e1ca2573aa65e785de1b6
* PM: Enable asynchronous noirq resume threads to save the resuming timeanarkia19762016-09-131-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Subject [PATCH] PM: Enable asynchronous noirq resume threads to save the resuming time From Chuansheng Liu <> Date Tue, 14 Jan 2014 15:18:08 +0800 Currently, the dpm_resume_noirq() is done synchronously, and for PCI devices pci_pm_resume_noirq(): pci_pm_resume_noirq() pci_pm_default_resume_early() pci_power_up() pci_raw_set_power_state() Which set the device from D3hot to D0 mostly, for every device, there will be one 10ms(pci_pm_d3_delay) to wait. Hence normally dpm_resume_noirq() will cost > 100ms, which is bigger for mobile platform. Here implementing it with asynchronous way which will reduce much. For example below, The 80% time is saved. With synchronous way: [ 1411.272218] PM: noirq resume of devices complete after 92.223 msecs With asynchronous way: [ 110.616735] PM: noirq resume of devices complete after 10.544 msecs Signed-off-by: Liu, Chuansheng <chuansheng.liu@intel.com>
* timer: optimize apply_slack()anarkia19762016-09-131-1/+1
| | | | __fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper
* USB: android: Fix memory leak in mass_storage_function_init()Azhar Shaikh2016-09-131-0/+4
| | | | | | | | | | | | | mass_storage_function_init() calls fsg_common_init() which allocates memory to fsg buffers only once during bootup. This memory is never freed, which results in a memory leak. The reference count is incremented in mass_storage_function_init() and in fsg_bind_config(). The count incremented in bind_config is decremented in fsg_unbind(). Free this memory and also decrement the reference count in mass_storage_function_cleanup() which will be called during gadget unbind. Change-Id: I51e8d062471540df01bcb3122195711bbaffe455 Signed-off-by: Azhar Shaikh <azhars@codeaurora.org>
* cpuidle: Add need_resched() checkPatrick Daly2016-09-131-0/+5
| | | | | | | | | | The cpuidle framework is disabled as part of suspend. In this scenario, the cpu may enter wfi without checking the need_resched() flag. Prevent this from occuring. CRs-fixed: 920501 Change-Id: Ib2077833279d84b2aea25c61198dfbdcf4566ea4 Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
* cpufreq: ondemand: Eliminate the deadband effectanarkia19762016-09-131-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | using the formula: Target frequency = C * load where C = policy->cpuinfo.max_freq / 100 Though, in many cases, the minimum available frequency is pretty high and the above calculation introduces a dead band from load 0 to 100 * policy->cpuinfo.min_freq / policy->cpuinfo.max_freq where the target frequency is always calculated to less than policy->cpuinfo.min_freq and the minimum frequency is selected. For example: on Intel i7-3770 @ 3.4GHz the policy->cpuinfo.min_freq = 1600000 and the policy->cpuinfo.max_freq = 3400000 (without turbo). Thus, the CPU starts to scale up at a load above 47. On quad core 1500MHz Krait the policy->cpuinfo.min_freq = 384000 and the policy->cpuinfo.max_freq = 1512000. Thus, the CPU starts to scale at load above 25. Change the calculation of target frequency to eliminate the above effect using the formula: Target frequency = A + B * load where A = policy->cpuinfo.min_freq and B = (policy->cpuinfo.max_freq - policy->cpuinfo->min_freq) / 100 This will map load values 0 to 100 linearly to cpuinfo.min_freq to cpuinfo.max_freq. Also, use the CPUFREQ_RELATION_C in __cpufreq_driver_target to select the closest frequency in frequency_table. This is necessary to avoid selection of minimum frequency only when load equals to 0. It will also help for selection of frequencies using a more 'fair' criterion. Tables below show the difference in selected frequency for specific values of load without and with this patch. On Intel i7-3770 @ 3.40GHz: Without With Load Target Selected Target Selected 0 0 1600000 1600000 1600000 5 170050 1600000 1690050 1700000 10 340100 1600000 1780100 1700000 15 510150 1600000 1870150 1900000 20 680200 1600000 1960200 2000000 25 850250 1600000 2050250 2100000 30 1020300 1600000 2140300 2100000 35 1190350 1600000 2230350 2200000 40 1360400 1600000 2320400 2400000 45 1530450 1600000 2410450 2400000 50 1700500 1900000 2500500 2500000 55 1870550 1900000 2590550 2600000 60 2040600 2100000 2680600 2600000 65 2210650 2400000 2770650 2800000 70 2380700 2400000 2860700 2800000 75 2550750 2600000 2950750 3000000 80 2720800 2800000 3040800 3000000 85 2890850 2900000 3130850 3100000 90 3060900 3100000 3220900 3300000 95 3230950 3300000 3310950 3300000 100 3401000 3401000 3401000 3401000 On ARM quad core 1500MHz Krait: Without With Load Target Selected Target Selected 0 0 384000 384000 384000 5 75600 384000 440400 486000 10 151200 384000 496800 486000 15 226800 384000 553200 594000 20 302400 384000 609600 594000 25 378000 384000 666000 702000 30 453600 486000 722400 702000 35 529200 594000 778800 810000 40 604800 702000 835200 810000 45 680400 702000 891600 918000 50 756000 810000 948000 918000 55 831600 918000 1004400 1026000 60 907200 918000 1060800 1026000 65 982800 1026000 1117200 1134000 70 1058400 1134000 1173600 1134000 75 1134000 1134000 1230000 1242000 80 1209600 1242000 1286400 1242000 85 1285200 1350000 1342800 1350000 90 1360800 1458000 1399200 1350000 95 1436400 1458000 1455600 1458000 100 1512000 1512000 1512000 1512000 Tested on Intel i7-3770 CPU @ 3.40GHz and on ARM quad core 1500MHz Krait (Android smartphone). Benchmarks on Intel i7 shows a performance improvement on low and medium work loads with lower power consumption. Specifics: Phoronix Linux Kernel Compilation 3.1: Time: -0.40%, energy: -0.07% Phoronix Apache: Time: -4.98%, energy: -2.35% Phoronix FFMPEG: Time: -6.29%, energy: -4.02% Also, running mp3 decoding (very low load) shows no differences with and without this patch. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* devfreq: gpu: added simple time_in_state statsanarkia19762016-09-131-0/+21
| | | | | * All Credits to @andip71 * Modded to similar cpu stats table
* PM: devfreq: Always reflect a change of polling intervalmyfluxi2016-09-131-1/+1
| | | | Change-Id: Ie895bdf1ed1126e05483890f7ed64ac05890710a
* PM: devfreq: Fix simple_ondemand crashing on startupmyfluxi2016-09-131-1/+4
| | | | | | | simple_ondemands private data must be set to NULL, otherwise we would run into a NULL pointer in kgsl_devfreq_get_dev_status(). Change-Id: I6cc6a8b11e3b58b8c3e3c26d43ee36949cf62351
* devfreq: Use high priority workqueuemyfluxi2016-09-131-1/+4
| | | | | | | It does not make sense to run kgsl on high and devfreq on regular priority. Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* FIOPS: forward port for use on 3.10 LinuxPaul Reioux2016-09-131-6/+17
| | | | | Change-Id: I1ae7f50feda51b2aacb15c7b632cd38937b1edb5 Signed-off-by: Paul Reioux <reioux@gmail.com>
* block: fiops add some trace informationShaohua Li2016-09-131-1/+18
| | | | | | | Add some trace information, which is helpful when I do debugging. Change-Id: Ib1082fc2547fd56c2fadbb7a9596a3dc4c7b15c8 Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops bias sync workloadShaohua Li2016-09-131-0/+12
| | | | | | | | | If there are async requests running, delay async workload. Otherwise async workload (usually very deep iodepth) will use all queue iodepth and later sync requests will get long delayed. The idea is from CFQ. Change-Id: I66b8b87ca33c9e92ed52067cead54a4fc48c6426 Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops preserve vios key for deep queue depth workloadShaohua Li2016-09-131-3/+6
| | | | | | | | | | If the task has running request, even it's added into service tree newly, we preserve its vios key, so it will not lost its share. This should work for task driving big queue depth. For single depth task, there is no approach to preserve its vios key. Change-Id: I40bdaff6430b783b965ca434ffc46b7205b554cd Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops add ioprio supportShaohua Li2016-09-131-12/+93
| | | | | | | | Add CFQ-like ioprio support. Priority A will get 20% more share than priority A+1, which matches CFQ. Change-Id: I0d6f145810e3f0979440063c030cddf30ad4179c Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops sync/async scaleShaohua Li2016-09-131-0/+15
| | | | | | | | | | | | | | | | CFQ gives 2.5 times more share to sync workload. This matches CFQ. Note this is different with the read/write scale. We have 3 types of requests: 1. read 2. sync write 3. write CFQ doesn't differentitate type 1 and 2, but request cost of 1 and 2 are usually different for flash based storage. So we have both sync/async and read/write scale here. Change-Id: I3b36c94ba63df6d7a823c941a34a479da6243f20 Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops read/write request scaleShaohua Li2016-09-131-1/+70
| | | | | | | | | | | | read/write speed of Flash based storage usually is different. For example, in my SSD maxium thoughput of read is about 3 times faster than that of write. Add a scale to differenate read and write. Also add a tunable, so user can assign different scale for read and write. By default, the scale is 1:1, which means the scale is a noop. Change-Id: Ic223e96d1c72591ef535307755d78ff33dbc6939 Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* block: fiops ioscheduler coreShaohua Li2016-09-133-0/+568
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FIOPS (Fair IOPS) ioscheduler is IOPS based ioscheduler, so only targets for drive without I/O seek. It's quite similar like CFQ, but the dispatch decision is made according to IOPS instead of slice. The algorithm is simple. Drive has a service tree, and each task lives in the tree. The key into the tree is called vios (virtual I/O). Every request has vios, which is calculated according to its ioprio, request size and so on. Task's vios is the sum of vios of all requests it dispatches. FIOPS always selects task with minimum vios in the service tree and let the task dispatch request. The dispatched request's vios is then added to the task's vios and the task is repositioned in the sevice tree. Unlike CFQ, FIOPS doesn't have separate sync/async queues, because with I/O less writeback, usually a task can only dispatch either sync or async requests. Bias read or write request can still be done with read/write scale. One issue is if workload iodepth is lower than drive queue_depth, IOPS share of a task might not be strictly according to its priority, request Bias read or write request can still be done with read/write scale. One issue is if workload iodepth is lower than drive queue_depth, IOPS share of a task might not be strictly according to its priority, request size and so on. In this case, the drive is in idle actually. Solving the problem need make drive idle, so impact performance. I believe CFQ isn't completely fair between tasks in such case too. Change-Id: I1f86b964ada1e06ac979899ca05f1082d0d8228d Signed-off-by: Shaohua Li <shaohua.li@intel.com>
* less debugMoyster2016-09-111-1/+1
|
* defconfig: enable CONFIG_INET_DIAG_DESTROYMoyster2016-09-111-0/+1
|
* Update README.mdMoyster2016-09-101-1/+1
|
* selinux: enable genfscon labeling for sysfs and pstore filesStephen Smalley2016-09-101-1/+3
| | | | | | | | | | | | | | | | | | | | Support per-file labeling of sysfs and pstore files based on genfscon policy entries. This is safe because the sysfs and pstore directory tree cannot be manipulated by userspace, except to unlink pstore entries. This provides an alternative method of assigning per-file labeling to sysfs or pstore files without needing to set the labels from userspace on each boot. The advantages of this approach are that the labels are assigned as soon as the dentry is first instantiated and userspace does not need to walk the sysfs or pstore tree and set the labels on each boot. The limitations of this approach are that the labels can only be assigned based on pathname prefix matching. You can initially assign labels using this mechanism and then change them at runtime via setxattr if allowed to do so by policy. Change-Id: If5999785fdc1d24d869b23ae35cd302311e94562 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Suggested-by: Dominick Grift <dac.override@gmail.com>
* selinux: enable per-file labeling for debugfs files.Stephen Smalley2016-09-102-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | upstream commit 6f29997f4a3117169eeabd41dbea4c1bd94a739c Add support for per-file labeling of debugfs files so that we can distinguish them in policy. This is particularly important in Android where certain debugfs files have to be writable by apps and therefore the debugfs directory tree can be read and searched by all. Since debugfs is entirely kernel-generated, the directory tree is immutable by userspace, and the inodes are pinned in memory, we can simply use the same approach as with proc and label the inodes from policy based on pathname from the root of the debugfs filesystem. Generalize the existing labeling support used for proc and reuse it for debugfs too. [sds: Back-ported to 3.10. superblock_security_struct flags field is only unsigned char in 3.10 so we have to redefine SE_SBGENFS. However, this definition is kernel-private, not exposed to userspace or stored anywhere persistent.] Change-Id: I6460fbed6bb6bd36eb8554ac8c4fdd574edf3b07 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
* security: lsm_audit: add ioctl specific auditingJeff Vander Stoep2016-09-102-0/+22
| | | | | | | | | Add information about ioctl calls to the LSM audit data. Log the file path and command number. Bug: 18087110 Change-Id: Idbbd106db6226683cb30022d9e8f6f3b8fab7f84 Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
* BACKPORT: FROMLIST: arm64: mm: support ARCH_MMAP_RND_BITS.dcashman2016-09-102-3/+27
| | | | | | | | | | | | | | | | (cherry picked from commit https://lkml.org/lkml/2015/12/21/340) arm64: arch_mmap_rnd() uses STACK_RND_MASK to generate the random offset for the mmap base address. This value represents a compromise between increased ASLR effectiveness and avoiding address-space fragmentation. Replace it with a Kconfig option, which is sensibly bounded, so that platform developers may choose where to place this compromise. Keep default values as new minimums. Bug: 24047224 Signed-off-by: Daniel Cashman <dcashman@android.com> Signed-off-by: Daniel Cashman <dcashman@google.com> Change-Id: I7caf105b838cfc3ab55f275e1a061eb2b77c9a2a
* FROMLIST: arm: mm: support ARCH_MMAP_RND_BITS.dcashman2016-09-102-2/+10
| | | | | | | | | | | | | | | | (cherry picked from commit https://lkml.org/lkml/2015/12/21/341) arm: arch_mmap_rnd() uses a hard-code value of 8 to generate the random offset for the mmap base address. This value represents a compromise between increased ASLR effectiveness and avoiding address-space fragmentation. Replace it with a Kconfig option, which is sensibly bounded, so that platform developers may choose where to place this compromise. Keep 8 as the minimum acceptable value. Bug: 24047224 Signed-off-by: Daniel Cashman <dcashman@android.com> Signed-off-by: Daniel Cashman <dcashman@google.com> Change-Id: I89c23a8737c981116a67381c241fdd5556e2b043
* FROMLIST: mm: mmap: Add new /proc tunable for mmap_base ASLR.dcashman2016-09-105-0/+142
| | | | | | | | | | | | | | | | | (cherry picked from commit https://lkml.org/lkml/2015/12/21/337) ASLR only uses as few as 8 bits to generate the random offset for the mmap base address on 32 bit architectures. This value was chosen to prevent a poorly chosen value from dividing the address space in such a way as to prevent large allocations. This may not be an issue on all platforms. Allow the specification of a minimum number of bits so that platforms desiring greater ASLR protection may determine where to place the trade-off. Bug: 24047224 Signed-off-by: Daniel Cashman <dcashman@android.com> Signed-off-by: Daniel Cashman <dcashman@google.com> Change-Id: I66ac01c6f4f2c8dcfc84d1f1e99490b8385b3ed4
* selinux: nlmsgtab: add SOCK_DESTROY to the netlink mapping tablesLorenzo Colitti2016-09-101-3/+4
| | | | | | | | Without this, using SOCK_DESTROY in enforcing mode results in: SELinux: unrecognized netlink message type=21 for sclass=32 Change-Id: I7862bb0fc83573567243ffa9549a2c7405b5986c
* net: diag: support v4mapped sockets in inet_diag_find_one_icsk()Eric Dumazet2016-09-101-6/+12
| | | | | | | | | | | | | Lorenzo reported that we could not properly find v4mapped sockets in inet_diag_find_one_icsk(). This patch fixes the issue. [Cherry-pick of net 7c1306723ee916ea9f1fa7d9e4c7a6d029ca7aaf] Change-Id: If71ddbc2f082e708e5fa9d60f5c08702a09e2884 Reported-by: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: tcp: deal with listen sockets properly in tcp_abort.Lorenzo Colitti2016-09-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | When closing a listen socket, tcp_abort currently calls tcp_done without clearing the request queue. If the socket has a child socket that is established but not yet accepted, the child socket is then left without a parent, causing a leak. Fix this by setting the socket state to TCP_CLOSE and calling inet_csk_listen_stop with the socket lock held, like tcp_close does. Tested using net_test. With this patch, calling SOCK_DESTROY on a listen socket that has an established but not yet accepted child socket results in the parent and the child being closed, such that they no longer appear in sock_diag dumps. [Backport of net-next 2010b93e9317cc12acd20c4aed385af7f9d1681e] Change-Id: I2b9c38fab194b3c4e11439047ead9582c811d4c2 Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: diag: Support destroying TCP sockets.Lorenzo Colitti2016-09-106-0/+68
| | | | | | | | | | | | | | | | This implements SOCK_DESTROY for TCP sockets. It causes all blocking calls on the socket to fail fast with ECONNABORTED and causes a protocol close of the socket. It informs the other end of the connection by sending a RST, i.e., initiating a TCP ABORT as per RFC 793. ECONNABORTED was chosen for consistency with FreeBSD. [Backport of net-next c1e64e298b8cad309091b95d8436a0255c84f54a] Change-Id: Ice9aad37741fe497341d1d2a51e0b70601a99c90 Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: diag: Support SOCK_DESTROY for inet sockets.Lorenzo Colitti2016-09-102-8/+19
| | | | | | | | | | | | | | | | | | This passes the SOCK_DESTROY operation to the underlying protocol diag handler, or returns -EOPNOTSUPP if that handler does not define a destroy operation. Most of this patch is just renaming functions. This is not strictly necessary, but it would be fairly counterintuitive to have the code to destroy inet sockets be in a function whose name starts with inet_diag_get. [Backport of net-next 6eb5d2e08f071c05ecbe135369c9ad418826cab2] Change-Id: Iee2c858bf11c48f54890b85b87821a2a2d7109e1 Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: diag: Add the ability to destroy a socket.Lorenzo Colitti2016-09-104-3/+24
| | | | | | | | | | | | | This patch adds a SOCK_DESTROY operation, a destroy function pointer to sock_diag_handler, and a diag_destroy function pointer. It does not include any implementation code. [Backport of net-next 64be0aed59ad519d6f2160868734f7e278290ac1] Change-Id: I3db262a7e41f1f8452ff0968d4001234598190d8 Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: diag: split inet_diag_dump_one_icsk into twoLorenzo Colitti2016-09-102-14/+37
| | | | | | | | | | | | | Currently, inet_diag_dump_one_icsk finds a socket and then dumps its information to userspace. Split it into a part that finds the socket and a part that dumps the information. [Backport of net-next b613f56ec9baf30edf5d9d607b822532a273dad7] Change-Id: I7aec27aca9c3e395e41332fe4e59d720042e0609 Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>