4.16.17-stable review
Subsystems (18)
Re: [PATCH 4.16 161/279] kthread, sched/wait: Fix kthread_parkme() completion issue
In reply to Greg Kroah-HartmanHi Greg,
As more patches related to this are coming in 4.17, so it is better if all go together on different branches, plz suggest.
Regards
Gaurav
Quoted 203 lines · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit
85f1abe0019fcb3ea10df7029056cf42702283a8]Even with the wait-loop fixed, there is a further issue with
kthread_parkme(). Upon hotplug, when we dotakedown_cpu(),smpboot_park_threads()can return before all those threads are in fact blocked, due to the placement of thecomplete()in__kthread_parkme().When that happens,
sched_cpu_dying()->migrate_tasks()can end up migrating such a still runnable task onto another CPU.Normally the task will have hit
schedule()and gone to sleep by the time we dokthread_unpark(), which will then do__kthread_bind()to re-bind the task to the correct CPU.However, when we loose the initial
TASK_PARKEDstore to the concurrent wakeup issue described previously, do thecomplete(), get migrated, it is possible to either:- observe kthread_unpark()'s clearing of
SHOULD_PARKand terminate the park and setTASK_RUNNING, or- __kthread_bind()'s
wait_task_inactive()to observe the competingTASK_RUNNINGstore.Either way the
WARN()in__kthread_bind()will trigger and fail to correctly set the CPU affinity.Fix this by only issuing the
complete()when the kthread has scheduled out. This does away with all the icky 'still running' nonsense.The alternative is to promote
TASK_PARKEDto a special state, this guaranteeswait_task_inactive()cannot observe a 'stale'TASK_RUNNINGand we'll end up doing the right thing, but this preserves the whole icky business of potentially migating the still runnable thing.Reported-by Gaurav Kohli <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Cc Linus Torvalds <[email protected]>Cc Oleg Nesterov <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/kthread.h | 1 + kernel/kthread.c | 43 +++++++++++++++++++------------------------ kernel/sched/core.c | 32 +++++++++++++++++++++----------- 3 files changed, 41 insertions(+), 35 deletions(-)include/linux/kthread.h +1
-0@@ -62,6 +62,7 @@ void *kthread_probe_data(struct task_strint kthread_park (struct task_struct *k);void kthread_unpark (struct task_struct *k);void kthread_parkme (void ); +void kthread_park_complete (struct task_struct *k);int kthreadd (void *unused);extern struct task_struct *kthreadd_task;kernel/kthread.c +19
-24@@ -55,7 +55,6 @@ enum KTHREAD_BITS {KTHREAD_IS_PER_CPU =0 ,KTHREAD_SHOULD_STOP , KTHREAD_SHOULD_PARK, - KTHREAD_IS_PARKED, };static inline void set_kthread_struct (void *kthread)@@ -181,11 +180,8 @@ static void __kthread_parkme(struct kthrset_current_state (TASK_PARKED );if (!test_bit (KTHREAD_SHOULD_PARK , &self->flags))break ; -if (!test_and_set_bit (KTHREAD_IS_PARKED , &self->flags)) -complete (&self->parked);schedule (); } -clear_bit (KTHREAD_IS_PARKED , &self->flags);__set_current_state (TASK_RUNNING ); }@@ -195,6 +191,11 @@ void kthread_parkme(void) }EXPORT_SYMBOL_GPL (kthread_parkme); +void kthread_park_complete (struct task_struct *k) +{ +complete (&to_kthread (k)->parked); +} +static int kthread (void *_create) {/* Copy data: it's on kthread's stack */ @@ -451,22 +452,15 @@ void kthread_unpark(struct task_struct * {struct kthread *kthread =to_kthread (k); -clear_bit (KTHREAD_SHOULD_PARK , &kthread->flags);/* -* We clear the IS_PARKED bit here as we don't wait -* until the task has left the park code. So if we'd -* park before that happens we'd see the IS_PARKED bit -* which might be about to be cleared. +* Newly created kthread was parked when the CPU was offline. +* The binding was lost and we need to set it again. */ -if (test_and_clear_bit (KTHREAD_IS_PARKED , &kthread->flags)) { -/* -* Newly created kthread was parked when the CPU was offline. -* The binding was lost and we need to set it again. -*/ -if (test_bit (KTHREAD_IS_PER_CPU , &kthread->flags)) -__kthread_bind (k, kthread->cpu,TASK_PARKED ); -wake_up_state (k,TASK_PARKED ); - } +if (test_bit (KTHREAD_IS_PER_CPU , &kthread->flags)) +__kthread_bind (k, kthread->cpu,TASK_PARKED ); + +clear_bit (KTHREAD_SHOULD_PARK , &kthread->flags); +wake_up_state (k,TASK_PARKED ); }EXPORT_SYMBOL_GPL (kthread_unpark);@@ -489,12 +483,13 @@ int kthread_park(struct task_struct *k)if (WARN_ON (k->flags &PF_EXITING ))return -ENOSYS ; -if (!test_bit (KTHREAD_IS_PARKED , &kthread->flags)) { -set_bit (KTHREAD_SHOULD_PARK , &kthread->flags); -if (k != current) { -wake_up_process (k); -wait_for_completion (&kthread->parked); - } +if (WARN_ON_ONCE (test_bit (KTHREAD_SHOULD_PARK , &kthread->flags))) +return -EBUSY ; + +set_bit (KTHREAD_SHOULD_PARK , &kthread->flags); +if (k != current) { +wake_up_process (k); +wait_for_completion (&kthread->parked); }return 0 ;kernel/sched/core.c +21
-11@@ -30,6 +30,8 @@#include <linux/syscalls.h> #include <linux/sched/isolation.h> +#include <linux/kthread.h> +#include <asm/switch_to.h> #include <asm/tlb.h> #ifdef CONFIG_PARAVIRT @@ -2733,20 +2735,28 @@ static struct rq *finish_task_switch(strmembarrier_mm_sync_core_before_usermode (mm);mmdrop (mm); } -if (unlikely (prev_state ==TASK_DEAD )) { -if (prev->sched_class->task_dead) - prev->sched_class->task_dead (prev); +if (unlikely (prev_state & (TASK_DEAD |TASK_PARKED ))) { +switch (prev_state) { +case TASK_DEAD : +if (prev->sched_class->task_dead) + prev->sched_class->task_dead (prev); + +/* +* Remove function-return probe instances associated with this +* task and put them back on the free list. +*/ +kprobe_flush_task (prev); -/* -* Remove function-return probe instances associated with this -* task and put them back on the free list. -*/ -kprobe_flush_task (prev); +/* Task is done with its stack. */ +put_task_stack (prev); -/* Task is done with its stack. */ -put_task_stack (prev); +put_task_struct (prev); +break ; -put_task_struct (prev); +case TASK_PARKED : +kthread_park_complete (prev); +break ; + } }tick_nohz_task_switch ();
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.16 161/279] kthread, sched/wait: Fix kthread_parkme() completion issue
Quoted 4 lines · Gaurav
Hi Greg,
As more patches related to this are coming in 4.17, so it is better if all go together on different branches, plz suggest.
I do not understand, sorry. What is wrong with this as-is? If I need to take other patches as well, please let me know what commits and what stable tree(s) they belong on.
thanks,
greg k-h
Re: [PATCH 4.16 161/279] kthread, sched/wait: Fix kthread_parkme() completion issue
HI Greg,
Yes more patches related to this are coming,
https://lkml.org/lkml/2018/6/7/317
So i thought, if all go together then it is good.
Regards
Gaurav
Quoted 14 lines · Greg Kroah-Hartman
Quoted 4 lines · Gaurav
Hi Greg,
As more patches related to this are coming in 4.17, so it is better if all go together on different branches, plz suggest.
I do not understand, sorry. What is wrong with this as-is? If I need to take other patches as well, please let me know what commits and what stable tree(s) they belong on.
thanks,
greg k-h
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Greg Kroah-Hartman
maintainerRe: [PATCH 4.16 161/279] kthread, sched/wait: Fix kthread_parkme() completion issue
Quoted 6 lines · Gaurav
HI Greg,
Yes more patches related to this are coming,
https://lkml.org/lkml/2018/6/7/317So i thought, if all go together then it is good.
I still do not understand what you are asking me to do here. Maybe it's the jetlag, but can you spell it out for me?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 162/279 arm64: tegra: Make BCM89610 PHY interrupt as active low
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhadram Varka <[email protected]>
[ Upstream commit 9df50ba76ac1485b844beffa1f3f5d9659d9cdaf ]
Need to configure PHY interrupt as active low for P3310 Tegra186 platform otherwise it results in spurious interrupts.
This issue wasn't seen before because the generic PHY driver without interrupt support was used.
--- arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi +1 -1
@@ -46,7 +46,7 @@ compatible = "ethernet-phy-ieee802.3-c22"; reg = <0x0>; interrupt-parent = <&gpio>; - interrupts = <TEGRA_MAIN_GPIO(M, 5) IRQ_TYPE_LEVEL_HIGH>; + interrupts = <TEGRA_MAIN_GPIO(M, 5) IRQ_TYPE_LEVEL_LOW>; }; }; };
Greg Kroah-Hartman
maintainerPATCH 163/279 iommu/vt-d: Fix usage of force parameter in intel_ir_reconfigure_irte()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jagannathan Raman <[email protected]>
[ Upstream commit aa7528fe3576d11f4a10237178a723a1f080a547 ]
It was noticed that the IRTE configured for guest OS kernel was over-written while the guest was running. As a result, vt-d Posted Interrupts configured for the guest are not being delivered directly, and instead bounces off the host. Every interrupt delivery takes a VM Exit.
It was noticed that the following stack is doing the over-write:
[ 147.463177] modify_irte+0x171/0x1f0 [ 147.463405] intel_ir_set_affinity+0x5c/0x80 [ 147.463641] msi_domain_set_affinity+0x32/0x90 [ 147.463881] irq_do_set_affinity+0x37/0xd0 [ 147.464125] irq_set_affinity_locked+0x9d/0xb0 [ 147.464374] __irq_set_affinity+0x42/0x70 [ 147.464627] write_irq_affinity.isra.5+0xe1/0x110 [ 147.464895] proc_reg_write+0x38/0x70 [ 147.465150] __vfs_write+0x36/0x180 [ 147.465408] ? handle_mm_fault+0xdf/0x200 [ 147.465671] ? _cond_resched+0x15/0x30 [ 147.465936] vfs_write+0xad/0x1a0 [ 147.466204] SyS_write+0x52/0xc0 [ 147.466472] do_syscall_64+0x74/0x1a0 [ 147.466744] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
reversing the sense of force check in intel_ir_reconfigure_irte() restores proper posted interrupt functionality
--- drivers/iommu/intel_irq_remapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel_irq_remapping.c +1 -1
@@ -1136,7 +1136,7 @@ static void intel_ir_reconfigure_irte(st irte->dest_id =IRTE_DEST (cfg->dest_apicid);/* Update the hardware only if the interrupt is in remapped mode. */ -if (!force || ir_data->irq_2_iommu.mode ==IRQ_REMAPPING ) +if (force || ir_data->irq_2_iommu.mode ==IRQ_REMAPPING )modify_irte (&ir_data->irq_2_iommu, irte); }
Greg Kroah-Hartman
maintainerPATCH 164/279 iommu/vt-d: fix shift-out-of-bounds in bug checking
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changbin Du <[email protected]>
[ Upstream commit 0dfc0c792d691f8056f38b5c30789f504be0e467 ]
It allows to flush more than 4GB of device TLBs. So the mask should be 64bit wide. UBSAN captured this fault as below.
[ 3.760024] ================================================================================ [ 3.768440] UBSAN: Undefined behaviour in drivers/iommu/dmar.c:1348:3 [ 3.774864] shift exponent 64 is too large for 32-bit type 'int' [ 3.780853] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G U 4.17.0-rc1+ #89 [ 3.788661] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 1.2.8 01/26/2016 [ 3.796034] Call Trace: [ 3.798472] <IRQ> [ 3.800479] dump_stack+0x90/0xfb [ 3.803787] ubsan_epilogue+0x9/0x40 [ 3.807353] __ubsan_handle_shift_out_of_bounds+0x10e/0x170 [ 3.812916] ? qi_flush_dev_iotlb+0x124/0x180 [ 3.817261] qi_flush_dev_iotlb+0x124/0x180 [ 3.821437] iommu_flush_dev_iotlb+0x94/0xf0 [ 3.825698] iommu_flush_iova+0x10b/0x1c0 [ 3.829699] ? fq_ring_free+0x1d0/0x1d0 [ 3.833527] iova_domain_flush+0x25/0x40 [ 3.837448] fq_flush_timeout+0x55/0x160 [ 3.841368] ? fq_ring_free+0x1d0/0x1d0 [ 3.845200] ? fq_ring_free+0x1d0/0x1d0 [ 3.849034] call_timer_fn+0xbe/0x310 [ 3.852696] ? fq_ring_free+0x1d0/0x1d0 [ 3.856530] run_timer_softirq+0x223/0x6e0 [ 3.860625] ? sched_clock+0x5/0x10 [ 3.864108] ? sched_clock+0x5/0x10 [ 3.867594] __do_softirq+0x1b5/0x6f5 [ 3.871250] irq_exit+0xd4/0x130 [ 3.874470] smp_apic_timer_interrupt+0xb8/0x2f0 [ 3.879075] apic_timer_interrupt+0xf/0x20 [ 3.883159] </IRQ> [ 3.885255] RIP: 0010:poll_idle+0x60/0xe7 [ 3.889252] RSP: 0018:ffffb1b201943e30 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 [ 3.896802] RAX: 0000000080200000 RBX: 000000000000008e RCX: 000000000000001f [ 3.903918] RDX: 0000000000000000 RSI: 000000002819aa06 RDI: 0000000000000000 [ 3.911031] RBP: ffff9e93c6b33280 R08: 00000010f717d567 R09: 000000000010d205 [ 3.918146] R10: ffffb1b201943df8 R11: 0000000000000001 R12: 00000000e01b169d [ 3.925260] R13: 0000000000000000 R14: ffffffffb12aa400 R15: 0000000000000000 [ 3.932382] cpuidle_enter_state+0xb4/0x470 [ 3.936558] do_idle+0x222/0x310 [ 3.939779] cpu_startup_entry+0x78/0x90 [ 3.943693] start_secondary+0x205/0x2e0 [ 3.947607] secondary_startup_64+0xa5/0xb0 [ 3.951783] ================================================================================
--- drivers/iommu/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/dmar.c +1 -1
@@ -1345,7 +1345,7 @@ void qi_flush_dev_iotlb(struct intel_iomstruct qi_desc desc;if (mask) { -BUG_ON (addr & ((1 << (VTD_PAGE_SHIFT + mask)) -1 )); +BUG_ON (addr & ((1ULL << (VTD_PAGE_SHIFT + mask)) -1 )); addr |= (1ULL << (VTD_PAGE_SHIFT + mask -1 )) -1 ; desc.high =QI_DEV_IOTLB_ADDR (addr) |QI_DEV_IOTLB_SIZE ; }else
Greg Kroah-Hartman
maintainerPATCH 165/279 nvme: fix potential memory leak in option parsing
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengguang Xu <[email protected]>
[ Upstream commit 59a2f3f00fd744dbad22593f47552037d3154ca6 ]
When specifying same string type option several times, current option parsing may cause memory leak. Hence, call kfree for previous one in this case.
--- drivers/nvme/host/fabrics.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/host/fabrics.c +6 -0
@@ -668,6 +668,7 @@ static int nvmf_parse_options(struct nvm ret = -ENOMEM ; goto out; } +kfree (opts->transport); opts->transport = p;break ;case NVMF_OPT_NQN :
@@ -676,6 +677,7 @@ static int nvmf_parse_options(struct nvm ret = -ENOMEM ; goto out; } +kfree (opts->subsysnqn); opts->subsysnqn = p; nqnlen =strlen (opts->subsysnqn);if (nqnlen >=NVMF_NQN_SIZE ) {
@@ -698,6 +700,7 @@ static int nvmf_parse_options(struct nvm ret = -ENOMEM ; goto out; } +kfree (opts->traddr); opts->traddr = p;break ;case NVMF_OPT_TRSVCID :
@@ -706,6 +709,7 @@ static int nvmf_parse_options(struct nvm ret = -ENOMEM ; goto out; } +kfree (opts->trsvcid); opts->trsvcid = p;break ;case NVMF_OPT_QUEUE_SIZE :
@@ -792,6 +796,7 @@ static int nvmf_parse_options(struct nvm ret = -EINVAL ; goto out; } +nvmf_host_put (opts->host); opts->host =nvmf_host_add (p);kfree (p);if (!opts->host) {
@@ -817,6 +822,7 @@ static int nvmf_parse_options(struct nvm ret = -ENOMEM ; goto out; } +kfree (opts->host_traddr); opts->host_traddr = p;break ;case NVMF_OPT_HOST_ID :
Greg Kroah-Hartman
maintainerPATCH 166/279 nvme: Set integrity flag for user passthrough commands
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit f31a21103c03bb62846409fdc60cc9faf2398cfb ]
If the command a separate metadata buffer attached, the request needs to have the integrity flag set so the driver knows to map it.
--- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
@@ -767,6 +767,7 @@ static int nvme_submit_user_cmd(struct r ret =PTR_ERR (meta); goto out_unmap; } + req->cmd_flags |=REQ_INTEGRITY ; } }
Greg Kroah-Hartman
maintainerPATCH 167/279 nvme/multipath: Disable runtime writable enabling parameter
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 5cadde8019a6a80550fdde92d5a3327565974eab ]
We can't allow the user to change multipath settings at runtime, as this will create naming conflicts due to the different naming schemes used for each mode.
--- drivers/nvme/host/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/multipath.c +1 -1
@@ -15,7 +15,7 @@#include "nvme.h" static bool multipath = true; -module_param (multipath, bool,0644 ); +module_param (multipath, bool,0444 );MODULE_PARM_DESC (multipath,"turn on native support for multiple controllers per subsystem" );
Greg Kroah-Hartman
maintainerPATCH 168/279 nvme/multipath: Fix multipath disabled naming collisions
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit a785dbccd95c37606c720580714f5a7a8b3255f1 ]
When CONFIG_NVME_MULTIPATH is set, but we're not using nvme to multipath, namespaces with multiple paths were not creating unique names due to reusing the same instance number from the namespace's head.
This patch fixes this by falling back to the non-multipath naming method when the parameter disabled using multipath.
--- drivers/nvme/host/core.c | 26 +------------------------- drivers/nvme/host/multipath.c | 22 ++++++++++++++++++++++ drivers/nvme/host/nvme.h | 12 ++++++++++++ 3 files changed, 35 insertions(+), 25 deletions(-)
drivers/nvme/host/core.c +1 -25
@@ -2979,31 +2979,7 @@ static void nvme_alloc_ns(struct nvme_ctif (nvme_init_ns_head (ns, nsid, id)) goto out_free_id;nvme_setup_streams_ns (ctrl, ns); - -#ifdef CONFIG_NVME_MULTIPATH -/* -* If multipathing is enabled we need to always use the subsystem -* instance number for numbering our devices to avoid conflicts -* between subsystems that have multiple controllers and thus use -* the multipath-aware subsystem node and those that have a single -* controller and use the controller node directly. -*/ -if (ns->head->disk) { -sprintf (disk_name,"nvme%dc%dn%d" , ctrl->subsys->instance, - ctrl->cntlid, ns->head->instance); - flags =GENHD_FL_HIDDEN ; - }else { -sprintf (disk_name,"nvme%dn%d" , ctrl->subsys->instance, - ns->head->instance); - } -#else -/* -* But without the multipath code enabled, multiple controller per -* subsystems are visible as devices and thus we cannot use the -* subsystem instance. -*/ -sprintf (disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); -#endif +nvme_set_disk_name (disk_name, ns, ctrl, &flags);if ((ctrl->quirks &NVME_QUIRK_LIGHTNVM ) && id->vs[0 ] ==0x1 ) {if (nvme_nvm_register (ns, disk_name, node)) {
drivers/nvme/host/multipath.c +22 -0
@@ -19,6 +19,28 @@ module_param(multipath, bool, 0444);MODULE_PARM_DESC (multipath,"turn on native support for multiple controllers per subsystem" ); +/* +* If multipathing is enabled we need to always use the subsystem instance +* number for numbering our devices to avoid conflicts between subsystems that +* have multiple controllers and thus use the multipath-aware subsystem node +* and those that have a single controller and use the controller node +* directly. +*/ +void nvme_set_disk_name (char *disk_name,struct nvme_ns *ns, +struct nvme_ctrl *ctrl,int *flags) +{ +if (!multipath) { +sprintf (disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); + }else if (ns->head->disk) { +sprintf (disk_name,"nvme%dc%dn%d" , ctrl->subsys->instance, + ctrl->cntlid, ns->head->instance); + *flags =GENHD_FL_HIDDEN ; + }else { +sprintf (disk_name,"nvme%dn%d" , ctrl->subsys->instance, + ns->head->instance); + } +} +void nvme_failover_req (struct request *req) {struct nvme_ns *ns = req->q->queuedata;
drivers/nvme/host/nvme.h +12 -0
@@ -411,6 +411,8 @@ extern const struct attribute_group nvmeextern const struct block_device_operations nvme_ns_head_ops;#ifdef CONFIG_NVME_MULTIPATH +void nvme_set_disk_name (char *disk_name,struct nvme_ns *ns, +struct nvme_ctrl *ctrl,int *flags);void nvme_failover_req (struct request *req);bool nvme_req_needs_failover (struct request *req,blk_status_t error);void nvme_kick_requeue_lists (struct nvme_ctrl *ctrl);
@@ -436,6 +438,16 @@ static inline void nvme_mpath_check_last }#else +/* +* Without the multipath code enabled, multiple controller per subsystems are +* visible as devices and thus we cannot use the subsystem instance. +*/ +static inline void nvme_set_disk_name (char *disk_name,struct nvme_ns *ns, +struct nvme_ctrl *ctrl,int *flags) +{ +sprintf (disk_name,"nvme%dn%d" , ctrl->instance, ns->head->instance); +} +static inline void nvme_failover_req (struct request *req) { }
Greg Kroah-Hartman
maintainerPATCH 169/279 ARM: OMAP1: ams-delta: fix deferred_fiq handler
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janusz Krzysztofik <[email protected]>
[ Upstream commit baf64250b4a513bf4ac226fd938692dc1836f4f6 ]
The deferred_fiq handler used to limit hardware operations to IRQ unmask only, relying on gpio-omap assigned handler performing the ACKs. Since commit 80ac93c27441 ("gpio: omap: Fix lost edge interrupts") this is no longer the case as handle_edge_irq() has been replaced with handle_simmple_irq() which doesn't touch the hardware.
Add single ACK operation per each active IRQ pin to the handler. While being at it, move unmask operation out of irq_counter loop so it is also called only once for each active IRQ pin.
--- arch/arm/mach-omap1/ams-delta-fiq.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
arch/arm/mach-omap1/ams-delta-fiq.c +14 -12
@@ -58,22 +58,24 @@ static irqreturn_t deferred_fiq(int irq, irq_num =gpio_to_irq (gpio); fiq_count = fiq_buffer[FIQ_CNT_INT_00 + gpio]; -while (irq_counter[gpio] < fiq_count) { -if (gpio !=AMS_DELTA_GPIO_PIN_KEYBRD_CLK ) { -struct irq_data *d =irq_get_irq_data (irq_num); +if (irq_counter[gpio] < fiq_count && + gpio !=AMS_DELTA_GPIO_PIN_KEYBRD_CLK ) { +struct irq_data *d =irq_get_irq_data (irq_num); -/* -* It looks like handle_edge_irq() that -* OMAP GPIO edge interrupts default to, -* expects interrupt already unmasked. -*/ -if (irq_chip && irq_chip->irq_unmask) +/* +* handle_simple_irq() that OMAP GPIO edge +* interrupts default to since commit 80ac93c27441 +* requires interrupt already acked and unmasked. +*/ +if (irq_chip) { +if (irq_chip->irq_ack) + irq_chip->irq_ack (d); +if (irq_chip->irq_unmask) irq_chip->irq_unmask (d); } -generic_handle_irq (irq_num); - - irq_counter[gpio]++; } +for (; irq_counter[gpio] < fiq_count; irq_counter[gpio]++) +generic_handle_irq (irq_num); }return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 170/279 ARM: dts: correct missing "compatible" entry for ti81xx SoCs
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Graeme Smecher <[email protected]>
[ Upstream commit 647efef69de483f1dd7944ede31b4cae16acb124 ]
The missing "compatible" entries are needed by drivers/clk/ti/clkctrl.c, and without them the structures initialized in drivers/clk/ti/clk-814x.c are not passed to configuration code. The result is a "not found from clkctrl data" error message, although boot proceeds anyway.
The reason why the compatible is not found is because the board specific files override the SoC compatible without including it. This did not cause any issues until with the clkctrl nodes got introduced.
Very lightly tested on a (lurching) AM3874 design that's in the middle of a kernel upgrade from TI's abandoned 2.6.37 tree.
Also tested on j5eco-evm and hp-t410 to verify the clkctrl clocks are found.
--- arch/arm/boot/dts/dm8148-evm.dts | 2 +- arch/arm/boot/dts/dm8148-t410.dts | 2 +- arch/arm/boot/dts/dm8168-evm.dts | 2 +- arch/arm/boot/dts/dra62x-j5eco-evm.dts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dm8148-evm.dts +1 -1
@@ -10,7 +10,7 @@ / { model = "DM8148 EVM"; - compatible = "ti,dm8148-evm", "ti,dm8148"; + compatible = "ti,dm8148-evm", "ti,dm8148", "ti,dm814"; memory@80000000 { device_type = "memory";
arch/arm/boot/dts/dm8148-t410.dts +1 -1
@@ -9,7 +9,7 @@ / { model = "HP t410 Smart Zero Client"; - compatible = "hp,t410", "ti,dm8148"; + compatible = "hp,t410", "ti,dm8148", "ti,dm814"; memory@80000000 { device_type = "memory";
arch/arm/boot/dts/dm8168-evm.dts +1 -1
@@ -10,7 +10,7 @@ / { model = "DM8168 EVM"; - compatible = "ti,dm8168-evm", "ti,dm8168"; + compatible = "ti,dm8168-evm", "ti,dm8168", "ti,dm816"; memory@80000000 { device_type = "memory";
arch/arm/boot/dts/dra62x-j5eco-evm.dts +1 -1
@@ -10,7 +10,7 @@ / { model = "DRA62x J5 Eco EVM"; - compatible = "ti,dra62x-j5eco-evm", "ti,dra62x", "ti,dm8148"; + compatible = "ti,dra62x-j5eco-evm", "ti,dra62x", "ti,dm8148", "ti,dm814"; memory@80000000 { device_type = "memory";
Greg Kroah-Hartman
maintainerPATCH 171/279 usb: typec: tps6598x: handle block reads separately with plain-I2C adapters
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heikki Krogerus <[email protected]>
[ Upstream commit 1a2f474d328f292ee706414824ec4ca690cdf5ba ]
If the I2C adapter that the PD controller is attached to does not support SMBus protocol, the driver needs to handle block reads separately. The first byte returned in block read protocol will show the total number of bytes. It needs to be stripped away.
This is handled separately in the driver only because right now we have no way of requesting the used protocol with regmap-i2c. This is in practice a workaround for what is really a problem in regmap-i2c. The other option would have been to register custom regmap, or not use regmap at all, however, since the solution is very simple, I choose to use it in this case for convenience. It is easy to remove once we figure out how to handle this kind of cases in regmap-i2c.
--- drivers/usb/typec/tps6598x.c | 47 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-)
drivers/usb/typec/tps6598x.c +39 -8
@@ -73,6 +73,7 @@ struct tps6598x {struct device *dev;struct regmap *regmap;struct mutex lock;/* device lock */ + u8 i2c_protocol:1;struct typec_port *port;struct typec_partner *partner;
@@ -80,19 +81,39 @@ struct tps6598x {struct typec_capability typec_cap; }; +static int +tps6598x_block_read (struct tps6598x *tps,u8 reg,void *val,size_t len) +{ +u8 data[len +1 ]; +int ret; + +if (!tps->i2c_protocol) +return regmap_raw_read (tps->regmap, reg, val, len); + + ret =regmap_raw_read (tps->regmap, reg, data,sizeof (data)); +if (ret) +return ret; + +if (data[0 ] < len) +return -EIO ; + +memcpy (val, &data[1 ], len); +return 0 ; +} +static inline int tps6598x_read16 (struct tps6598x *tps,u8 reg,u16 *val) { -return regmap_raw_read (tps->regmap, reg, val,sizeof (u16)); +return tps6598x_block_read (tps, reg, val,sizeof (u16)); }static inline int tps6598x_read32 (struct tps6598x *tps,u8 reg,u32 *val) { -return regmap_raw_read (tps->regmap, reg, val,sizeof (u32)); +return tps6598x_block_read (tps, reg, val,sizeof (u32)); }static inline int tps6598x_read64 (struct tps6598x *tps,u8 reg,u64 *val) { -return regmap_raw_read (tps->regmap, reg, val,sizeof (u64)); +return tps6598x_block_read (tps, reg, val,sizeof (u64)); }static inline int tps6598x_write16 (struct tps6598x *tps,u8 reg,u16 val)
@@ -121,8 +142,8 @@ static int tps6598x_read_partner_identitstruct tps6598x_rx_identity_reg id;int ret; - ret =regmap_raw_read (tps->regmap,TPS_REG_RX_IDENTITY_SOP , - &id,sizeof (id)); + ret =tps6598x_block_read (tps,TPS_REG_RX_IDENTITY_SOP , + &id,sizeof (id));if (ret)return ret;
@@ -223,13 +244,13 @@ static int tps6598x_exec_cmd(struct tps6 }while (val);if (out_len) { - ret =regmap_raw_read (tps->regmap,TPS_REG_DATA1 , - out_data, out_len); + ret =tps6598x_block_read (tps,TPS_REG_DATA1 , + out_data, out_len);if (ret)return ret; val = out_data[0 ]; }else { - ret =regmap_read (tps->regmap,TPS_REG_DATA1 , &val); + ret =tps6598x_block_read (tps,TPS_REG_DATA1 , &val,sizeof (u8));if (ret)return ret; }
@@ -384,6 +405,16 @@ static int tps6598x_probe(struct i2c_cliif (!vid)return -ENODEV ; +/* +* Checking can the adapter handle SMBus protocol. If it can not, the +* driver needs to take care of block reads separately. +* +* FIXME: Testing with I2C_FUNC_I2C. regmap-i2c uses I2C protocol +* unconditionally if the adapter has I2C_FUNC_I2C set. +*/ +if (i2c_check_functionality (client->adapter,I2C_FUNC_I2C )) + tps->i2c_protocol = true; + ret =tps6598x_read32 (tps,TPS_REG_STATUS , &status);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 172/279 smc: fix sendpage() call
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Raspl <[email protected]>
[ Upstream commit bda27ff5c4526f80a7620a94ecfe8dca153e3696 ]
The sendpage() call grabs the sock lock before calling the default implementation - which tries to grab it once again.
--- net/smc/af_smc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/smc/af_smc.c +4 -2
@@ -1313,8 +1313,11 @@ static ssize_t smc_sendpage(struct socke smc =smc_sk (sk);lock_sock (sk); -if (sk->sk_state !=SMC_ACTIVE ) +if (sk->sk_state !=SMC_ACTIVE ) { +release_sock (sk); goto out; + } +release_sock (sk);if (smc->use_fallback) rc =kernel_sendpage (smc->clcsock, page, offset, size, flags);
@@ -1322,7 +1325,6 @@ static ssize_t smc_sendpage(struct socke rc =sock_no_sendpage (sock, page, offset, size, flags); out: -release_sock (sk);return rc; }
Greg Kroah-Hartman
maintainerPATCH 173/279 IB/hfi1 Use correct type for num_user_context
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Michael J. Ruhl" <[email protected]>
[ Upstream commit 5da9e742be44d9b7c68b1bf6e1aaf46a1aa7a52b ]
The module parameter num_user_context is defined as 'int' and defaults to -1. The module_param_named() says that it is uint.
Correct module_param_named() type information and update the modinfo text to reflect the default value.
--- drivers/infiniband/hw/hfi1/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/init.c +2 -2
@@ -88,9 +88,9 @@* pio buffers per ctxt, etc.) Zero means use one user context per CPU. */ int num_user_contexts =-1 ; -module_param_named (num_user_contexts, num_user_contexts, uint,S_IRUGO ); +module_param_named (num_user_contexts, num_user_contexts, int,0444 );MODULE_PARM_DESC ( - num_user_contexts,"Set max number of user contexts to use" ); + num_user_contexts,"Set max number of user contexts to use (default: -1 will use the real (non-HT) CPU count)" );uint krcvqs[RXE_NUM_DATA_VL ];int krcvqsset;
Greg Kroah-Hartman
maintainerPATCH 174/279 IB/{hfi1, rdmavt}: Fix memory leak in hfi1_alloc_devdata() upon failure
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Sanchez <[email protected]>
[ Upstream commit e9777ad4399c26c70318c4945f94efac2ed95391 ]
When allocating device data, if there's an allocation failure, the already allocated memory won't be freed such as per-cpu counters.
Fix memory leaks in exception path by creating a common reentrant clean up function hfi1_clean_devdata() to be used at driver unload time and device data allocation failure.
To accomplish this, free_platform_config() and clean_up_i2c() are changed to be reentrant to remove dependencies when they are called in different order. This helps avoid NULL pointer dereferences introduced by this patch if those two functions weren't reentrant.
In addition, set dd->int_counter, dd->rcv_limit, dd->send_schedule and dd->tx_opstats to NULL after they're freed in hfi1_clean_devdata(), so that hfi1_clean_devdata() is fully reentrant.
--- drivers/infiniband/hw/hfi1/init.c | 37 ++++++++++++++++++++++++---------- drivers/infiniband/hw/hfi1/platform.c | 1 drivers/infiniband/hw/hfi1/qsfp.c | 2 + 3 files changed, 30 insertions(+), 10 deletions(-)
drivers/infiniband/hw/hfi1/init.c +27 -10
@@ -1209,30 +1209,49 @@ static void finalize_asic_data(struct hfkfree (ad); } -static void __hfi1_free_devdata (struct kobject *kobj) +/** +* hfi1_clean_devdata - cleans up per-unit data structure +* @dd: pointer to a valid devdata structure +* +* It cleans up all data structures set up by +* by hfi1_alloc_devdata(). +*/ +static void hfi1_clean_devdata (struct hfi1_devdata *dd) { -struct hfi1_devdata *dd = - container_of(kobj, struct hfi1_devdata, kobj);struct hfi1_asic_data *ad;unsigned long flags;spin_lock_irqsave (&hfi1_devs_lock, flags); -idr_remove (&hfi1_unit_table, dd->unit); -list_del (&dd->list); +if (!list_empty (&dd->list)) { +idr_remove (&hfi1_unit_table, dd->unit); +list_del_init (&dd->list); + } ad =release_asic_data (dd);spin_unlock_irqrestore (&hfi1_devs_lock, flags); -if (ad) -finalize_asic_data (dd, ad); + +finalize_asic_data (dd, ad);free_platform_config (dd);rcu_barrier ();/* wait for rcu callbacks to complete */ free_percpu (dd->int_counter);free_percpu (dd->rcv_limit);free_percpu (dd->send_schedule);free_percpu (dd->tx_opstats); + dd->int_counter =NULL ; + dd->rcv_limit =NULL ; + dd->send_schedule =NULL ; + dd->tx_opstats =NULL ;sdma_clean (dd, dd->num_sdma);rvt_dealloc_device (&dd->verbs_dev.rdi); } +static void __hfi1_free_devdata (struct kobject *kobj) +{ +struct hfi1_devdata *dd = + container_of(kobj, struct hfi1_devdata, kobj); + +hfi1_clean_devdata (dd); +} +static struct kobj_type hfi1_devdata_type = { .release = __hfi1_free_devdata, };
@@ -1333,9 +1352,7 @@ struct hfi1_devdata *hfi1_alloc_devdata(return dd; bail: -if (!list_empty (&dd->list)) -list_del_init (&dd->list); -rvt_dealloc_device (&dd->verbs_dev.rdi); +hfi1_clean_devdata (dd);return ERR_PTR (ret); }
drivers/infiniband/hw/hfi1/platform.c +1 -0
@@ -199,6 +199,7 @@ void free_platform_config(struct hfi1_de {/* Release memory allocated for eprom or fallback file read. */ kfree (dd->platform_config.data); + dd->platform_config.data =NULL ; }void get_port_type (struct hfi1_pportdata *ppd)
drivers/infiniband/hw/hfi1/qsfp.c +2 -0
@@ -204,6 +204,8 @@ static void clean_i2c_bus(struct hfi1_i2void clean_up_i2c (struct hfi1_devdata *dd,struct hfi1_asic_data *ad) { +if (!ad) +return ;clean_i2c_bus (ad->i2c_bus0); ad->i2c_bus0 =NULL ;clean_i2c_bus (ad->i2c_bus1);
Greg Kroah-Hartman
maintainerPATCH 175/279 IB/hfi1: Fix memory leak in exception path in get_irq_affinity()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Sanchez <[email protected]>
[ Upstream commit 59482a14918b282ca2a98f38c69da5ebeb1107d2 ]
When IRQ affinity is set and the interrupt type is unknown, a cpu mask allocated within the function is never freed. Fix this memory leak by allocating memory within the scope where it is used.
--- drivers/infiniband/hw/hfi1/affinity.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/affinity.c +5 -6
@@ -412,7 +412,6 @@ static void hfi1_cleanup_sdma_notifier(sstatic int get_irq_affinity (struct hfi1_devdata *dd,struct hfi1_msix_entry *msix) { -int ret;cpumask_var_t diff;struct hfi1_affinity_node *entry;struct cpu_mask_set *set =NULL ;
@@ -424,10 +423,6 @@ static int get_irq_affinity(struct hfi1_ extra[0 ] ='\0' ;cpumask_clear (&msix->mask); - ret =zalloc_cpumask_var (&diff,GFP_KERNEL ); -if (!ret) -return -ENOMEM ; - entry =node_affinity_lookup (dd->node);switch (msix->type) {
@@ -458,6 +453,9 @@ static int get_irq_affinity(struct hfi1_* finds its CPU here. */ if (cpu ==-1 && set) { +if (!zalloc_cpumask_var (&diff,GFP_KERNEL )) +return -ENOMEM ; +if (cpumask_equal (&set->mask, &set->used)) {/* * We've used up all the CPUs, bump up the generation
@@ -469,6 +467,8 @@ static int get_irq_affinity(struct hfi1_cpumask_andnot (diff, &set->mask, &set->used); cpu =cpumask_first (diff);cpumask_set_cpu (cpu, &set->used); + +free_cpumask_var (diff); }cpumask_set_cpu (cpu, &msix->mask);
@@ -482,7 +482,6 @@ static int get_irq_affinity(struct hfi1_hfi1_setup_sdma_notifier (msix); } -free_cpumask_var (diff);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 176/279 IB/mlx4: Fix integer overflow when calculating optimal MTT size
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
[ Upstream commit b03bcde962606d2ee59a4e9dd470db9ad53c5418 ]
When the kernel was compiled using the UBSAN option, we saw the following stack trace:
[ 1184.827917] UBSAN: Undefined behaviour in drivers/infiniband/hw/mlx4/mr.c:349:27 [ 1184.828114] signed integer overflow: [ 1184.828247] -2147483648 - 1 cannot be represented in type 'int'
The problem was caused by calling round_up in procedure mlx4_ib_umem_calc_optimal_mtt_size (on line 349, as noted in the stack trace) with the second parameter (1 << block_shift) (which is an int). The second parameter should have been (1ULL << block_shift) (which is an unsigned long long).
(1 << block_shift) is treated by the compiler as an int (because 1 is an integer).
Now, local variable block_shift is initialized to 31.
If block_shift is 31, 1 << block_shift is 1 << 31 = 0x80000000=-214748368. This is the most negative int value.
Inside the round_up macro, there is a cast applied to ((1 << 31) - 1). However, this cast is applied AFTER ((1 << 31) - 1) is calculated. Since (1 << 31) is treated as an int, we get the negative overflow identified by UBSAN in the process of calculating ((1 << 31) - 1).
The fix is to change (1 << block_shift) to (1ULL << block_shift) on line 349.
--- drivers/infiniband/hw/mlx4/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/mr.c +1 -1
@@ -346,7 +346,7 @@ int mlx4_ib_umem_calc_optimal_mtt_size(s/* Add to the first block the misalignment that it suffers from. */ total_len += (first_block_start & ((1ULL << block_shift) -1ULL )); last_block_end = current_block_start + current_block_len; - last_block_aligned_end =round_up (last_block_end,1 << block_shift); + last_block_aligned_end =round_up (last_block_end,1ULL << block_shift); total_len += (last_block_aligned_end - last_block_end);if (total_len & ((1ULL << block_shift) -1ULL ))
Greg Kroah-Hartman
maintainerPATCH 177/279 RDMA/cma: Do not query GID during QP state transition to RTR
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit 9aa169213d1166d30ae357a44abbeae93459339d ]
When commit [1] was added, SGID was queried to derive the SMAC address. Then, later on during a refactor [2], SMAC was no longer needed. However, the now useless GID query remained. Then during additional code changes later on, the GID query was being done in such a way that it caused iWARP queries to start breaking. Remove the useless GID query and resolve the iWARP breakage at the same time.
This is discussed in [3].
[1] commit dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures")
[2] commit 5c266b2304fb ("IB/cm: Remove the usage of smac and vid of qp_attr and cm_av")
[3] https://www.spinics.net/lists/linux-rdma/msg63951.html
--- drivers/infiniband/core/cma.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/infiniband/core/cma.c +0 -7
@@ -901,7 +901,6 @@ static int cma_modify_qp_rtr(struct rdma {struct ib_qp_attr qp_attr;int qp_attr_mask, ret; -union ib_gid sgid;mutex_lock (&id_priv->qp_mutex);if (!id_priv->id.qp) {
@@ -924,12 +923,6 @@ static int cma_modify_qp_rtr(struct rdmaif (ret) goto out; - ret =ib_query_gid (id_priv->id.device, id_priv->id.port_num, -rdma_ah_read_grh (&qp_attr.ah_attr)->sgid_index, - &sgid,NULL ); -if (ret) - goto out; -BUG_ON (id_priv->cma_dev->device != id_priv->id.device);if (conn_param)
Greg Kroah-Hartman
maintainerPATCH 178/279 spi: bcm2835aux: ensure interrupts are enabled for shared handler
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit bc519d9574618e47a0c788000fb78da95e18d953 ]
The BCM2835 AUX SPI has a shared interrupt line (with AUX UART). Downstream fixes this with an AUX irqchip to demux the IRQ sources and a DT change which breaks compatibility with older kernels. The AUX irqchip was already rejected for upstream[1] and the DT change would break working systems if the DTB is updated to a newer one. The latter issue was brought to my attention by Alex Graf.
The root cause however is a bug in the shared handler. Shared handlers must check that interrupts are actually enabled before servicing the interrupt. Add a check that the TXEMPTY or IDLE interrupts are enabled.
[1] https://patchwork.kernel.org/patch/9781221/
--- drivers/spi/spi-bcm2835aux.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-bcm2835aux.c +5 -0
@@ -184,6 +184,11 @@ static irqreturn_t bcm2835aux_spi_interrstruct bcm2835aux_spi *bs =spi_master_get_devdata (master);irqreturn_t ret =IRQ_NONE ; +/* IRQ may be shared, so return if our interrupts are disabled */ +if (!(bcm2835aux_rd (bs,BCM2835_AUX_SPI_CNTL1 ) & + (BCM2835_AUX_SPI_CNTL1_TXEMPTY |BCM2835_AUX_SPI_CNTL1_IDLE ))) +return ret; +/* check if we have data to read */ while (bs->rx_len && (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
Greg Kroah-Hartman
maintainerPATCH 179/279 bpf: fix possible spectre-v1 in find_and_alloc_map()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
[ Upstream commit 9ef09e35e521bf0df5325cc9cffa726a8f5f3c1b ]
It's possible for userspace to control attr->map_type. Sanitize it when using it as an array index to prevent an out-of-bounds value being used under speculation.
Found by smatch.
--- kernel/bpf/syscall.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/syscall.c +6 -3
@@ -26,6 +26,7 @@#include <linux/cred.h> #include <linux/timekeeping.h> #include <linux/ctype.h> +#include <linux/nospec.h> #define IS_FD_ARRAY (map) ((map)->map_type == BPF_MAP_TYPE_PROG_ARRAY || \ (map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \
@@ -102,12 +103,14 @@ const struct bpf_map_ops bpf_map_offloadstatic struct bpf_map *find_and_alloc_map (union bpf_attr *attr) {const struct bpf_map_ops *ops; +u32 type = attr->map_type;struct bpf_map *map;int err; -if (attr->map_type >=ARRAY_SIZE (bpf_map_types)) +if (type >=ARRAY_SIZE (bpf_map_types))return ERR_PTR (-EINVAL ); - ops = bpf_map_types[attr->map_type]; + type =array_index_nospec (type,ARRAY_SIZE (bpf_map_types)); + ops = bpf_map_types[type];if (!ops)return ERR_PTR (-EINVAL );
@@ -122,7 +125,7 @@ static struct bpf_map *find_and_alloc_maif (IS_ERR (map))return map; map->ops = ops; - map->map_type = attr->map_type; + map->map_type = type;return map; }
Greg Kroah-Hartman
maintainerPATCH 180/279 drm/exynos/mixer: fix synchronization check in interlaced mode
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrzej Hajda <[email protected]>
[ Upstream commit 2eced8e917b060587fc8ed46df41c364957a5050 ]
In case of interlace mode video processor registers and mixer config register must be check to ensure internal state is in sync with shadow registers.
This patch fixes page-faults in interlaced mode.
--- drivers/gpu/drm/exynos/exynos_mixer.c | 10 ++++++++++ drivers/gpu/drm/exynos/regs-mixer.h | 1 + 2 files changed, 11 insertions(+)
drivers/gpu/drm/exynos/exynos_mixer.c +10 -0
@@ -494,6 +494,7 @@ static void vp_video_buffer(struct mixerspin_lock_irqsave (&ctx->reg_slock, flags); +vp_reg_write (ctx,VP_SHADOW_UPDATE ,1 );/* interlace or progressive scan mode */ val = (test_bit (MXR_BIT_INTERLACE , &ctx->flags) ? ~0 :0 );vp_reg_writemask (ctx,VP_MODE , val,VP_MODE_LINE_SKIP );
@@ -711,6 +712,15 @@ static irqreturn_t mixer_irq_handler(int/* interlace scan need to check shadow register */ if (test_bit (MXR_BIT_INTERLACE , &ctx->flags)) { +if (test_bit (MXR_BIT_VP_ENABLED , &ctx->flags) && +vp_reg_read (ctx,VP_SHADOW_UPDATE )) + goto out; + + base =mixer_reg_read (ctx,MXR_CFG ); + shadow =mixer_reg_read (ctx,MXR_CFG_S ); +if (base != shadow) + goto out; + base =mixer_reg_read (ctx,MXR_GRAPHIC_BASE (0 )); shadow =mixer_reg_read (ctx,MXR_GRAPHIC_BASE_S (0 ));if (base != shadow)
drivers/gpu/drm/exynos/regs-mixer.h +1 -0
@@ -47,6 +47,7 @@#define MXR_MO 0x0304#define MXR_RESOLUTION 0x0310 +#define MXR_CFG_S 0x2004#define MXR_GRAPHIC0_BASE_S 0x2024#define MXR_GRAPHIC1_BASE_S 0x2044
Greg Kroah-Hartman
maintainerPATCH 181/279 drm/exynos: mixer: avoid Oops in vp_video_buffer()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Jakobi <[email protected]>
[ Upstream commit 0ccc1c8f0282e237a0bd6dca7cdac4ed5e318ee7 ]
If an interlaced video mode is selected, a IOMMU pagefault is triggered by vp_video_buffer().
Fix the most apparent bugs:
- pitch value for chroma plane
- divide by two of height and vpos of source and destination
--- drivers/gpu/drm/exynos/exynos_mixer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/exynos/exynos_mixer.c +7 -5
@@ -485,7 +485,7 @@ static void vp_video_buffer(struct mixer chroma_addr[1 ] = chroma_addr[0 ] +0x40 ; }else { luma_addr[1 ] = luma_addr[0 ] + fb->pitches[0 ]; - chroma_addr[1 ] = chroma_addr[0 ] + fb->pitches[0 ]; + chroma_addr[1 ] = chroma_addr[0 ] + fb->pitches[1 ]; } }else { luma_addr[1 ] =0 ;
@@ -508,21 +508,23 @@ static void vp_video_buffer(struct mixervp_reg_write (ctx,VP_IMG_SIZE_Y ,VP_IMG_HSIZE (fb->pitches[0 ]) |VP_IMG_VSIZE (fb->height));/* chroma plane for NV12/NV21 is half the height of the luma plane */ -vp_reg_write (ctx,VP_IMG_SIZE_C ,VP_IMG_HSIZE (fb->pitches[0 ]) | +vp_reg_write (ctx,VP_IMG_SIZE_C ,VP_IMG_HSIZE (fb->pitches[1 ]) |VP_IMG_VSIZE (fb->height /2 ));vp_reg_write (ctx,VP_SRC_WIDTH , state->src.w); -vp_reg_write (ctx,VP_SRC_HEIGHT , state->src.h);vp_reg_write (ctx,VP_SRC_H_POSITION ,VP_SRC_H_POSITION_VAL (state->src.x)); -vp_reg_write (ctx,VP_SRC_V_POSITION , state->src.y); -vp_reg_write (ctx,VP_DST_WIDTH , state->crtc.w);vp_reg_write (ctx,VP_DST_H_POSITION , state->crtc.x); +if (test_bit (MXR_BIT_INTERLACE , &ctx->flags)) { +vp_reg_write (ctx,VP_SRC_HEIGHT , state->src.h /2 ); +vp_reg_write (ctx,VP_SRC_V_POSITION , state->src.y /2 );vp_reg_write (ctx,VP_DST_HEIGHT , state->crtc.h /2 );vp_reg_write (ctx,VP_DST_V_POSITION , state->crtc.y /2 ); }else { +vp_reg_write (ctx,VP_SRC_HEIGHT , state->src.h); +vp_reg_write (ctx,VP_SRC_V_POSITION , state->src.y);vp_reg_write (ctx,VP_DST_HEIGHT , state->crtc.h);vp_reg_write (ctx,VP_DST_V_POSITION , state->crtc.y); }
Greg Kroah-Hartman
maintainerPATCH 182/279 bpf: use array_index_nospec in find_prog_type
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit d0f1a451e33d9ca834422622da30aa68daade56b ]
Commit 9ef09e35e521 ("bpf: fix possible spectre-v1 in find_and_alloc_map()") converted find_and_alloc_map() over to use array_index_nospec() to sanitize map type that user space passes on map creation, and this patch does an analogous conversion for progs in find_prog_type() as it's also passed from user space when loading progs as attr->prog_type.
--- kernel/bpf/syscall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
kernel/bpf/syscall.c +8 -2
@@ -872,11 +872,17 @@ static const struct bpf_prog_ops * conststatic int find_prog_type (enum bpf_prog_type type,struct bpf_prog *prog) { -if (type >=ARRAY_SIZE (bpf_prog_types) || !bpf_prog_types[type]) +const struct bpf_prog_ops *ops; + +if (type >=ARRAY_SIZE (bpf_prog_types)) +return -EINVAL ; + type =array_index_nospec (type,ARRAY_SIZE (bpf_prog_types)); + ops = bpf_prog_types[type]; +if (!ops)return -EINVAL ;if (!bpf_prog_is_dev_bound (prog->aux)) - prog->aux->ops = bpf_prog_types[type]; + prog->aux->ops = ops;else prog->aux->ops = &bpf_offload_prog_ops; prog->type = type;
Greg Kroah-Hartman
maintainerPATCH 183/279 sched/core: Introduce set_special_state()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit b5bf9a90bbebffba888c9144c5a8a10317b04064 ]
Gaurav reported a perceived problem with TASK_PARKED, which turned out to be a broken wait-loop pattern in __kthread_parkme(), but the reported issue can (and does) in fact happen for states that do not do condition based sleeps.
When the 'current->state = TASK_RUNNING' store of a previous (concurrent) try_to_wake_up() collides with the setting of a 'special' sleep state, we can loose the sleep state.
Normal condition based wait-loops are immune to this problem, but for sleep states that are not condition based are subject to this problem.
There already is a fix for TASK_DEAD. Abstract that and also apply it to TASK_STOPPED and TASK_TRACED, both of which are also without condition based wait-loop.
--- include/linux/sched.h | 50 ++++++++++++++++++++++++++++++++++++++----- include/linux/sched/signal.h | 2 - kernel/sched/core.c | 17 -------------- kernel/signal.c | 17 ++++++++++++-- 4 files changed, 62 insertions(+), 24 deletions(-)
include/linux/sched.h +45 -5
@@ -113,17 +113,36 @@ struct task_group;#ifdef CONFIG_DEBUG_ATOMIC_SLEEP +/* +* Special states are those that do not use the normal wait-loop pattern. See +* the comment with set_special_state(). +*/ +#define is_special_task_state (state) \ + ((state) & (__TASK_STOPPED | __TASK_TRACED | TASK_DEAD)) +#define __set_current_state (state_value) \ do { \ + WARN_ON_ONCE(is_special_task_state(state_value));\ current->task_state_change = _THIS_IP_; \ current->state = (state_value); \ } while (0) +#define set_current_state (state_value) \ do { \ + WARN_ON_ONCE(is_special_task_state(state_value));\ current->task_state_change = _THIS_IP_; \ smp_store_mb(current->state, (state_value)); \ } while (0) +#define set_special_state (state_value) \ + do { \ + unsigned long flags;/* may shadow */ \ +WARN_ON_ONCE (!is_special_task_state (state_value)); \ +raw_spin_lock_irqsave (¤t->pi_lock, flags); \ + current->task_state_change = _THIS_IP_; \ + current->state = (state_value); \ +raw_spin_unlock_irqrestore (¤t->pi_lock, flags); \ + } while (0)#else /* * set_current_state() includes a barrier so that the write of current->state
@@ -145,8 +164,8 @@ struct task_group;* * The above is typically ordered against the wakeup, which does: * -* need_sleep = false; -* wake_up_state(p, TASK_UNINTERRUPTIBLE); +* need_sleep = false; +* wake_up_state(p, TASK_UNINTERRUPTIBLE); * * Where wake_up_state() (and all other wakeup primitives) imply enough * barriers to order the store of the variable against wakeup.
@@ -155,12 +174,33 @@ struct task_group;* once it observes the TASK_UNINTERRUPTIBLE store the waking CPU can issue a * TASK_RUNNING store which can collide with __set_current_state(TASK_RUNNING). * -* This is obviously fine, since they both store the exact same value. +* However, with slightly different timing the wakeup TASK_RUNNING store can +* also collide with the TASK_UNINTERRUPTIBLE store. Loosing that store is not +* a problem either because that will result in one extra go around the loop +* and our @cond test will save the day. * * Also see the comments of try_to_wake_up(). */ -#define __set_current_state (state_value) do { current->state = (state_value); } while (0) -#define set_current_state (state_value) smp_store_mb(current->state, (state_value)) +#define __set_current_state (state_value) \ + current->state = (state_value) + +#define set_current_state (state_value) \ + smp_store_mb(current->state, (state_value)) + +/* +* set_special_state() should be used for those states when the blocking task +* can not use the regular condition based wait-loop. In that case we must +* serialize against wakeups such that any possible in-flight TASK_RUNNING stores +* will not collide with our state change. +*/ +#define set_special_state (state_value) \ + do { \ + unsigned long flags;/* may shadow */ \ +raw_spin_lock_irqsave (¤t->pi_lock, flags); \ + current->state = (state_value); \ +raw_spin_unlock_irqrestore (¤t->pi_lock, flags); \ + } while (0) +#endif /* Task command name length: */
include/linux/sched/signal.h +1 -1
@@ -280,7 +280,7 @@ static inline void kernel_signal_stop(vo {spin_lock_irq (¤t->sighand->siglock);if (current->jobctl &JOBCTL_STOP_DEQUEUED ) -__set_current_state (TASK_STOPPED ); +set_special_state (TASK_STOPPED );spin_unlock_irq (¤t->sighand->siglock);schedule ();
kernel/sched/core.c +1 -16
@@ -3459,23 +3459,8 @@ static void __sched notrace __schedule(bvoid __noreturn do_task_dead (void ) { -/* -* The setting of TASK_RUNNING by try_to_wake_up() may be delayed -* when the following two conditions become true. -* - There is race condition of mmap_sem (It is acquired by -* exit_mm()), and -* - SMI occurs before setting TASK_RUNINNG. -* (or hypervisor of virtual machine switches to other guest) -* As a result, we may become TASK_RUNNING after becoming TASK_DEAD -* -* To avoid it, we have to wait for releasing tsk->pi_lock which -* is held by try_to_wake_up() -*/ -raw_spin_lock_irq (¤t->pi_lock); -raw_spin_unlock_irq (¤t->pi_lock); -/* Causes final put_task_struct in finish_task_switch(): */ -__set_current_state (TASK_DEAD ); +set_special_state (TASK_DEAD );/* Tell freezer to ignore us: */ current->flags |=PF_NOFREEZE ;
kernel/signal.c +15 -2
@@ -1961,14 +1961,27 @@ static void ptrace_stop(int exit_code, ireturn ; } +set_special_state (TASK_TRACED ); +/* * We're committing to trapping. TRACED should be visible before * TRAPPING is cleared; otherwise, the tracer might fail do_wait(). * Also, transition to TRACED and updates to ->jobctl should be * atomic with respect to siglock and should be done after the arch * hook as siglock is released and regrabbed across it. +* +* TRACER TRACEE +* +* ptrace_attach() +* [L] wait_on_bit(JOBCTL_TRAPPING) [S] set_special_state(TRACED) +* do_wait() +* set_current_state() smp_wmb(); +* ptrace_do_wait() +* wait_task_stopped() +* task_stopped_code() +* [L] task_is_traced() [S] task_clear_jobctl_trapping(); */ -set_current_state (TASK_TRACED ); +smp_wmb (); current->last_siginfo = info; current->exit_code = exit_code;
@@ -2176,7 +2189,7 @@ static bool do_signal_stop(int signr)if (task_participate_group_stop (current)) notify =CLD_STOPPED ; -__set_current_state (TASK_STOPPED ); +set_special_state (TASK_STOPPED );spin_unlock_irq (¤t->sighand->siglock);/*
Greg Kroah-Hartman
maintainerPATCH 184/279 net: phy: broadcom: add support for BCM89610 PHY
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhadram Varka <[email protected]>
[ Upstream commit 23b8392201e0681b76630c4cea68e1a2e1821ec6 ]
It adds support for BCM89610 (Single-Port 10/100/1000BASE-T) transceiver which is used in P3310 Tegra186 platform.
--- drivers/net/phy/broadcom.c | 10 ++++++++++ include/linux/brcmphy.h | 1 + 2 files changed, 11 insertions(+)
drivers/net/phy/broadcom.c +10 -0
@@ -720,6 +720,15 @@ static struct phy_driver broadcom_driver .get_strings = bcm_phy_get_strings, .get_stats = bcm53xx_phy_get_stats, .probe = bcm53xx_phy_probe, +}, { + .phy_id = PHY_ID_BCM89610, + .phy_id_mask = 0xfffffff0, + .name = "Broadcom BCM89610", + .features = PHY_GBIT_FEATURES, + .flags = PHY_HAS_INTERRUPT, + .config_init = bcm54xx_config_init, + .ack_interrupt = bcm_phy_ack_intr, + .config_intr = bcm_phy_config_intr, } };module_phy_driver (broadcom_drivers);
@@ -741,6 +750,7 @@ static struct mdio_device_id __maybe_unu { PHY_ID_BCMAC131, 0xfffffff0 }, { PHY_ID_BCM5241, 0xfffffff0 }, { PHY_ID_BCM5395, 0xfffffff0 }, + { PHY_ID_BCM89610, 0xfffffff0 }, { } };
include/linux/brcmphy.h +1 -0
@@ -25,6 +25,7 @@#define PHY_ID_BCM54612E 0x03625e60#define PHY_ID_BCM54616S 0x03625d10#define PHY_ID_BCM57780 0x03625d90 +#define PHY_ID_BCM89610 0x03625cd0#define PHY_ID_BCM7250 0xae025280#define PHY_ID_BCM7260 0xae025190
Greg Kroah-Hartman
maintainerPATCH 185/279 gcc-plugins: fix build condition of SANCOV plugin
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 642ef99be932c4071274b28eaf3d3d85bbb6e78c ]
Since commit d677a4d60193 ("Makefile: support flag -fsanitizer-coverage=trace-cmp"), you miss to build the SANCOV plugin under some circumstances.
CONFIG_KCOV=y
CONFIG_KCOV_ENABLE_COMPARISONS=y
Your compiler does not support -fsanitize-coverage=trace-pc Your compiler does not support -fsanitize-coverage=trace-cmp
Under this condition, $(CFLAGS_KCOV) is not empty but contains a space, so the following ifeq-conditional is false.
ifeq ($(CFLAGS_KCOV),)
Then, scripts/Makefile.gcc-plugins misses to add sancov_plugin.so to gcc-plugin-y while the SANCOV plugin is necessary as an alternative means.
--- scripts/Makefile.gcc-plugins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.gcc-plugins +1 -1
@@ -14,7 +14,7 @@ ifdef CONFIG_GCC_PLUGINS endif ifdef CONFIG_GCC_PLUGIN_SANCOV - ifeq ($(CFLAGS_KCOV),) + ifeq ($(strip $(CFLAGS_KCOV)),) # It is needed because of the gcc-plugin.sh and gcc version checks. gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
Greg Kroah-Hartman
maintainerPATCH 186/279 sh: fix build failure for J2 cpu with SMP disabled
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rich Felker <[email protected]>
[ Upstream commit 6cb465972c4eb6741b3094a58a65e527fc63c100 ]
The sh asm/smp.h defines a fallback hard_smp_processor_id macro for the !SMP case, but linux/smp.h never includes asm/smp.h in the !SMP case.
--- arch/sh/kernel/cpu/sh2/probe.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/sh/kernel/cpu/sh2/probe.c +4 -0
@@ -43,7 +43,11 @@ void __ref cpu_probe(void)#endif #if defined(CONFIG_CPU_J2 ) +#if defined(CONFIG_SMP )unsigned cpu =hard_smp_processor_id (); +#else +unsigned cpu =0 ; +#endif if (cpu ==0 )of_scan_flat_dt (scan_cache,NULL );if (j2_ccr_base)__raw_writel (0x80000303 , j2_ccr_base +4 *cpu);if (cpu !=0 )return ;
Greg Kroah-Hartman
maintainerPATCH 187/279 tee: check shm references are consistent in offset/size
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Etienne Carriere <[email protected]>
[ Upstream commit ab9d3db5b320a052452b9cd035599ee3c84bbee9 ]
This change prevents userland from referencing TEE shared memory outside the area initially allocated by its owner. Prior this change an application could not reference or access memory it did not own but it could reference memory not explicitly allocated by owner but still allocated to the owner due to the memory allocation granule.
--- drivers/tee/tee_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/tee/tee_core.c +11 -0
@@ -238,6 +238,17 @@ static int params_from_user(struct tee_cif (IS_ERR (shm))return PTR_ERR (shm); +/* +* Ensure offset + size does not overflow offset +* and does not overflow the size of the referred +* shared memory object. +*/ +if ((ip.a + ip.b) < ip.a || + (ip.a + ip.b) > shm->size) { +tee_shm_put (shm); +return -EINVAL ; + } + params[n].u.memref.shm_offs = ip.a; params[n].u.memref.size = ip.b; params[n].u.memref.shm = shm;
Greg Kroah-Hartman
maintainerPATCH 188/279 powerpc/trace/syscalls: Update syscall name matching logic
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Naveen N. Rao" <[email protected]>
[ Upstream commit 0b7758aaf6543b9a10c8671db559e9d374a3fd95 ]
On powerpc64 ABIv1, we are enabling syscall tracing for only ~20 syscalls. This is due to commit e145242ea0df6 ("syscalls/core, syscalls/x86: Clean up syscall stub naming convention") which has changed the syscall entry wrapper prefix from "SyS" to "__se_sys".
Update the logic for ABIv1 to not just skip the initial dot, but also the "__se_sys" prefix.
--- arch/powerpc/include/asm/ftrace.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/ftrace.h +3 -7
@@ -73,13 +73,9 @@ struct dyn_arch_ftrace {#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME static inline bool arch_syscall_match_sym_name (const char *sym,const char *name) { -/* -* Compare the symbol name with the system call name. Skip the .sys or .SyS -* prefix from the symbol name and the sys prefix from the system call name and -* just match the rest. This is only needed on ppc64 since symbol names on -* 32bit do not start with a period so the generic function will work. -*/ -return !strcmp (sym +4 , name +3 ); +/* We need to skip past the initial dot, and the __se_sys alias */ +return !strcmp (sym +1 , name) || + (!strncmp (sym,".__se_sys" ,9 ) && !strcmp (sym +6 , name)); }#endif #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
Re: [PATCH 4.16 188/279] powerpc/trace/syscalls: Update syscall name matching logic
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
Please drop this and the next patch since these depend on commit e145242ea0df6, which is not in v4.16.
- Naveen
Quoted 47 lines
------------------
From: "Naveen N. Rao" <[email protected]>
[ Upstream commit
0b7758aaf6543b9a10c8671db559e9d374a3fd95]On powerpc64 ABIv1, we are enabling syscall tracing for only ~20 syscalls. This is due to commit
e145242ea0df6("syscalls/core, syscalls/x86: Clean up syscall stub naming convention") which has changed the syscall entry wrapper prefix from "SyS" to "__se_sys".Update the logic for ABIv1 to not just skip the initial dot, but also the "
__se_sys" prefix.Fixes commit e145242ea0df6 ("syscalls/core, syscalls/x86: Clean up syscall stub naming convention")Reported-by Michael Ellerman <[email protected]>Signed-off-by Naveen N. Rao <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/powerpc/include/asm/ftrace.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)arch/powerpc/include/asm/ftrace.h +3
-7@@ -73,13 +73,9 @@ struct dyn_arch_ftrace {#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME static inline bool arch_syscall_match_sym_name (const char *sym,const char *name) { -/* -* Compare the symbol name with the system call name. Skip the .sys or .SyS -* prefix from the symbol name and the sys prefix from the system call name and -* just match the rest. This is only needed on ppc64 since symbol names on -* 32bit do not start with a period so the generic function will work. -*/ -return !strcmp (sym +4 , name +3 ); +/* We need to skip past the initial dot, and the __se_sys alias */ +return !strcmp (sym +1 , name) || + (!strncmp (sym,".__se_sys" ,9 ) && !strcmp (sym +6 , name)); }#endif #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
Greg Kroah-Hartman
maintainerPATCH 189/279 powerpc/trace/syscalls: Update syscall name matching logic to account for ppc_ prefix
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Naveen N. Rao" <[email protected]>
[ Upstream commit edf6a2dfe3889daf97e7c164891a87832169e3e4 ]
Some syscall entry functions on powerpc are prefixed with ppc_/ppc32_/ppc64_ rather than the usual sys_/__se_sys prefix. fork(), clone(), swapcontext() are some examples of syscalls with such entry points. We need to match against these names when initializing ftrace syscall tracing.
--- arch/powerpc/include/asm/ftrace.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/ftrace.h +19 -2
@@ -69,13 +69,30 @@ struct dyn_arch_ftrace {#endif #if defined(CONFIG_FTRACE_SYSCALLS ) && !defined(__ASSEMBLY__) -#ifdef PPC64_ELF_ABI_v1 +/* +* Some syscall entry functions on powerpc start with "ppc_" (fork and clone, +* for instance) or ppc32_/ppc64_. We should also match the sys_ variant with +* those. +*/ #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME +#ifdef PPC64_ELF_ABI_v1static inline bool arch_syscall_match_sym_name (const char *sym,const char *name) {/* We need to skip past the initial dot, and the __se_sys alias */ return !strcmp (sym +1 , name) || - (!strncmp (sym,".__se_sys" ,9 ) && !strcmp (sym +6 , name)); + (!strncmp (sym,".__se_sys" ,9 ) && !strcmp (sym +6 , name)) || + (!strncmp (sym,".ppc_" ,5 ) && !strcmp (sym +5 , name +4 )) || + (!strncmp (sym,".ppc32_" ,7 ) && !strcmp (sym +7 , name +4 )) || + (!strncmp (sym,".ppc64_" ,7 ) && !strcmp (sym +7 , name +4 )); +} +#else +static inline bool arch_syscall_match_sym_name (const char *sym,const char *name) +{ +return !strcmp (sym, name) || + (!strncmp (sym,"__se_sys" ,8 ) && !strcmp (sym +5 , name)) || + (!strncmp (sym,"ppc_" ,4 ) && !strcmp (sym +4 , name +4 )) || + (!strncmp (sym,"ppc32_" ,6 ) && !strcmp (sym +6 , name +4 )) || + (!strncmp (sym,"ppc64_" ,6 ) && !strcmp (sym +6 , name +4 )); }#endif #endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
Greg Kroah-Hartman
maintainerPATCH 190/279 mac80211: Adjust SAE authentication timeout
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
[ Upstream commit 407879b690ba3a6bf29be896d02dad63463bd1c0 ]
The IEEE P802.11-REVmd D1.0 specification updated the SAE authentication timeout to be 2000 milliseconds (see dot11RSNASAERetransPeriod). Update the SAE timeout setting accordingly.
While at it, reduce some code duplication in the timeout configuration.
--- net/mac80211/mlme.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
net/mac80211/mlme.c +18 -7
@@ -35,6 +35,7 @@#define IEEE80211_AUTH_TIMEOUT (HZ / 5)#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)#define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) +#define IEEE80211_AUTH_TIMEOUT_SAE (HZ * 2)#define IEEE80211_AUTH_MAX_TRIES 3#define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5)#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
@@ -3788,16 +3789,19 @@ static int ieee80211_auth(struct ieee802 tx_flags);if (tx_flags ==0 ) { - auth_data->timeout = jiffies +IEEE80211_AUTH_TIMEOUT ; - auth_data->timeout_started = true; -run_again (sdata, auth_data->timeout); +if (auth_data->algorithm ==WLAN_AUTH_SAE ) + auth_data->timeout = jiffies + +IEEE80211_AUTH_TIMEOUT_SAE ; +else + auth_data->timeout = jiffies +IEEE80211_AUTH_TIMEOUT ; }else { auth_data->timeout =round_jiffies_up (jiffies +IEEE80211_AUTH_TIMEOUT_LONG ); - auth_data->timeout_started = true; -run_again (sdata, auth_data->timeout); } + auth_data->timeout_started = true; +run_again (sdata, auth_data->timeout); +return 0 ; }
@@ -3868,8 +3872,15 @@ void ieee80211_sta_work(struct ieee80211 ifmgd->status_received = false;if (ifmgd->auth_data &&ieee80211_is_auth (fc)) {if (status_acked) { - ifmgd->auth_data->timeout = - jiffies +IEEE80211_AUTH_TIMEOUT_SHORT ; +if (ifmgd->auth_data->algorithm == +WLAN_AUTH_SAE ) + ifmgd->auth_data->timeout = + jiffies + +IEEE80211_AUTH_TIMEOUT_SAE ; +else + ifmgd->auth_data->timeout = + jiffies + +IEEE80211_AUTH_TIMEOUT_SHORT ;run_again (sdata, ifmgd->auth_data->timeout); }else { ifmgd->auth_data->timeout = jiffies -1 ;
Greg Kroah-Hartman
maintainerPATCH 191/279 drm/vc4: Fix oops dereferencing DPIs connector since panel_bridge.
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anholt <[email protected]>
[ Upstream commit 164c2416dd40770aba5814f93da835e8a9f7196d ]
In the cleanup, I didn't notice that we needed to dereference the connector for the bus_format. Fix the regression by looking up the first (and only) connector attached to us, and assume that its bus_format is what we want. Some day it would be good to have that part of display_info attached to the bridge, instead.
v2: Fix stray whitespace change
--- drivers/gpu/drm/vc4/vc4_dpi.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_dpi.c +22 -3
@@ -96,7 +96,6 @@ struct vc4_dpi {struct platform_device *pdev;struct drm_encoder *encoder; -struct drm_connector *connector;void __iomem *regs;
@@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(strustatic void vc4_dpi_encoder_enable (struct drm_encoder *encoder) { +struct drm_device *dev = encoder->dev;struct drm_display_mode *mode = &encoder->crtc->mode;struct vc4_dpi_encoder *vc4_encoder =to_vc4_dpi_encoder (encoder);struct vc4_dpi *dpi = vc4_encoder->dpi; +struct drm_connector_list_iter conn_iter; +struct drm_connector *connector =NULL , *connector_scan;u32 dpi_c =DPI_ENABLE |DPI_OUTPUT_ENABLE_MODE ;int ret; -if (dpi->connector->display_info.num_bus_formats) { -u32 bus_format = dpi->connector->display_info.bus_formats[0 ]; +/* Look up the connector attached to DPI so we can get the +* bus_format. Ideally the bridge would tell us the +* bus_format we want, but it doesn't yet, so assume that it's +* uniform throughout the bridge chain. +*/ +drm_connector_list_iter_begin (dev, &conn_iter); +drm_for_each_connector_iter (connector_scan, &conn_iter) { +if (connector_scan->encoder == encoder) { + connector = connector_scan; +break ; + } + } +drm_connector_list_iter_end (&conn_iter); + +if (connector && connector->display_info.num_bus_formats) { +u32 bus_format = connector->display_info.bus_formats[0 ];switch (bus_format) {case MEDIA_BUS_FMT_RGB888_1X24 :
@@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(strucDRM_ERROR ("Unknown media bus format %d\n" , bus_format);break ; } + }else { +/* Default to 24bit if no connector found. */ + dpi_c |=VC4_SET_FIELD (DPI_FORMAT_24BIT_888_RGB ,DPI_FORMAT ); }if (mode->flags &DRM_MODE_FLAG_NHSYNC )
Greg Kroah-Hartman
maintainerPATCH 192/279 drm/omap: silence unititialized variable warning
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 4a9fbfcab19d3f71ad2bf0bcb653c4ee84e69c7f ]
Smatch complains that "area_free" could be used without being initialized. This code is several years old and premusably works fine so this can't be a very serious bug. But it's easy enough to silence the warning. If "area_free" is false at the end of the function then we return -ENOMEM.
--- drivers/gpu/drm/omapdrm/tcm-sita.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/tcm-sita.c +1 -1
@@ -90,7 +90,7 @@ static int l2r_t2b(uint16_t w, uint16_t {int i;unsigned long index; -bool area_free; +bool area_free = false;unsigned long slots_per_band =PAGE_SIZE / slot_bytes;unsigned long bit_offset = (offset >0 ) ? offset / slot_bytes :0 ;unsigned long curr_bit = bit_offset;
Greg Kroah-Hartman
maintainerPATCH 193/279 drm/omap: fix uninitialized ret variable
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 77eeac24b10fc84d3ffd5b11a897dff88dde244d ]
audio_config function for both HDMI4 and HDMI5 return uninitialized value as the error code if the display is not currently enabled. For some reason this has not caused any issues.
--- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/dss/hdmi4.c +1 -1
@@ -665,7 +665,7 @@ static int hdmi_audio_config(struct devi struct omap_dss_audio *dss_audio) {struct omap_hdmi *hd =dev_get_drvdata (dev); -int ret; +int ret =0 ;mutex_lock (&hd->lock);
drivers/gpu/drm/omapdrm/dss/hdmi5.c +1 -1
@@ -660,7 +660,7 @@ static int hdmi_audio_config(struct devi struct omap_dss_audio *dss_audio) {struct omap_hdmi *hd =dev_get_drvdata (dev); -int ret; +int ret =0 ;mutex_lock (&hd->lock);
Greg Kroah-Hartman
maintainerPATCH 194/279 drm/omap: fix possible NULL ref issue in tiler_reserve_2d
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 6a0f0c55619f0b82a677cab72e77c3444a5eee58 ]
tiler_reserve_2d allocates memory but does not check if it got the memory. Add the check and return ENOMEM on failure.
--- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +5 -1
@@ -401,12 +401,16 @@ int tiler_unpin(struct tiler_block *blocstruct tiler_block *tiler_reserve_2d (enum tiler_fmt fmt,uint16_t w,uint16_t h,uint16_t align) { -struct tiler_block *block =kzalloc (sizeof (*block),GFP_KERNEL ); +struct tiler_block *block;u32 min_align =128 ;int ret;unsigned long flags;u32 slot_bytes; + block =kzalloc (sizeof (*block),GFP_KERNEL ); +if (!block) +return ERR_PTR (-ENOMEM ); +BUG_ON (!validfmt (fmt));/* convert width/height to slots */
Greg Kroah-Hartman
maintainerPATCH 195/279 drm/omap: check return value from soc_device_match
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 4d6cb5e2fee52af17001e92950f0894304706ee4 ]
soc_device_match() can return NULL, so add a check and fail if soc_device_match() fails.
--- drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c +6 -1
@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_devi {const struct hdmi4_features *features;struct resource *res; +const struct soc_device_attribute *soc; - features =soc_device_match (hdmi4_soc_devices)->data; + soc =soc_device_match (hdmi4_soc_devices); +if (!soc) +return -ENODEV ; + + features = soc->data; core->cts_swmode = features->cts_swmode; core->audio_use_mclk = features->audio_use_mclk;
Greg Kroah-Hartman
maintainerPATCH 196/279 drm/omap: handle alloc failures in omap_connector
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
[ Upstream commit 47aaaec818dfd1009d1358974a2931f05dd57203 ]
Handle memory allocation failures in omap_connector to avoid NULL derefs.
--- drivers/gpu/drm/omapdrm/omap_connector.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/omapdrm/omap_connector.c +10 -0
@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struif (dssdrv->read_edid) {void *edid =kzalloc (MAX_EDID ,GFP_KERNEL ); +if (!edid) +return 0 ; +if ((dssdrv->read_edid (dssdev, edid,MAX_EDID ) >0 ) &&drm_edid_is_valid (edid)) { drm_mode_connector_update_edid_property(
@@ -139,6 +142,9 @@ static int omap_connector_get_modes(strustruct drm_display_mode *mode =drm_mode_create (dev);struct videomode vm = {0 }; +if (!mode) +return 0 ; + dssdrv->get_timings (dssdev, &vm);drm_display_mode_from_videomode (&vm, mode);
@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(strif (!r) {/* check if vrefresh is still valid */ new_mode =drm_mode_duplicate (dev, mode); + +if (!new_mode) +return MODE_BAD ; + new_mode->clock = vm.pixelclock /1000 ; new_mode->vrefresh =0 ;if (mode->vrefresh ==drm_mode_vrefresh (new_mode))
Greg Kroah-Hartman
maintainerPATCH 197/279 nvme: fix use-after-free in nvme_free_ns_head
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianchao Wang <[email protected]>
[ Upstream commit 12d9f07022dcde261ad16e9a11f45096dc68b03c ]
Currently only nvme_ctrl will take a reference counter of nvme_subsystem, nvme_ns_head also needs it. Otherwise nvme_free_ns_head will access the nvme_subsystem.ns_ida which has been freed by __nvme_release_subsystem after all the reference of nvme_subsystem have been released by nvme_free_ctrl. This could cause memory corruption.
BUG: KASAN: use-after-free in radix_tree_next_chunk+0x9f/0x4b0 Read of size 8 at addr ffff88036494d2e8 by task fio/1815 CPU: 1 PID: 1815 Comm: fio Kdump: loaded Tainted: G W 4.17.0-rc1+ #18 Hardware name: LENOVO 10MLS0E339/3106, BIOS M1AKT22A 06/27/2017 Call Trace: dump_stack+0x91/0xeb print_address_description+0x6b/0x290 kasan_report+0x261/0x360 radix_tree_next_chunk+0x9f/0x4b0 ida_remove+0x8b/0x180 ida_simple_remove+0x26/0x40 nvme_free_ns_head+0x58/0xc0 __blkdev_put+0x30a/0x3a0 blkdev_close+0x44/0x50 __fput+0x184/0x380 task_work_run+0xaf/0xe0 do_exit+0x501/0x1440 do_group_exit+0x89/0x140 __x64_sys_exit_group+0x28/0x30 do_syscall_64+0x72/0x230
--- drivers/nvme/host/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/nvme/host/core.c +5 -0
@@ -99,6 +99,7 @@ static struct class *nvme_subsys_class;static void nvme_ns_remove (struct nvme_ns *ns);static int nvme_revalidate_disk (struct gendisk *disk); +static void nvme_put_subsystem (struct nvme_subsystem *subsys);static __le32 nvme_get_log_dw10 (u8 lid,size_t size) {
@@ -353,6 +354,7 @@ static void nvme_free_ns_head(struct kreida_simple_remove (&head->subsys->ns_ida, head->instance);list_del_init (&head->entry);cleanup_srcu_struct (&head->srcu); +nvme_put_subsystem (head->subsys);kfree (head); }
@@ -2843,6 +2845,9 @@ static struct nvme_ns_head *nvme_alloc_n goto out_cleanup_srcu;list_add_tail (&head->entry, &ctrl->subsys->nsheads); + +kref_get (&ctrl->subsys->ref); +return head; out_cleanup_srcu:cleanup_srcu_struct (&head->srcu);
Greg Kroah-Hartman
maintainerPATCH 200/279 mac80211: use timeout from the AddBA response instead of the request
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit 914eac248d876f9c00cd1792ffec3d182c863f13 ]
2016 spec, section 10.24.2 specifies that the block ack timeout in the ADD BA request is advisory.
That means we should check the value in the response and act upon it (same as buffer size).
--- net/mac80211/agg-tx.c | 4 ++++ net/mac80211/tx.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
net/mac80211/agg-tx.c +4 -0
@@ -8,6 +8,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2007-2010, Intel Corporation * Copyright(c) 2015-2017 Intel Deutschland GmbH +* Copyright (C) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -970,6 +971,9 @@ void ieee80211_process_addba_resp(struct sta->ampdu_mlme.addba_req_num[tid] =0 ; + tid_tx->timeout = +le16_to_cpu (mgmt->u.action.u.addba_resp.timeout); +if (tid_tx->timeout) {mod_timer (&tid_tx->session_timer,TU_TO_EXP_TIME (tid_tx->timeout));
net/mac80211/tx.c +2 -1
@@ -4,6 +4,7 @@* Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2007 Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH +* Copyright (C) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -1138,7 +1139,7 @@ static bool ieee80211_tx_prep_agg(struct }/* reset session timer */ -if (reset_agg_timer && tid_tx->timeout) +if (reset_agg_timer) tid_tx->last_tx = jiffies;return queued;
Greg Kroah-Hartman
maintainerPATCH 201/279 x86/xen: Reset VCPU0 info pointer after shared_info remap
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: "van der Linden, Frank" <[email protected]>
[ Upstream commit d1ecfa9d1f402366b1776fbf84e635678a51414f ]
This patch fixes crashes during boot for HVM guests on older (pre HVM vector callback) Xen versions. Without this, current kernels will always fail to boot on those Xen versions.
Sample stack trace:
BUG: unable to handle kernel paging request at ffffffffff200000
IP: __xen_evtchn_do_upcall+0x1e/0x80
PGD 1e0e067 P4D 1e0e067 PUD 1e10067 PMD 235c067 PTE 0
Oops: 0002 [#1] SMP PTI
Modules linked in:
CPU: 0 PID: 512 Comm: kworker/u2:0 Not tainted 4.14.33-52.13.amzn1.x86_64 #1
Hardware name: Xen HVM domU, BIOS 3.4.3.amazon 11/11/2016
task: ffff88002531d700 task.stack: ffffc90000480000
RIP: 0010:__xen_evtchn_do_upcall+0x1e/0x80
RSP: 0000:ffff880025403ef0 EFLAGS: 00010046
RAX: ffffffff813cc760 RBX: ffffffffff200000 RCX: ffffc90000483ef0
RDX: ffff880020540a00 RSI: ffff880023c78000 RDI: 000000000000001c
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff880025403f5c R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff880025400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff200000 CR3: 0000000001e0a000 CR4: 00000000000006f0
Call Trace:
<IRQ>
do_hvm_evtchn_intr+0xa/0x10
__handle_irq_event_percpu+0x43/0x1a0
handle_irq_event_percpu+0x20/0x50
handle_irq_event+0x39/0x60
handle_fasteoi_irq+0x80/0x140
handle_irq+0xaf/0x120
do_IRQ+0x41/0xd0
common_interrupt+0x7d/0x7d
</IRQ>During boot, the HYPERVISOR_shared_info page gets remapped to make it work with KASLR. This means that any pointer derived from it needs to be adjusted.
The only value that this applies to is the vcpu_info pointer for VCPU 0. For PV and HVM with the callback vector feature, this gets done via the smp_ops prepare_boot_cpu callback. Older Xen versions do not support the HVM callback vector, so there is no Xen-specific smp_ops set up in that scenario. So, the vcpu_info pointer for VCPU 0 never gets set to the proper value, and the first reference of it will be bad. Fix this by resetting it immediately after the remap.
--- arch/x86/xen/enlighten_hvm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/xen/enlighten_hvm.c +13 -0
@@ -65,6 +65,19 @@ static void __init xen_hvm_init_mem_mapp {early_memunmap (HYPERVISOR_shared_info,PAGE_SIZE ); HYPERVISOR_shared_info =__va (PFN_PHYS (shared_info_pfn)); + +/* +* The virtual address of the shared_info page has changed, so +* the vcpu_info pointer for VCPU 0 is now stale. +* +* The prepare_boot_cpu callback will re-initialize it via +* xen_vcpu_setup, but we can't rely on that to be called for +* old Xen versions (xen_have_vector_callback == 0). +* +* It is, in any case, bad to have a stale vcpu_info pointer +* so reset it now. +*/ +xen_vcpu_info_reset (0 ); }static void __init init_hvm_pv_info (void )
Greg Kroah-Hartman
maintainerPATCH 201/279 x86/xen: Reset VCPU0 info pointer after shared_info remap
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: "van der Linden, Frank" <[email protected]>
[ Upstream commit d1ecfa9d1f402366b1776fbf84e635678a51414f ]
This patch fixes crashes during boot for HVM guests on older (pre HVM vector callback) Xen versions. Without this, current kernels will always fail to boot on those Xen versions.
Sample stack trace:
BUG: unable to handle kernel paging request at ffffffffff200000
IP: __xen_evtchn_do_upcall+0x1e/0x80
PGD 1e0e067 P4D 1e0e067 PUD 1e10067 PMD 235c067 PTE 0
Oops: 0002 [#1] SMP PTI
Modules linked in:
CPU: 0 PID: 512 Comm: kworker/u2:0 Not tainted 4.14.33-52.13.amzn1.x86_64 #1
Hardware name: Xen HVM domU, BIOS 3.4.3.amazon 11/11/2016
task: ffff88002531d700 task.stack: ffffc90000480000
RIP: 0010:__xen_evtchn_do_upcall+0x1e/0x80
RSP: 0000:ffff880025403ef0 EFLAGS: 00010046
RAX: ffffffff813cc760 RBX: ffffffffff200000 RCX: ffffc90000483ef0
RDX: ffff880020540a00 RSI: ffff880023c78000 RDI: 000000000000001c
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff880025403f5c R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff880025400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff200000 CR3: 0000000001e0a000 CR4: 00000000000006f0
Call Trace:
<IRQ>
do_hvm_evtchn_intr+0xa/0x10
__handle_irq_event_percpu+0x43/0x1a0
handle_irq_event_percpu+0x20/0x50
handle_irq_event+0x39/0x60
handle_fasteoi_irq+0x80/0x140
handle_irq+0xaf/0x120
do_IRQ+0x41/0xd0
common_interrupt+0x7d/0x7d
</IRQ>During boot, the HYPERVISOR_shared_info page gets remapped to make it work with KASLR. This means that any pointer derived from it needs to be adjusted.
The only value that this applies to is the vcpu_info pointer for VCPU 0. For PV and HVM with the callback vector feature, this gets done via the smp_ops prepare_boot_cpu callback. Older Xen versions do not support the HVM callback vector, so there is no Xen-specific smp_ops set up in that scenario. So, the vcpu_info pointer for VCPU 0 never gets set to the proper value, and the first reference of it will be bad. Fix this by resetting it immediately after the remap.
--- arch/x86/xen/enlighten_hvm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/xen/enlighten_hvm.c +13 -0
@@ -65,6 +65,19 @@ static void __init xen_hvm_init_mem_mapp {early_memunmap (HYPERVISOR_shared_info,PAGE_SIZE ); HYPERVISOR_shared_info =__va (PFN_PHYS (shared_info_pfn)); + +/* +* The virtual address of the shared_info page has changed, so +* the vcpu_info pointer for VCPU 0 is now stale. +* +* The prepare_boot_cpu callback will re-initialize it via +* xen_vcpu_setup, but we can't rely on that to be called for +* old Xen versions (xen_have_vector_callback == 0). +* +* It is, in any case, bad to have a stale vcpu_info pointer +* so reset it now. +*/ +xen_vcpu_info_reset (0 ); }static void __init init_hvm_pv_info (void )
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Greg Kroah-Hartman
maintainerPATCH 202/279 net: aquantia: driver should correctly declare vlan_features bits
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Russkikh <[email protected]>
[ Upstream commit 8c61ab7f111a2b29d051348b9cb9a39804ebf1f8 ]
In particular, not reporting SG forced skbs to be linear for vlan interfaces over atlantic NIC.
With this fix it is possible to enable SG feature on device and therefore optimize performance.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +2 -0
@@ -246,6 +246,8 @@ void aq_nic_ndev_init(struct aq_nic_s *s self->ndev->hw_features |= aq_hw_caps->hw_features; self->ndev->features = aq_hw_caps->hw_features; + self->ndev->vlan_features |=NETIF_F_HW_CSUM |NETIF_F_RXCSUM | +NETIF_F_RXHASH |NETIF_F_SG |NETIF_F_LRO ; self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; self->ndev->priv_flags |=IFF_LIVE_ADDR_CHANGE ;
Greg Kroah-Hartman
maintainerPATCH 203/279 net: aquantia: Limit number of vectors to actually allocated irqs
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Russkikh <[email protected]>
[ Upstream commit a09bd81b5413d1b4d705c6c5303b5d311069da22 ]
Driver should use pci_alloc_irq_vectors return value to correct number of allocated vectors and napi instances. Otherwise it'll panic later in pci_irq_vector.
Driver also should allow more than one MSI vectors to be allocated.
Error return path from pci_alloc_irq_vectors is also fixed to revert resources in a correct sequence when error happens.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 1 drivers/net/ethernet/aquantia/atlantic/aq_nic.h | 1 drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 20 +++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1 -0
@@ -95,6 +95,7 @@ void aq_nic_cfg_start(struct aq_nic_s *s/*rss rings */ cfg->vecs =min (cfg->aq_hw_caps->vecs,AQ_CFG_VECS_DEF ); cfg->vecs =min (cfg->vecs,num_online_cpus ()); + cfg->vecs =min (cfg->vecs, self->irqvecs);/* cfg->vecs should be power of 2 for RSS */ if (cfg->vecs >=8U ) cfg->vecs =8U ;
drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 -0
@@ -80,6 +80,7 @@ struct aq_nic_s {struct pci_dev *pdev;unsigned int msix_entry_mask; +u32 irqvecs; };static inline struct device *aq_nic_get_dev (struct aq_nic_s *self)
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +10 -10
@@ -267,16 +267,16 @@ static int aq_pci_probe(struct pci_dev * numvecs =min (numvecs,num_online_cpus ());/*enable interrupts */ #if !AQ_CFG_FORCE_LEGACY_INT - err =pci_alloc_irq_vectors (self->pdev, numvecs, numvecs, -PCI_IRQ_MSIX ); - -if (err <0 ) { - err =pci_alloc_irq_vectors (self->pdev,1 ,1 , -PCI_IRQ_MSI |PCI_IRQ_LEGACY ); -if (err <0 ) - goto err_hwinit; + numvecs =pci_alloc_irq_vectors (self->pdev,1 , numvecs, +PCI_IRQ_MSIX |PCI_IRQ_MSI | +PCI_IRQ_LEGACY ); + +if (numvecs <0 ) { + err = numvecs; + goto err_hwinit; }#endif + self->irqvecs = numvecs;/* net device init */ aq_nic_cfg_start (self);
@@ -298,9 +298,9 @@ err_free_aq_hw:kfree (self->aq_hw); err_ioremap:free_netdev (ndev); -err_pci_func: -pci_release_regions (pdev); err_ndev: +pci_release_regions (pdev); +err_pci_func:pci_disable_device (pdev);return err; }
Greg Kroah-Hartman
maintainerPATCH 204/279 powerpc/pseries: Fix CONFIG_NUMA=n build
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 6c0a8f6b5a45ac892a763b6299bd3c5324fc5e02 ]
The build is failing with CONFIG_NUMA=n and some compiler versions:
arch/powerpc/platforms/pseries/hotplug-cpu.o: In function `dlpar_online_cpu':
hotplug-cpu.c:(.text+0x12c): undefined reference to timed_topology_update' arch/powerpc/platforms/pseries/hotplug-cpu.o: In function dlpar_cpu_remove':
hotplug-cpu.c:(.text+0x400): undefined reference to `timed_topology_update'
Fix it by moving the empty version of timed_topology_update() into the existing #ifdef block, which has the right guard of SPLPAR && NUMA.
--- arch/powerpc/include/asm/topology.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/topology.h +5 -8
@@ -91,6 +91,7 @@ extern int start_topology_update(void);extern int stop_topology_update (void );extern int prrn_is_enabled (void );extern int find_and_online_cpu_nid (int cpu); +extern int timed_topology_update (int nsecs);#else static inline int start_topology_update (void ) {
@@ -108,16 +109,12 @@ static inline int find_and_online_cpu_ni {return 0 ; } +static inline int timed_topology_update (int nsecs) +{ +return 0 ; +}#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ -#if defined(CONFIG_HOTPLUG_CPU ) || defined(CONFIG_NEED_MULTIPLE_NODES ) -#if defined(CONFIG_PPC_SPLPAR ) -extern int timed_topology_update (int nsecs); -#else -#define timed_topology_update (nsecs) -#endif /* CONFIG_PPC_SPLPAR */ -#endif /* CONFIG_HOTPLUG_CPU || CONFIG_NEED_MULTIPLE_NODES */ -#include <asm-generic/topology.h> #ifdef CONFIG_SMP
Greg Kroah-Hartman
maintainerPATCH 205/279 can: dev: increase bus-off message severity
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
[ Upstream commit 71c23a821c6bcacba71a094efe49ee689605906b ]
bus-off is usually caused by hardware malfunction or configuration error (baud rate mismatch) and causes a complete loss of communication.
Increase the "bus-off" message's severity from netdev_dbg() to netdev_info() to make it visible to the user.
A can interface going into bus-off is similar in severity to ethernet's "Link is Down" message, which is also printed at info level.
It is debatable whether the the "restarted" message should also be changed to netdev_info() to make the interface state changes comprehensible from the kernel log. I have chosen to keep the "restarted" message at dbg for now as the "bus-off" message should be enough for the user to notice and investigate the problem.
--- drivers/net/can/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev.c +1 -1
@@ -605,7 +605,7 @@ void can_bus_off(struct net_device *dev) {struct can_priv *priv =netdev_priv (dev); -netdev_dbg (dev,"bus-off\n" ); +netdev_info (dev,"bus-off\n" );netif_carrier_off (dev);
Greg Kroah-Hartman
maintainerPATCH 206/279 HID: i2c-hid: Add RESEND_REPORT_DESCR quirk for Toshiba Click Mini L9W-B
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 070b9637dd8fa85c3ba7ecc60fe57fa4da9c2d1d ]
The 0457:10fb touchscreen found on the Toshiba Click Mini L9W-B needs to have a report-decriptors command send to it on resume in order for the touchscreen to start generating events again on resume.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/i2c-hid/i2c-hid.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -966,6 +966,7 @@#define USB_DEVICE_ID_SIS817_TOUCH 0x0817#define USB_DEVICE_ID_SIS_TS 0x1013#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 +#define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb#define USB_VENDOR_ID_SKYCABLE 0x1223#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
drivers/hid/i2c-hid/i2c-hid.c +2 -0
@@ -174,6 +174,8 @@ static const struct i2c_hid_quirks { I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, {I2C_VENDOR_ID_RAYD ,I2C_PRODUCT_ID_RAYD_3118 , I2C_HID_QUIRK_RESEND_REPORT_DESCR }, + { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH, + I2C_HID_QUIRK_RESEND_REPORT_DESCR }, { 0, 0 } };
Greg Kroah-Hartman
maintainerPATCH 207/279 arm64: Add MIDR encoding for NVIDIA CPUs
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gilhooley <[email protected]>
[ Upstream commit 1b06bd8dd95f7a19ab33fdf0f477c94950822ab3 ]
This patch adds the MIDR encodings for NVIDIA as well as the Denver and Carmel CPUs used in Tegra SoCs.
--- arch/arm64/include/asm/cputype.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/include/asm/cputype.h +6 -0
@@ -75,6 +75,7 @@#define ARM_CPU_IMP_CAVIUM 0x43#define ARM_CPU_IMP_BRCM 0x42#define ARM_CPU_IMP_QCOM 0x51 +#define ARM_CPU_IMP_NVIDIA 0x4E#define ARM_CPU_PART_AEM_V8 0xD0F#define ARM_CPU_PART_FOUNDATION 0xD00
@@ -98,6 +99,9 @@#define QCOM_CPU_PART_FALKOR 0xC00#define QCOM_CPU_PART_KRYO 0x200 +#define NVIDIA_CPU_PART_DENVER 0x003 +#define NVIDIA_CPU_PART_CARMEL 0x004 +#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
@@ -112,6 +116,8 @@#define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)#define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) +#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER) +#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)#ifndef __ASSEMBLY__
Greg Kroah-Hartman
maintainerPATCH 208/279 cifs: Allocate validate negotiation request through kmalloc
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
[ Upstream commit 2796d303e3c5ec213c578ed3a66872205c126eb8 ]
The data buffer allocated on the stack can't be DMA'ed, ib_dma_map_page will return an invalid DMA address for a buffer on stack. Even worse, this incorrect address can't be detected by ib_dma_mapping_error. Sending data from this address to hardware will not fail, but the remote peer will get junk data.
Fix this by allocating the request on the heap in smb3_validate_negotiate.
Changes in v2:
Removed duplicated code on freeing buffers on function exit. (Thanks to Parav Pandit <[email protected]>) Fixed typo in the patch title.
Changes in v3:
Added "Fixes" to the patch.
Changed several sizeof() to use *pointer in place of struct.
Changes in v4:
Added detailed comments on the failure through RDMA. Allocate request buffer using GPF_NOFS. Fixed possible memory leak.
Changes in v5:
Removed variable ret for checking return value.
Changed to use pneg_inbuf->Dialects[0] to calculate unused space in pneg_inbuf.
--- fs/cifs/smb2pdu.c | 68 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 30 deletions(-)
fs/cifs/smb2pdu.c +38 -30
@@ -621,8 +621,8 @@ neg_exit:int smb3_validate_negotiate (const unsigned int xid,struct cifs_tcon *tcon) { -int rc =0 ; -struct validate_negotiate_info_req vneg_inbuf; +int rc; +struct validate_negotiate_info_req *pneg_inbuf;struct validate_negotiate_info_rsp *pneg_rsp =NULL ;u32 rsplen;u32 inbuflen;/* max of 4 dialects */
@@ -656,63 +656,69 @@ int smb3_validate_negotiate(const unsignif (tcon->ses->session_flags &SMB2_SESSION_FLAG_IS_NULL )cifs_dbg (VFS ,"Unexpected null user (anonymous) auth flag sent by server\n" ); - vneg_inbuf.Capabilities = + pneg_inbuf =kmalloc (sizeof (*pneg_inbuf),GFP_NOFS ); +if (!pneg_inbuf) +return -ENOMEM ; + + pneg_inbuf->Capabilities =cpu_to_le32 (tcon->ses->server->vals->req_capabilities); -memcpy (vneg_inbuf.Guid, tcon->ses->server->client_guid, +memcpy (pneg_inbuf->Guid, tcon->ses->server->client_guid,SMB2_CLIENT_GUID_SIZE );if (tcon->ses->sign) - vneg_inbuf.SecurityMode = + pneg_inbuf->SecurityMode =cpu_to_le16 (SMB2_NEGOTIATE_SIGNING_REQUIRED );else if (global_secflags &CIFSSEC_MAY_SIGN ) - vneg_inbuf.SecurityMode = + pneg_inbuf->SecurityMode =cpu_to_le16 (SMB2_NEGOTIATE_SIGNING_ENABLED );else - vneg_inbuf.SecurityMode =0 ; + pneg_inbuf->SecurityMode =0 ;if (strcmp (tcon->ses->server->vals->version_string,SMB3ANY_VERSION_STRING ) ==0 ) { - vneg_inbuf.Dialects[0 ] =cpu_to_le16 (SMB30_PROT_ID ); - vneg_inbuf.Dialects[1 ] =cpu_to_le16 (SMB302_PROT_ID ); - vneg_inbuf.DialectCount =cpu_to_le16 (2 ); + pneg_inbuf->Dialects[0 ] =cpu_to_le16 (SMB30_PROT_ID ); + pneg_inbuf->Dialects[1 ] =cpu_to_le16 (SMB302_PROT_ID ); + pneg_inbuf->DialectCount =cpu_to_le16 (2 );/* structure is big enough for 3 dialects, sending only 2 */ - inbuflen =sizeof (struct validate_negotiate_info_req ) -2 ; + inbuflen =sizeof (*pneg_inbuf) - +sizeof (pneg_inbuf->Dialects[0 ]); }else if (strcmp (tcon->ses->server->vals->version_string,SMBDEFAULT_VERSION_STRING ) ==0 ) { - vneg_inbuf.Dialects[0 ] =cpu_to_le16 (SMB21_PROT_ID ); - vneg_inbuf.Dialects[1 ] =cpu_to_le16 (SMB30_PROT_ID ); - vneg_inbuf.Dialects[2 ] =cpu_to_le16 (SMB302_PROT_ID ); - vneg_inbuf.DialectCount =cpu_to_le16 (3 ); + pneg_inbuf->Dialects[0 ] =cpu_to_le16 (SMB21_PROT_ID ); + pneg_inbuf->Dialects[1 ] =cpu_to_le16 (SMB30_PROT_ID ); + pneg_inbuf->Dialects[2 ] =cpu_to_le16 (SMB302_PROT_ID ); + pneg_inbuf->DialectCount =cpu_to_le16 (3 );/* structure is big enough for 3 dialects */ - inbuflen =sizeof (struct validate_negotiate_info_req ); + inbuflen =sizeof (*pneg_inbuf); }else {/* otherwise specific dialect was requested */ - vneg_inbuf.Dialects[0 ] = + pneg_inbuf->Dialects[0 ] =cpu_to_le16 (tcon->ses->server->vals->protocol_id); - vneg_inbuf.DialectCount =cpu_to_le16 (1 ); + pneg_inbuf->DialectCount =cpu_to_le16 (1 );/* structure is big enough for 3 dialects, sending only 1 */ - inbuflen =sizeof (struct validate_negotiate_info_req ) -4 ; + inbuflen =sizeof (*pneg_inbuf) - +sizeof (pneg_inbuf->Dialects[0 ]) *2 ; } rc =SMB2_ioctl (xid, tcon,NO_FILE_ID ,NO_FILE_ID ,FSCTL_VALIDATE_NEGOTIATE_INFO , true/* is_fsctl */ , - (char *)&vneg_inbuf,sizeof (struct validate_negotiate_info_req ), - (char **)&pneg_rsp, &rsplen); + (char *)pneg_inbuf, inbuflen, (char **)&pneg_rsp, &rsplen);if (rc !=0 ) {cifs_dbg (VFS ,"validate protocol negotiate failed: %d\n" , rc); -return -EIO ; + rc = -EIO ; + goto out_free_inbuf; } -if (rsplen !=sizeof (struct validate_negotiate_info_rsp )) { + rc = -EIO ; +if (rsplen !=sizeof (*pneg_rsp)) {cifs_dbg (VFS ,"invalid protocol negotiate response size: %d\n" , rsplen);/* relax check since Mac returns max bufsize allowed on ioctl */ -if ((rsplen > CIFSMaxBufSize) - || (rsplen <sizeof (struct validate_negotiate_info_rsp ))) - goto err_rsp_free; +if (rsplen > CIFSMaxBufSize || rsplen <sizeof (*pneg_rsp)) + goto out_free_rsp; }/* check validate negotiate info response matches what we got earlier */
@@ -729,15 +735,17 @@ int smb3_validate_negotiate(const unsign goto vneg_out;/* validate negotiate successful */ + rc =0 ;cifs_dbg (FYI ,"validate negotiate info successful\n" ); -kfree (pneg_rsp); -return 0 ; + goto out_free_rsp; vneg_out:cifs_dbg (VFS ,"protocol revalidation - security settings mismatch\n" ); -err_rsp_free: +out_free_rsp:kfree (pneg_rsp); -return -EIO ; +out_free_inbuf: +kfree (pneg_inbuf); +return rc; }enum securityEnum
Greg Kroah-Hartman
maintainerPATCH 209/279 cifs: smb2ops: Fix listxattr() when there are no EAs
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit ae2cd7fb478b8da707906ee1706ae1379968a8f9 ]
As per listxattr(2):
On success, a nonnegative number is returned indicating the size of the extended attribute name list. On failure, -1 is returned and errno is set appropriately.
In SMB1, when the server returns an empty EA list through a listxattr(), it will correctly return 0 as there are no EAs for the given file.
However, in SMB2+, it returns -ENODATA in listxattr() which is wrong since the request and response were sent successfully, although there's no actual EA for the given file.
This patch fixes listxattr() for SMB2+ by returning 0 in cifs_listxattr() when the server returns an empty list of EAs.
--- fs/cifs/smb2ops.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/cifs/smb2ops.c +6 -0
@@ -589,9 +589,15 @@ smb2_query_eas(const unsigned int xid, sSMB2_close (xid, tcon, fid.persistent_fid, fid.volatile_fid); +/* +* If ea_name is NULL (listxattr) and there are no EAs, return 0 as it's +* not an error. Otherwise, the specified ea_name was not found. +*/ if (!rc) rc =move_smb2_ea_to_cifs (ea_data, buf_size, smb2_data,SMB2_MAX_EA_BUF , ea_name); +else if (!ea_name && rc == -ENODATA ) + rc =0 ;kfree (smb2_data);return rc;
Greg Kroah-Hartman
maintainerPATCH 212/279 tipc: eliminate KMSAN uninit-value in strcmp complaint
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ying Xue <[email protected]>
[ Upstream commit 94f6a80c0c11828cb7b3d79294459dd8d761ca89 ]
When we get link properties through netlink interface with tipc_nl_node_get_link(), we don't validate TIPC_NLA_LINK_NAME attribute at all, instead we directly use it. As a consequence, KMSAN detected the TIPC_NLA_LINK_NAME attribute was an uninitialized value, and then posted the following complaint:
==================================================================
BUG: KMSAN: uninit-value in strcmp+0xf7/0x160 lib/string.c:329 CPU: 1 PID: 4527 Comm: syz-executor655 Not tainted 4.16.0+ #87 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683 strcmp+0xf7/0x160 lib/string.c:329 tipc_nl_node_get_link+0x220/0x6f0 net/tipc/node.c:1881 genl_family_rcv_msg net/netlink/genetlink.c:599 [inline] genl_rcv_msg+0x1686/0x1810 net/netlink/genetlink.c:624 netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2447 genl_rcv+0x63/0x80 net/netlink/genetlink.c:635 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline] netlink_unicast+0x166b/0x1740 net/netlink/af_netlink.c:1337 netlink_sendmsg+0x1048/0x1310 net/netlink/af_netlink.c:1900 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046 __sys_sendmsg net/socket.c:2080 [inline] SYSC_sendmsg+0x2a3/0x3d0 net/socket.c:2091 SyS_sendmsg+0x54/0x80 net/socket.c:2087 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x445589 RSP: 002b:00007fb7ee66cdb8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000006dac24 RCX: 0000000000445589 RDX: 0000000000000000 RSI: 0000000020023000 RDI: 0000000000000003 RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffa2bf3f3f R14: 00007fb7ee66d9c0 R15: 0000000000000001
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2737 [inline] __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:984 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1183 [inline] netlink_sendmsg+0x9a6/0x1310 net/netlink/af_netlink.c:1875 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046 __sys_sendmsg net/socket.c:2080 [inline] SYSC_sendmsg+0x2a3/0x3d0 net/socket.c:2091 SyS_sendmsg+0x54/0x80 net/socket.c:2087 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 ==================================================================
To quiet the complaint, TIPC_NLA_LINK_NAME attribute has been validated in tipc_nl_node_get_link() before it's used.
--- net/tipc/node.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
net/tipc/node.c +13 -2
@@ -1863,6 +1863,7 @@ out:int tipc_nl_node_get_link (struct sk_buff *skb,struct genl_info *info) {struct net *net =genl_info_net (info); +struct nlattr *attrs[TIPC_NLA_LINK_MAX +1 ];struct tipc_nl_msg msg;char *name;int err;
@@ -1870,9 +1871,19 @@ int tipc_nl_node_get_link(struct sk_buff msg.portid = info->snd_portid; msg.seq = info->snd_seq; -if (!info->attrs[TIPC_NLA_LINK_NAME ]) +if (!info->attrs[TIPC_NLA_LINK ])return -EINVAL ; - name =nla_data (info->attrs[TIPC_NLA_LINK_NAME ]); + + err =nla_parse_nested (attrs,TIPC_NLA_LINK_MAX , + info->attrs[TIPC_NLA_LINK ], + tipc_nl_link_policy, info->extack); +if (err) +return err; + +if (!attrs[TIPC_NLA_LINK_NAME ]) +return -EINVAL ; + + name =nla_data (attrs[TIPC_NLA_LINK_NAME ]); msg.skb =nlmsg_new (NLMSG_GOODSIZE ,GFP_KERNEL );if (!msg.skb)
Greg Kroah-Hartman
maintainerPATCH 213/279 qed: Fix l2 initializations over iWARP personality
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kalderon <[email protected]>
[ Upstream commit af6858ee423a309d93054c361c61099b8eb12bbf ]
If qede driver was loaded on a device configured for iWARP the l2 mutex wouldn't be allocated, and some l2 related resources wouldn't be freed.
--- drivers/net/ethernet/qlogic/qed/qed_l2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_l2.c +2 -4
@@ -115,8 +115,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfnvoid qed_l2_setup (struct qed_hwfn *p_hwfn) { -if (p_hwfn->hw_info.personality !=QED_PCI_ETH && - p_hwfn->hw_info.personality !=QED_PCI_ETH_ROCE ) +if (!QED_IS_L2_PERSONALITY (p_hwfn))return ;mutex_init (&p_hwfn->p_l2_info->lock);
@@ -126,8 +125,7 @@ void qed_l2_free(struct qed_hwfn *p_hwfn {u32 i; -if (p_hwfn->hw_info.personality !=QED_PCI_ETH && - p_hwfn->hw_info.personality !=QED_PCI_ETH_ROCE ) +if (!QED_IS_L2_PERSONALITY (p_hwfn))return ;if (!p_hwfn->p_l2_info)
Greg Kroah-Hartman
maintainerPATCH 214/279 qede: Fix gfp flags sent to rdma event node allocation
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kalderon <[email protected]>
[ Upstream commit 090477e4acb31c5dd674940c7c01d4f16bd1ac41 ]
A previous commit 4609adc27175 ("qede: Fix qedr link update") added a flow that could allocate rdma event objects from an interrupt path (link notification). Therefore the kzalloc call should be done with GFP_ATOMIC.
--- drivers/net/ethernet/qlogic/qede/qede_rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_rdma.c +1 -1
@@ -238,7 +238,7 @@ qede_rdma_get_free_event_node(struct qed }if (!found) { - event_node =kzalloc (sizeof (*event_node),GFP_KERNEL ); + event_node =kzalloc (sizeof (*event_node),GFP_ATOMIC );if (!event_node) {DP_NOTICE (edev,"qedr: Could not allocate memory for rdma work\n" );
Greg Kroah-Hartman
maintainerPATCH 215/279 cxgb4: copy mbox log size to PF0-3 adap instances
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ganesh Goudar <[email protected]>
[ Upstream commit aca06eafd09f48ca4d97f3c0b2a12c8d631116f0 ]
copy mbox size to adapter instances of PF0-3 to avoid mbox log overflow. This fixes the possible protection fault.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -2
@@ -5191,6 +5191,7 @@ static int init_one(struct pci_dev *pdev }spin_lock_init (&adapter->mbox_lock);INIT_LIST_HEAD (&adapter->mlist.list); + adapter->mbox_log->size =T4_OS_LOG_MBOX_CMDS ;pci_set_drvdata (pdev, adapter);if (func != ent->driver_data) {
@@ -5225,8 +5226,6 @@ static int init_one(struct pci_dev *pdev goto out_free_adapter; } - adapter->mbox_log->size =T4_OS_LOG_MBOX_CMDS ; -/* PCI device has been enabled */ adapter->flags |=DEV_ENABLED ;memset (adapter->chan_map,0xff ,sizeof (adapter->chan_map));
Greg Kroah-Hartman
maintainerPATCH 216/279 rxrpc: Fix missing start of call timeout
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit c54e43d752c7187595c8c62a231e0b0d53c7fded ]
The expect_rx_by call timeout is supposed to be set when a call is started to indicate that we need to receive a packet by that point. This is currently put back every time we receive a packet, but it isn't started when we first send a packet. Without this, the call may wait forever if the server doesn't deign to reply.
Fix this by setting the timeout upon a successful UDP sendmsg call for the first DATA packet. The timeout is initiated only for initial transmission and not for subsequent retries as we don't want the retry mechanism to extend the timeout indefinitely.
--- net/rxrpc/ar-internal.h | 1 + net/rxrpc/input.c | 2 +- net/rxrpc/output.c | 11 +++++++++++ net/rxrpc/sendmsg.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-)
net/rxrpc/ar-internal.h +1 -0
@@ -464,6 +464,7 @@ enum rxrpc_call_flag {RXRPC_CALL_SEND_PING ,/* A ping will need to be sent */ RXRPC_CALL_PINGING ,/* Ping in process */ RXRPC_CALL_RETRANS_TIMEOUT ,/* Retransmission due to timeout occurred */ + RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */ };/*
net/rxrpc/input.c +1 -1
@@ -971,7 +971,7 @@ static void rxrpc_input_call_packet(struif (timo) {unsigned long now = jiffies, expect_rx_by; - expect_rx_by = jiffies + timo; + expect_rx_by = now + timo;WRITE_ONCE (call->expect_rx_by, expect_rx_by);rxrpc_reduce_call_timer (call, expect_rx_by, now, rxrpc_timer_set_for_normal);
net/rxrpc/output.c +11 -0
@@ -407,6 +407,17 @@ done: rxrpc_timer_set_for_lost_ack); } } + +if (sp->hdr.seq ==1 && + !test_and_set_bit (RXRPC_CALL_BEGAN_RX_TIMER , + &call->flags)) { +unsigned long nowj = jiffies, expect_rx_by; + + expect_rx_by = nowj + call->next_rx_timo; +WRITE_ONCE (call->expect_rx_by, expect_rx_by); +rxrpc_reduce_call_timer (call, expect_rx_by, nowj, + rxrpc_timer_set_for_normal); + } }rxrpc_set_keepalive (call);
net/rxrpc/sendmsg.c +10 -0
@@ -223,6 +223,15 @@ static void rxrpc_queue_packet(struct rx ret =rxrpc_send_data_packet (call, skb, false);if (ret <0 ) { +switch (ret) { +case -ENETUNREACH : +case -EHOSTUNREACH : +case -ECONNREFUSED : +rxrpc_set_call_completion (call, +RXRPC_CALL_LOCAL_ERROR , +0 , ret); + goto out; + }_debug ("need instant resend %d" , ret);rxrpc_instant_resend (call, ix); }else {
@@ -241,6 +250,7 @@ static void rxrpc_queue_packet(struct rx rxrpc_timer_set_for_send); } +out:rxrpc_free_skb (skb, rxrpc_skb_tx_freed);_leave ("" ); }
Greg Kroah-Hartman
maintainerPATCH 217/279 rxrpc: Fix error reception on AF_INET6 sockets
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit f2aeed3a591ff29a82495eeaa92ac4780bad7487 ]
AF_RXRPC tries to turn on IP_RECVERR and IP_MTU_DISCOVER on the UDP socket it just opened for communications with the outside world, regardless of the type of socket. Unfortunately, this doesn't work with an AF_INET6 socket.
Fix this by turning on IPV6_RECVERR and IPV6_MTU_DISCOVER instead if the socket is of the AF_INET6 family.
Without this, kAFS server and address rotation doesn't work correctly because the algorithm doesn't detect received network errors.
--- net/rxrpc/local_object.c | 57 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-)
net/rxrpc/local_object.c +42 -15
@@ -133,22 +133,49 @@ static int rxrpc_open_socket(struct rxrp } } -/* we want to receive ICMP errors */ - opt =1 ; - ret =kernel_setsockopt (local->socket,SOL_IP ,IP_RECVERR , - (char *) &opt,sizeof (opt)); -if (ret <0 ) { -_debug ("setsockopt failed" ); - goto error; - } +switch (local->srx.transport.family) { +case AF_INET : +/* we want to receive ICMP errors */ + opt =1 ; + ret =kernel_setsockopt (local->socket,SOL_IP ,IP_RECVERR , + (char *) &opt,sizeof (opt)); +if (ret <0 ) { +_debug ("setsockopt failed" ); + goto error; + } + +/* we want to set the don't fragment bit */ + opt =IP_PMTUDISC_DO ; + ret =kernel_setsockopt (local->socket,SOL_IP ,IP_MTU_DISCOVER , + (char *) &opt,sizeof (opt)); +if (ret <0 ) { +_debug ("setsockopt failed" ); + goto error; + } +break ; + +case AF_INET6 : +/* we want to receive ICMP errors */ + opt =1 ; + ret =kernel_setsockopt (local->socket,SOL_IPV6 ,IPV6_RECVERR , + (char *) &opt,sizeof (opt)); +if (ret <0 ) { +_debug ("setsockopt failed" ); + goto error; + } + +/* we want to set the don't fragment bit */ + opt =IPV6_PMTUDISC_DO ; + ret =kernel_setsockopt (local->socket,SOL_IPV6 ,IPV6_MTU_DISCOVER , + (char *) &opt,sizeof (opt)); +if (ret <0 ) { +_debug ("setsockopt failed" ); + goto error; + } +break ; -/* we want to set the don't fragment bit */ - opt =IP_PMTUDISC_DO ; - ret =kernel_setsockopt (local->socket,SOL_IP ,IP_MTU_DISCOVER , - (char *) &opt,sizeof (opt)); -if (ret <0 ) { -_debug ("setsockopt failed" ); - goto error; +default : +BUG (); }/* set the socket up */
Greg Kroah-Hartman
maintainerPATCH 218/279 rxrpc: Fix the min security level for kernel calls
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 93864fc3ffcc4bf70e96cfb5cc6e941630419ad0 ]
Fix the kernel call initiation to set the minimum security level for kernel initiated calls (such as from kAFS) from the sockopt value.
--- net/rxrpc/af_rxrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/af_rxrpc.c +1 -1
@@ -310,7 +310,7 @@ struct rxrpc_call *rxrpc_kernel_begin_camemset (&cp,0 ,sizeof (cp)); cp.local = rx->local; cp.key = key; - cp.security_level =0 ; + cp.security_level = rx->min_sec_level; cp.exclusive = false; cp.upgrade = upgrade; cp.service_id = srx->srx_service;
Greg Kroah-Hartman
maintainerPATCH 219/279 ARM: dts: imx51-zii-rdu1: fix touchscreen bindings
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Yushchenko <[email protected]>
[ Upstream commit 6d3299aef7df7225ecff653feedafb5d1646998b ]
This fixes errors in RDU1 device tree that cause touch screens not working.
--- arch/arm/boot/dts/imx51-zii-rdu1.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/imx51-zii-rdu1.dts +3 -3
@@ -518,7 +518,7 @@ }; touchscreen@20 { - compatible = "syna,rmi4_i2c"; + compatible = "syna,rmi4-i2c"; reg = <0x20>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_ts>;
@@ -536,8 +536,8 @@ rmi4-f11@11 { reg = <0x11>; - touch-inverted-y; - touch-swapped-x-y; + touchscreen-inverted-y; + touchscreen-swapped-x-y; syna,sensor-type = <1>; }; };
Greg Kroah-Hartman
maintainerPATCH 221/279 x86: Delay skip of emulated hypercall instruction
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marian Rotariu <[email protected]>
[ Upstream commit 6356ee0c9602004e0a3b4b2dad68ee2ee9385b17 ]
The IP increment should be done after the hypercall emulation, after calling the various handlers. In this way, these handlers can accurately identify the the IP of the VMCALL if they need it.
This patch keeps the same functionality for the Hyper-V handler which does not use the return code of the standard kvm_skip_emulated_instruction() call.
--- arch/x86/kvm/hyperv.c | 2 +- arch/x86/kvm/x86.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-)
arch/x86/kvm/hyperv.c +1 -1
@@ -1223,7 +1223,7 @@ static int kvm_hv_hypercall_complete_usestruct kvm_run *run = vcpu->run;kvm_hv_hypercall_set_result (vcpu, run->hyperv.u.hcall.result); -return 1 ; +return kvm_skip_emulated_instruction (vcpu); }int kvm_hv_hypercall (struct kvm_vcpu *vcpu)
arch/x86/kvm/x86.c +11 -8
@@ -6553,12 +6553,13 @@ void kvm_vcpu_deactivate_apicv(struct kvint kvm_emulate_hypercall (struct kvm_vcpu *vcpu) {unsigned long nr, a0, a1, a2, a3, ret; -int op_64_bit, r; +int op_64_bit; - r =kvm_skip_emulated_instruction (vcpu); - -if (kvm_hv_hypercall_enabled (vcpu->kvm)) -return kvm_hv_hypercall (vcpu); +if (kvm_hv_hypercall_enabled (vcpu->kvm)) { +if (!kvm_hv_hypercall (vcpu)) +return 0 ; + goto out; + } nr =kvm_register_read (vcpu,VCPU_REGS_RAX ); a0 =kvm_register_read (vcpu,VCPU_REGS_RBX );
@@ -6579,7 +6580,7 @@ int kvm_emulate_hypercall(struct kvm_vcpif (kvm_x86_ops->get_cpl (vcpu) !=0 ) { ret = -KVM_EPERM ; - goto out; + goto out_error; }switch (nr) {
@@ -6599,12 +6600,14 @@ int kvm_emulate_hypercall(struct kvm_vcp ret = -KVM_ENOSYS ;break ; } -out: +out_error:if (!op_64_bit) ret = (u32 )ret;kvm_register_write (vcpu,VCPU_REGS_RAX , ret); + +out: ++vcpu->stat.hypercalls; -return r; +return kvm_skip_emulated_instruction (vcpu); }EXPORT_SYMBOL_GPL (kvm_emulate_hypercall);
Greg Kroah-Hartman
maintainerPATCH 222/279 perf cs-etm: Support unknown_thread in cs_etm_auxtrace
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 46d53620044f7b574c0f3216f8b4f2ce3559ce31 ]
CoreSight doesn't allocate thread structure for unknown_thread in ETM auxtrace, so unknown_thread is NULL pointer. If the perf data doesn't contain valid tid and then cs_etm__mem_access() uses unknown_thread instead as thread handler, this results in a segmentation fault when thread__find_addr_map() accesses the thread handler.
This commit creates a new thread data which is used by unknown_thread, so CoreSight tracing can roll back to use unknown_thread if perf data doesn't include valid thread info. This commit also releases thread data for initialization failure case and for normal auxtrace free flow.
--- tools/perf/util/cs-etm.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
tools/perf/util/cs-etm.c +22 -2
@@ -212,6 +212,7 @@ static void cs_etm__free(struct perf_sesfor (i =0 ; i < aux->num_cpu; i++)zfree (&aux->metadata[i]); +thread__zput (aux->unknown_thread);zfree (&aux->metadata);zfree (&aux); }
@@ -980,6 +981,23 @@ int cs_etm__process_auxtrace_info(union etm->auxtrace.free = cs_etm__free; session->auxtrace = &etm->auxtrace; + etm->unknown_thread =thread__new (999999999 ,999999999 ); +if (!etm->unknown_thread) + goto err_free_queues; + +/* +* Initialize list node so that at thread__zput() we can avoid +* segmentation fault at list_del_init(). +*/ +INIT_LIST_HEAD (&etm->unknown_thread->node); + + err =thread__set_comm (etm->unknown_thread,"unknown" ,0 ); +if (err) + goto err_delete_thread; + +if (thread__init_map_groups (etm->unknown_thread, etm->machine)) + goto err_delete_thread; +if (dump_trace) {cs_etm__print_auxtrace_info (auxtrace_info->priv, num_cpu);return 0 ;
@@ -994,16 +1012,18 @@ int cs_etm__process_auxtrace_info(union err =cs_etm__synth_events (etm, session);if (err) - goto err_free_queues; + goto err_delete_thread; err =auxtrace_queues__process_index (&etm->queues, session);if (err) - goto err_free_queues; + goto err_delete_thread; etm->data_queued = etm->queues.populated;return 0 ; +err_delete_thread: +thread__zput (etm->unknown_thread); err_free_queues:auxtrace_queues__free (&etm->queues); session->auxtrace =NULL ;
Greg Kroah-Hartman
maintainerPATCH 223/279 sh: switch to NO_BOOTMEM
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit ac21fc2dcb405cf250ad3f1228f64f64930d9211 ]
Commit 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc") inadvertently switched the DT unflattening allocations from memblock to bootmem which doesn't work because the unflattening happens before bootmem is initialized. Swapping the order of bootmem init and unflattening could also fix this, but removing bootmem is desired. So enable NO_BOOTMEM on SH like other architectures have done.
--- arch/sh/Kconfig | 1 arch/sh/kernel/setup.c | 1 arch/sh/mm/init.c | 68 ++++--------------------------------------------- arch/sh/mm/numa.c | 19 ------------- 4 files changed, 7 insertions(+), 82 deletions(-)
arch/sh/Kconfig +1 -0
@@ -9,6 +9,7 @@ config SUPERH select HAVE_IDE if HAS_IOPORT_MAP select HAVE_MEMBLOCK select HAVE_MEMBLOCK_NODE_MAP + select NO_BOOTMEM select ARCH_DISCARD_MEMBLOCK select HAVE_OPROFILE select HAVE_GENERIC_DMA_COHERENT
arch/sh/kernel/setup.c +0 -1
@@ -11,7 +11,6 @@#include <linux/ioport.h> #include <linux/init.h> #include <linux/initrd.h> -#include <linux/bootmem.h> #include <linux/console.h> #include <linux/root_dev.h> #include <linux/utsname.h>
arch/sh/mm/init.c +6 -62
102 lines not on this page · raw message
arch/sh/mm/numa.c +0 -19
@@ -8,7 +8,6 @@* for more details. */ #include <linux/module.h> -#include <linux/bootmem.h> #include <linux/memblock.h> #include <linux/mm.h> #include <linux/numa.h>
@@ -26,9 +25,7 @@ EXPORT_SYMBOL_GPL(node_data);*/ void __init setup_bootmem_node (int nid,unsigned long start,unsigned long end) { -unsigned long bootmap_pages;unsigned long start_pfn, end_pfn; -unsigned long bootmem_paddr;/* Don't allow bogus node assignment */ BUG_ON (nid >=MAX_NUMNODES || nid <=0 );
@@ -48,25 +45,9 @@ void __init setup_bootmem_node(int nid, SMP_CACHE_BYTES, end));memset (NODE_DATA (nid),0 ,sizeof (struct pglist_data )); -NODE_DATA (nid)->bdata = &bootmem_node_data[nid];NODE_DATA (nid)->node_start_pfn = start_pfn;NODE_DATA (nid)->node_spanned_pages = end_pfn - start_pfn; -/* Node-local bootmap */ - bootmap_pages =bootmem_bootmap_pages (end_pfn - start_pfn); - bootmem_paddr =memblock_alloc_base (bootmap_pages <<PAGE_SHIFT , -PAGE_SIZE , end); -init_bootmem_node (NODE_DATA (nid), bootmem_paddr >>PAGE_SHIFT , - start_pfn, end_pfn); - -free_bootmem_with_active_regions (nid, end_pfn); - -/* Reserve the pgdat and bootmap space with the bootmem allocator */ -reserve_bootmem_node (NODE_DATA (nid), start_pfn <<PAGE_SHIFT , -sizeof (struct pglist_data ),BOOTMEM_DEFAULT ); -reserve_bootmem_node (NODE_DATA (nid), bootmem_paddr, - bootmap_pages <<PAGE_SHIFT ,BOOTMEM_DEFAULT ); -/* It's up */ node_set_online (nid);
Greg Kroah-Hartman
maintainerPATCH 224/279 ixgbe: return error on unsupported SFP module when resetting
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit bbb2707623f3ccc48695da2433f06d7c38193451 ]
Add check for unsupported module and return the error code. This fixes a Coverity hit due to unused return status from setup_sfp.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +3 -0
@@ -3427,6 +3427,9 @@ static s32 ixgbe_reset_hw_X550em(struct hw->phy.sfp_setup_needed = false; } +if (status ==IXGBE_ERR_SFP_NOT_SUPPORTED ) +return status; +/* Reset PHY */ if (!hw->phy.reset_disable && hw->phy.ops.reset) hw->phy.ops.reset (hw);
Greg Kroah-Hartman
maintainerPATCH 225/279 ixgbe: fix memory leak on ipsec allocation
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit c89ebb968f04c71e16e86c91caeacb045dc8f908 ]
The error clean up path kfree's adapter->ipsec and should be instead kfree'ing ipsec. Fix this. Also, the err1 error exit path does not need to kfree ipsec because this failure path was for the failed allocation of ipsec.
Detected by CoverityScan, CID#146424 ("Resource Leak")
--- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +1 -1
@@ -918,8 +918,8 @@ err2:kfree (ipsec->ip_tbl);kfree (ipsec->rx_tbl);kfree (ipsec->tx_tbl); +kfree (ipsec); err1: -kfree (adapter->ipsec);netdev_err (adapter->netdev,"Unable to allocate memory for SA tables" ); }
Greg Kroah-Hartman
maintainerPATCH 226/279 net sched actions: fix invalid pointer dereferencing if skbedit flags missing
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Mashak <[email protected]>
[ Upstream commit af5d01842fe1fbfb9f5e1c1d957ba02ab6f4569a ]
When application fails to pass flags in netlink TLV for a new skbedit action, the kernel results in the following oops:
[ 8.307732] BUG: unable to handle kernel paging request at 0000000000021130 [ 8.309167] PGD 80000000193d1067 P4D 80000000193d1067 PUD 180e0067 PMD 0 [ 8.310595] Oops: 0000 [#1] SMP PTI [ 8.311334] Modules linked in: kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64 crypto_simd cryptd glue_helper serio_raw [ 8.314190] CPU: 1 PID: 397 Comm: tc Not tainted 4.17.0-rc3+ #357 [ 8.315252] RIP: 0010:__tcf_idr_release+0x33/0x140 [ 8.316203] RSP: 0018:ffffa0718038f840 EFLAGS: 00010246 [ 8.317123] RAX: 0000000000000001 RBX: 0000000000021100 RCX: 0000000000000000 [ 8.319831] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000021100 [ 8.321181] RBP: 0000000000000000 R08: 000000000004adf8 R09: 0000000000000122 [ 8.322645] R10: 0000000000000000 R11: ffffffff9e5b01ed R12: 0000000000000000 [ 8.324157] R13: ffffffff9e0d3cc0 R14: 0000000000000000 R15: 0000000000000000 [ 8.325590] FS: 00007f591292e700(0000) GS:ffff8fcf5bc40000(0000) knlGS:0000000000000000 [ 8.327001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8.327987] CR2: 0000000000021130 CR3: 00000000180e6004 CR4: 00000000001606a0 [ 8.329289] Call Trace: [ 8.329735] tcf_skbedit_init+0xa7/0xb0 [ 8.330423] tcf_action_init_1+0x362/0x410 [ 8.331139] ? try_to_wake_up+0x44/0x430 [ 8.331817] tcf_action_init+0x103/0x190 [ 8.332511] tc_ctl_action+0x11a/0x220 [ 8.333174] rtnetlink_rcv_msg+0x23d/0x2e0 [ 8.333902] ? _cond_resched+0x16/0x40 [ 8.334569] ? __kmalloc_node_track_caller+0x5b/0x2c0 [ 8.335440] ? rtnl_calcit.isra.31+0xf0/0xf0 [ 8.336178] netlink_rcv_skb+0xdb/0x110 [ 8.336855] netlink_unicast+0x167/0x220 [ 8.337550] netlink_sendmsg+0x2a7/0x390 [ 8.338258] sock_sendmsg+0x30/0x40 [ 8.338865] ___sys_sendmsg+0x2c5/0x2e0 [ 8.339531] ? pagecache_get_page+0x27/0x210 [ 8.340271] ? filemap_fault+0xa2/0x630 [ 8.340943] ? page_add_file_rmap+0x108/0x200 [ 8.341732] ? alloc_set_pte+0x2aa/0x530 [ 8.342573] ? finish_fault+0x4e/0x70 [ 8.343332] ? __handle_mm_fault+0xbc1/0x10d0 [ 8.344337] ? __sys_sendmsg+0x53/0x80 [ 8.345040] __sys_sendmsg+0x53/0x80 [ 8.345678] do_syscall_64+0x4f/0x100 [ 8.346339] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 8.347206] RIP: 0033:0x7f591191da67 [ 8.347831] RSP: 002b:00007fff745abd48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 8.349179] RAX: ffffffffffffffda RBX: 00007fff745abe70 RCX: 00007f591191da67 [ 8.350431] RDX: 0000000000000000 RSI: 00007fff745abdc0 RDI: 0000000000000003 [ 8.351659] RBP: 000000005af35251 R08: 0000000000000001 R09: 0000000000000000 [ 8.352922] R10: 00000000000005f1 R11: 0000000000000246 R12: 0000000000000000 [ 8.354183] R13: 00007fff745afed0 R14: 0000000000000001 R15: 00000000006767c0 [ 8.355400] Code: 41 89 d4 53 89 f5 48 89 fb e8 aa 20 fd ff 85 c0 0f 84 ed 00 00 00 48 85 db 0f 84 cf 00 00 00 40 84 ed 0f 85 cd 00 00 00 45 84 e4 <8b> 53 30 74 0d 85 d2 b8 ff ff ff ff 0f 8f b3 00 00 00 8b 43 2c [ 8.358699] RIP: __tcf_idr_release+0x33/0x140 RSP: ffffa0718038f840 [ 8.359770] CR2: 0000000000021130 [ 8.360438] ---[ end trace 60c66be45dfc14f0 ]---
The caller calls action's ->init() and passes pointer to "struct tc_action *a", which later may be initialized to point at the existing action, otherwise "struct tc_action *a" is still invalid, and therefore dereferencing it is an error as happens in tcf_idr_release, where refcnt is decremented.
So in case of missing flags tcf_idr_release must be called only for existing actions.
v2:
- prepare patch for net tree
--- net/sched/act_skbedit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/act_skbedit.c +2 -1
@@ -121,7 +121,8 @@ static int tcf_skbedit_init(struct net *return 0 ;if (!flags) { -tcf_idr_release (*a, bind); +if (exists) +tcf_idr_release (*a, bind);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 227/279 lib/find_bit_benchmark.c: avoid soft lockup in test_find_first_bit()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yury Norov <[email protected]>
[ Upstream commit 4ba281d5bd9907355e6b79fb72049c9ed50cc670 ]
test_find_first_bit() is intentionally sub-optimal, and may cause soft lockup due to long time of run on some systems. So decrease length of bitmap to traverse to avoid lockup.
With the change below, time of test execution doesn't exceed 0.2 seconds on my testing system.
--- lib/find_bit_benchmark.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
lib/find_bit_benchmark.c +6 -1
@@ -132,7 +132,12 @@ static int __init find_bit_test(void)test_find_next_bit (bitmap,BITMAP_LEN );test_find_next_zero_bit (bitmap,BITMAP_LEN );test_find_last_bit (bitmap,BITMAP_LEN ); -test_find_first_bit (bitmap,BITMAP_LEN ); + +/* +* test_find_first_bit() may take some time, so +* traverse only part of bitmap to avoid soft lockup. +*/ +test_find_first_bit (bitmap,BITMAP_LEN /10 );test_find_next_and_bit (bitmap, bitmap2,BITMAP_LEN );pr_err ("\nStart testing find_bit() with sparse bitmap\n" );
Greg Kroah-Hartman
maintainerPATCH 228/279 init: fix false positives in W+X checking
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffrey Hugo <[email protected]>
[ Upstream commit ae646f0b9ca135b87bc73ff606ef996c3029780a ]
load_module() creates W+X mappings via __vmalloc_node_range() (from layout_and_allocate()->move_module()->module_alloc()) by using PAGE_KERNEL_EXEC. These mappings are later cleaned up via "call_rcu_sched(&freeinit->rcu, do_free_init)" from do_init_module().
This is a problem because call_rcu_sched() queues work, which can be run after debug_checkwx() is run, resulting in a race condition. If hit, the race results in a nasty splat about insecure W+X mappings, which results in a poor user experience as these are not the mappings that debug_checkwx() is intended to catch.
This issue is observed on multiple arm64 platforms, and has been artificially triggered on an x86 platform.
Address the race by flushing the queued work before running the arch-defined mark_rodata_ro() which then calls debug_checkwx().
--- init/main.c | 7 +++++++ kernel/module.c | 5 +++++ 2 files changed, 12 insertions(+)
init/main.c +7 -0
@@ -981,6 +981,13 @@ __setup("rodata=", set_debug_rodata);static void mark_readonly (void ) {if (rodata_enabled) { +/* +* load_module() results in W+X mappings, which are cleaned up +* with call_rcu_sched(). Let's make sure that queued work is +* flushed so that we don't hit false positives looking for +* insecure pages which are W+X. +*/ +rcu_barrier_sched ();mark_rodata_ro ();rodata_test (); }else
kernel/module.c +5 -0
@@ -3521,6 +3521,11 @@ static noinline int do_init_module(struc* walking this with preempt disabled. In all the failure paths, we * call synchronize_sched(), but we don't want to slow down the success * path, so use actual RCU here. +* Note that module_alloc() on most architectures creates W+X page +* mappings which won't be cleaned up until do_free_init() runs. Any +* code such as mark_rodata_ro() which depends on those mappings to +* be cleaned up needs to sync with the queued work - ie +* rcu_barrier_sched() */ call_rcu_sched (&freeinit->rcu, do_free_init);mutex_unlock (&module_mutex);
Greg Kroah-Hartman
maintainerPATCH 229/279 proc/kcore: dont bounds check against address 0
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
[ Upstream commit 3955333df9a50e8783d115613a397ae55d905080 ]
The existing kcore code checks for bad addresses against __va(0) with the assumption that this is the lowest address on the system. This may not hold true on some systems (e.g. arm64) and produce overflows and crashes. Switch to using other functions to validate the address range.
It's currently only seen on arm64 and it's not clear if anyone wants to use that particular combination on a stable release. So this is not urgent for stable.
--- fs/proc/kcore.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
fs/proc/kcore.c +16 -7
@@ -209,25 +209,34 @@ kclist_add_private(unsigned long pfn, un {struct list_head *head = (struct list_head *)arg;struct kcore_list *ent; +struct page *p; + +if (!pfn_valid (pfn)) +return 1 ; + + p =pfn_to_page (pfn); +if (!memmap_valid_within (pfn, p,page_zone (p))) +return 1 ; ent =kmalloc (sizeof (*ent),GFP_KERNEL );if (!ent)return -ENOMEM ; - ent->addr = (unsigned long )__va ((pfn <<PAGE_SHIFT )); + ent->addr = (unsigned long )page_to_virt (p); ent->size = nr_pages <<PAGE_SHIFT ; -/* Sanity check: Can happen in 32bit arch...maybe */ -if (ent->addr < (unsigned long )__va (0 )) +if (!virt_addr_valid (ent->addr)) goto free_out;/* cut not-mapped area. ....from ppc-32 code. */ if (ULONG_MAX - ent->addr < ent->size) ent->size =ULONG_MAX - ent->addr; -/* cut when vmalloc() area is higher than direct-map area */ -if (VMALLOC_START > (unsigned long )__va (0 )) { -if (ent->addr >VMALLOC_START ) - goto free_out; +/* +* We've already checked virt_addr_valid so we know this address +* is a valid pointer, therefore we can check against it to determine +* if we need to trim +*/ +if (VMALLOC_START > ent->addr) {if (VMALLOC_START - ent->addr < ent->size) ent->size =VMALLOC_START - ent->addr; }
Greg Kroah-Hartman
maintainerPATCH 230/279 ocfs2: take inode cluster lock before moving reflinked inode from orphan dir
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Samant <[email protected]>
[ Upstream commit e4383029201470523c3ffe339bd7d57e9b4a7d65 ]
While reflinking an inode, we create a new inode in orphan directory, then take EX lock on it, reflink the original inode to orphan inode and release EX lock. Once the lock is released another node could request it in EX mode from ocfs2_recover_orphans() which causes downconvert of the lock, on this node, to NL mode.
Later we attempt to initialize security acl for the orphan inode and move it to the reflink destination. However, while doing this we dont take EX lock on the inode. This could potentially cause problems because we could be starting transaction, accessing journal and modifying metadata of the inode while holding NL lock and with another node holding EX lock on the inode.
Fix this by taking orphan inode cluster lock in EX mode before initializing security and moving orphan inode to reflink destination. Use the __tracker variant while taking inode lock to avoid recursive locking in the ocfs2_init_security_and_acl() call chain.
--- fs/ocfs2/refcounttree.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
fs/ocfs2/refcounttree.c +12 -2
@@ -4250,10 +4250,11 @@ out:static int ocfs2_reflink (struct dentry *old_dentry,struct inode *dir,struct dentry *new_dentry,bool preserve) { -int error; +int error, had_lock;struct inode *inode =d_inode (old_dentry);struct buffer_head *old_bh =NULL ;struct inode *new_orphan_inode =NULL ; +struct ocfs2_lock_holder oh;if (!ocfs2_refcount_tree (OCFS2_SB (inode->i_sb)))return -EOPNOTSUPP ;
@@ -4295,6 +4296,14 @@ static int ocfs2_reflink(struct dentry * goto out; } + had_lock =ocfs2_inode_lock_tracker (new_orphan_inode,NULL ,1 , + &oh); +if (had_lock <0 ) { + error = had_lock; +mlog_errno (error); + goto out; + } +/* If the security isn't preserved, we need to re-initialize them. */ if (!preserve) { error = ocfs2_init_security_and_acl(dir, new_orphan_inode,
@@ -4302,14 +4311,15 @@ static int ocfs2_reflink(struct dentry *if (error)mlog_errno (error); } -out:if (!error) { error =ocfs2_mv_orphaned_inode_to_new (dir, new_orphan_inode, new_dentry);if (error)mlog_errno (error); } +ocfs2_inode_unlock_tracker (new_orphan_inode,1 , &oh, had_lock); +out:if (new_orphan_inode) {/* * We need to open_unlock the inode no matter whether we
Greg Kroah-Hartman
maintainerPATCH 231/279 kprobes/x86: Prohibit probing on exception masking instructions
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit ee6a7354a3629f9b65bc18dbe393503e9440d6f5 ]
Since MOV SS and POP SS instructions will delay the exceptions until the next instruction is executed, single-stepping on it by kprobes must be prohibited.
However, kprobes usually executes those instructions directly on trampoline buffer (a.k.a. kprobe-booster), except for the kprobes which has post_handler. Thus if kprobe user probes MOV SS with post_handler, it will do single-stepping on the MOV SS.
This means it is safe that if it is used via ftrace or perf/bpf since those don't use the post_handler.
Anyway, since the stack switching is a rare case, it is safer just rejecting kprobes on such instructions.
--- arch/x86/include/asm/insn.h | 18 ++++++++++++++++++ arch/x86/kernel/kprobes/core.c | 4 ++++ 2 files changed, 22 insertions(+)
arch/x86/include/asm/insn.h +18 -0
@@ -208,4 +208,22 @@ static inline int insn_offset_immediate( return insn_offset_displacement(insn) + insn->displacement.nbytes; } +#define POP_SS_OPCODE 0x1f +#define MOV_SREG_OPCODE 0x8e + +/* +* Intel SDM Vol.3A 6.8.3 states; +* "Any single-step trap that would be delivered following the MOV to SS +* instruction or POP to SS instruction (because EFLAGS.TF is 1) is +* suppressed." +* This function returns true if @insn is MOV SS or POP SS. On these +* instructions, single stepping is suppressed. +*/ +static inline int insn_masking_exception (struct insn *insn) +{ +return insn->opcode.bytes[0 ] ==POP_SS_OPCODE || + (insn->opcode.bytes[0 ] ==MOV_SREG_OPCODE && +X86_MODRM_REG (insn->modrm.bytes[0 ]) ==2 ); +} +#endif /* _ASM_X86_INSN_H */
arch/x86/kernel/kprobes/core.c +4 -0
@@ -370,6 +370,10 @@ int __copy_instruction(u8 *dest, u8 *srcif (insn->opcode.bytes[0 ] ==BREAKPOINT_INSTRUCTION )return 0 ; +/* We should not singlestep on the exception masking instructions */ +if (insn_masking_exception (insn)) +return 0 ; +#ifdef CONFIG_X86_64 /* Only x86_64 has RIP relative instructions */ if (insn_rip_relative (insn)) {
Greg Kroah-Hartman
maintainerPATCH 232/279 uprobes/x86: Prohibit probing on MOV SS instruction
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit 13ebe18c94f5b0665c01ae7fad2717ae959f4212 ]
Since MOV SS and POP SS instructions will delay the exceptions until the next instruction is executed, single-stepping on it by uprobes must be prohibited.
uprobe already rejects probing on POP SS (0x1f), but allows probing on MOV SS (0x8e and reg == 2). This checks the target instruction and if it is MOV SS or POP SS, returns -ENOTSUPP to reject probing.
--- arch/x86/kernel/uprobes.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/uprobes.c +4 -0
@@ -299,6 +299,10 @@ static int uprobe_init_insn(struct arch_if (is_prefix_bad (insn))return -ENOTSUPP ; +/* We should not singlestep on the exception masking instructions */ +if (insn_masking_exception (insn)) +return -ENOTSUPP ; +if (x86_64) good_insns = good_insns_64;else
Greg Kroah-Hartman
maintainerPATCH 233/279 objtool, kprobes/x86: Sync the latest <asm/insn.h> header with tools/objtool/arch/x86/include/asm/insn.h
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
[ Upstream commit 4fe875e4bd3cae85ae6f6eaf77f63fabe613b66e ]
The following commit:
ee6a7354a362: kprobes/x86: Prohibit probing on exception masking instructions
Modified <asm/insn.h>, adding the insn_masking_exception() function.
Sync the tooling version of the header to it, to fix this warning:
Warning: synced file at 'tools/objtool/arch/x86/include/asm/insn.h' differs from latest kernel version at 'arch/x86/include/asm/insn.h'
--- tools/objtool/arch/x86/include/asm/insn.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
tools/objtool/arch/x86/include/asm/insn.h +18 -0
@@ -208,4 +208,22 @@ static inline int insn_offset_immediate( return insn_offset_displacement(insn) + insn->displacement.nbytes; } +#define POP_SS_OPCODE 0x1f +#define MOV_SREG_OPCODE 0x8e + +/* +* Intel SDM Vol.3A 6.8.3 states; +* "Any single-step trap that would be delivered following the MOV to SS +* instruction or POP to SS instruction (because EFLAGS.TF is 1) is +* suppressed." +* This function returns true if @insn is MOV SS or POP SS. On these +* instructions, single stepping is suppressed. +*/ +static inline int insn_masking_exception (struct insn *insn) +{ +return insn->opcode.bytes[0 ] ==POP_SS_OPCODE || + (insn->opcode.bytes[0 ] ==MOV_SREG_OPCODE && +X86_MODRM_REG (insn->modrm.bytes[0 ]) ==2 ); +} +#endif /* _ASM_X86_INSN_H */
Greg Kroah-Hartman
maintainerPATCH 234/279 x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
[ Upstream commit 0fb96620dce351608aa82eed5942e2f58b07beda ]
Ubuntu 18.04 started exporting pkeys details in header files, resulting in build failures and warnings in the pkeys self-tests:
protection_keys.c:232:0: warning: "SEGV_BNDERR" redefined protection_keys.c:387:5: error: conflicting types for ‘pkey_get’ protection_keys.c:409:5: error: conflicting types for ‘pkey_set’
...
Fix these namespace conflicts and double definitions, plus also clean up the ABI definitions to make it all a bit more readable ...
--- tools/testing/selftests/x86/protection_keys.c | 67 +++++++++++++++----------- 1 file changed, 41 insertions(+), 26 deletions(-)
tools/testing/selftests/x86/protection_keys.c +41 -26
@@ -191,26 +191,30 @@ void lots_o_noops_around_write(int *writ#ifdef __i386__#ifndef SYS_mprotect_key -# define SYS_mprotect_key 380 +# define SYS_mprotect_key 380#endif +#ifndef SYS_pkey_alloc -# define SYS_pkey_alloc 381 -# define SYS_pkey_free 382 +# define SYS_pkey_alloc 381 +# define SYS_pkey_free 382#endif -#define REG_IP_IDX REG_EIP -#define si_pkey_offset 0x14 + +#define REG_IP_IDX REG_EIP +#define si_pkey_offset 0x14#else #ifndef SYS_mprotect_key -# define SYS_mprotect_key 329 +# define SYS_mprotect_key 329#endif +#ifndef SYS_pkey_alloc -# define SYS_pkey_alloc 330 -# define SYS_pkey_free 331 +# define SYS_pkey_alloc 330 +# define SYS_pkey_free 331#endif -#define REG_IP_IDX REG_RIP -#define si_pkey_offset 0x20 + +#define REG_IP_IDX REG_RIP +#define si_pkey_offset 0x20#endif
@@ -225,8 +229,14 @@ void dump_mem(void *dumpme, int len_byte } } -#define SEGV_BNDERR 3/* failed address bound checks */ -#define SEGV_PKUERR 4 +/* Failed address bound checks: */ +#ifndef SEGV_BNDERR +# define SEGV_BNDERR 3 +#endif + +#ifndef SEGV_PKUERR +# define SEGV_PKUERR 4 +#endif static char *si_code_str (int si_code) {
@@ -393,10 +403,15 @@ pid_t fork_lazy_child(void)return forkret; } -#define PKEY_DISABLE_ACCESS 0x1 -#define PKEY_DISABLE_WRITE 0x2 +#ifndef PKEY_DISABLE_ACCESS +# define PKEY_DISABLE_ACCESS 0x1 +#endif + +#ifndef PKEY_DISABLE_WRITE +# define PKEY_DISABLE_WRITE 0x2 +#endif -u32 pkey_get (int pkey,unsigned long flags) +static u32 hw_pkey_get (int pkey,unsigned long flags) {u32 mask = (PKEY_DISABLE_ACCESS |PKEY_DISABLE_WRITE );u32 pkru =__rdpkru ();
@@ -418,7 +433,7 @@ u32 pkey_get(int pkey, unsigned long flareturn masked_pkru; } -int pkey_set (int pkey,unsigned long rights,unsigned long flags) +static int hw_pkey_set (int pkey,unsigned long rights,unsigned long flags) {u32 mask = (PKEY_DISABLE_ACCESS |PKEY_DISABLE_WRITE );u32 old_pkru =__rdpkru ();
@@ -452,15 +467,15 @@ void pkey_disable_set(int pkey, int flag pkey, flags);pkey_assert (flags & (PKEY_DISABLE_ACCESS |PKEY_DISABLE_WRITE )); - pkey_rights =pkey_get (pkey, syscall_flags); + pkey_rights =hw_pkey_get (pkey, syscall_flags); -dprintf1 ("%s(%d) pkey_get(%d): %x\n" , __func__, +dprintf1 ("%s(%d) hw_pkey_get(%d): %x\n" , __func__, pkey, pkey, pkey_rights);pkey_assert (pkey_rights >=0 ); pkey_rights |= flags; - ret =pkey_set (pkey, pkey_rights, syscall_flags); + ret =hw_pkey_set (pkey, pkey_rights, syscall_flags);assert (!ret);/*pkru and flags have the same format */ shadow_pkru |= flags << (pkey *2 );
@@ -468,8 +483,8 @@ void pkey_disable_set(int pkey, int flagpkey_assert (ret >=0 ); - pkey_rights =pkey_get (pkey, syscall_flags); -dprintf1 ("%s(%d) pkey_get(%d): %x\n" , __func__, + pkey_rights =hw_pkey_get (pkey, syscall_flags); +dprintf1 ("%s(%d) hw_pkey_get(%d): %x\n" , __func__, pkey, pkey, pkey_rights);dprintf1 ("%s(%d) pkru: 0x%x\n" , __func__, pkey,rdpkru ());
@@ -483,24 +498,24 @@ void pkey_disable_clear(int pkey, int fl {unsigned long syscall_flags =0 ;int ret; -int pkey_rights =pkey_get (pkey, syscall_flags); +int pkey_rights =hw_pkey_get (pkey, syscall_flags);u32 orig_pkru =rdpkru ();pkey_assert (flags & (PKEY_DISABLE_ACCESS |PKEY_DISABLE_WRITE )); -dprintf1 ("%s(%d) pkey_get(%d): %x\n" , __func__, +dprintf1 ("%s(%d) hw_pkey_get(%d): %x\n" , __func__, pkey, pkey, pkey_rights);pkey_assert (pkey_rights >=0 ); pkey_rights |= flags; - ret =pkey_set (pkey, pkey_rights,0 ); + ret =hw_pkey_set (pkey, pkey_rights,0 );/* pkru and flags have the same format */ shadow_pkru &= ~(flags << (pkey *2 ));pkey_assert (ret >=0 ); - pkey_rights =pkey_get (pkey, syscall_flags); -dprintf1 ("%s(%d) pkey_get(%d): %x\n" , __func__, + pkey_rights =hw_pkey_get (pkey, syscall_flags); +dprintf1 ("%s(%d) hw_pkey_get(%d): %x\n" , __func__, pkey, pkey, pkey_rights);dprintf1 ("%s(%d) pkru: 0x%x\n" , __func__, pkey,rdpkru ());
Re: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
Thanks, Vlastimil
Greg Kroah-Hartman
maintainerRe: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 6 lines · Vlastimil Babka
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
These came in as part of Sasha's "backport fixes" tool. It can't hurt to add selftest fixes/updates to stable kernels, as for some people, they only run the selftests for the specific kernel they are building. While others run selftests for the latest kernel on older kernels, both of which are valid ways of testing.
thanks,
greg k-h
Re: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Vlastimil Babka
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
Quoted 5 lines
These came in as part of Sasha's "backport fixes" tool. It can't hurt to add selftest fixes/updates to stable kernels, as for some people, they only run the selftests for the specific kernel they are building. While others run selftests for the latest kernel on older kernels, both of which are valid ways of testing.
I don't have a problem with these sort of patches being backported, but it seems like Documentation/process/stable-kernel-rules.txt could use an update?
I honestly don't know what the rules are anymore.
cheers
Re: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 16 lines · Michael Ellerman
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Vlastimil Babka
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
Quoted 5 lines
These came in as part of Sasha's "backport fixes" tool. It can't hurt to add selftest fixes/updates to stable kernels, as for some people, they only run the selftests for the specific kernel they are building. While others run selftests for the latest kernel on older kernels, both of which are valid ways of testing.
Quoted 5 lines
I don't have a problem with these sort of patches being backported, but it seems like
Documentation/process/stable-kernel-rules.txtcould use an update?I honestly don't know what the rules are anymore.
Self-tests are standalone tooling which help the testing of the kernel, and it makes sense to either update all of them, or none of them.
Here it makes sense to update all of them, because if a self-test on a stable kernel shows a failure then a fix is probably missing from -stable, right?
Also note that self-test tooling *cannot possibly break the kernel*, because they are not used in the kernel build process, so the normally conservative backporting rules do not apply.
Thanks,
Ingo
Re: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 16 lines · Ingo Molnar
Quoted 15 lines · Michael Ellerman
Quoted 13 lines · Greg Kroah-Hartman
Quoted 6 lines · Vlastimil Babka
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
These came in as part of Sasha's "backport fixes" tool. It can't hurt to add selftest fixes/updates to stable kernels, as for some people, they only run the selftests for the specific kernel they are building. While others run selftests for the latest kernel on older kernels, both of which are valid ways of testing.
Quoted 8 lines
Quoted 5 lines
I don't have a problem with these sort of patches being backported, but it seems like
Documentation/process/stable-kernel-rules.txtcould use an update?I honestly don't know what the rules are anymore.
Self-tests are standalone tooling which help the testing of the kernel, and it makes sense to either update all of them, or none of them.
Yes I know what selftests are.
Quoted 2 lines
Here it makes sense to update all of them, because if a self-test on a stable kernel shows a failure then a fix is probably missing from -stable, right?
Usually, though it's not always that simple IME.
But sure, I don't have a problem with updating selftests, I said that before.
Quoted 3 lines
Also note that self-test tooling *cannot possibly break the kernel*, because they are not used in the kernel build process, so the normally conservative backporting rules do not apply.
Right. So stable-kernel-rules.txt could use an update to mention that.
My comment was less about this actual patch and more about the new reality of patches being backported to stable based on Sasha's tooling, which seems to be much more liberal than anything we've done previously.
I don't generally have any objection to that process, though it possibly could have been more widely announced. But, it would be good if stable-kernel-rules.txt was updated to mention it.
I've had several people ask me "hey my patch got backported to stable but I didn't ask for it - is that OK, what's going on?" etc.
I guess I should just send a patch to update it, but I don't really know what it should say.
cheers
Greg Kroah-Hartman
maintainerRe: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 46 lines · Michael Ellerman
Quoted 16 lines · Ingo Molnar
Quoted 15 lines · Michael Ellerman
Quoted 13 lines · Greg Kroah-Hartman
Quoted 6 lines · Vlastimil Babka
Quoted 1 line · Greg Kroah-Hartman
4.16-stable review patch. If anyone has any objections, please let me know.
So I was wondering, why backport such a considerable number of *selftests* to stable, given the stable policy? Surely selftests don't affect the kernel itself breaking for users?
These came in as part of Sasha's "backport fixes" tool. It can't hurt to add selftest fixes/updates to stable kernels, as for some people, they only run the selftests for the specific kernel they are building. While others run selftests for the latest kernel on older kernels, both of which are valid ways of testing.
Quoted 8 lines
Quoted 5 lines
I don't have a problem with these sort of patches being backported, but it seems like
Documentation/process/stable-kernel-rules.txtcould use an update?I honestly don't know what the rules are anymore.
Self-tests are standalone tooling which help the testing of the kernel, and it makes sense to either update all of them, or none of them.
Yes I know what selftests are.
Quoted 2 lines
Here it makes sense to update all of them, because if a self-test on a stable kernel shows a failure then a fix is probably missing from -stable, right?
Usually, though it's not always that simple IME.
But sure, I don't have a problem with updating selftests, I said that before.
Quoted 3 lines
Also note that self-test tooling *cannot possibly break the kernel*, because they are not used in the kernel build process, so the normally conservative backporting rules do not apply.
Right. So stable-kernel-rules.txt could use an update to mention that.
My comment was less about this actual patch and more about the new reality of patches being backported to stable based on Sasha's tooling, which seems to be much more liberal than anything we've done previously.
Quoted 6 lines
I don't generally have any objection to that process, though it possibly could have been more widely announced. But, it would be good if stable-kernel-rules.txt was updated to mention it.
I've had several people ask me "hey my patch got backported to stable but I didn't ask for it - is that OK, what's going on?" etc.
Why didn't those people just ask us? To not do so is very strange, it's not like we are hard to find :)
Quoted 2 lines
I guess I should just send a patch to update it, but I don't really know what it should say.
I don't think it really needs any changes, as the selftests is just a corner case that is easily explained if anyone cares enough to actually ask :)
thanks,
greg k-h
Re: [PATCH 4.16 234/279] x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
Quoted 1 line · Greg Kroah-Hartman
On Sun, Jul 08, 2018 at 08:33:37PM +1000, Michael Ellerman wrote:
...
Quoted 9 lines
Quoted 9 lines
My comment was less about this actual patch and more about the new reality of patches being backported to stable based on Sasha's tooling, which seems to be much more liberal than anything we've done previously.
I don't generally have any objection to that process, though it possibly could have been more widely announced. But, it would be good if stable-kernel-rules.txt was updated to mention it.
Quoted 5 lines
Quoted 2 lines
I've had several people ask me "hey my patch got backported to stable but I didn't ask for it - is that OK, what's going on?" etc.
Why didn't those people just ask us? To not do so is very strange, it's not like we are hard to find :)
It's not very strange, it's completely normal behaviour. People are afraid of asking dumb questions in public, so they ask someone privately.
And the general sentiment has been "I didn't think that patch met the stable rules, but I'm happy for it to be backported".
Quoted 6 lines
Quoted 2 lines
I guess I should just send a patch to update it, but I don't really know what it should say.
I don't think it really needs any changes, as the selftests is just a corner case that is easily explained if anyone cares enough to actually ask :)
Yeah again I'm not really concerned about selftests, I should have replied to a different patch to start this discussion. My bad.
cheers
Greg Kroah-Hartman
maintainerPATCH 235/279 x86/mpx/selftests: Adjust the self-test to fresh distros that export the MPX ABI
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
[ Upstream commit 73bb4d6cd192b8629c5125aaada9892d9fc986b6 ]
Fix this warning:
mpx-mini-test.c:422:0: warning: "SEGV_BNDERR" redefined
--- tools/testing/selftests/x86/mpx-mini-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/mpx-mini-test.c +5 -2
@@ -368,6 +368,11 @@ static int expected_bnd_index = -1;uint64_t shadow_plb[NR_MPX_BOUNDS_REGISTERS ][2 ];/* shadow MPX bound registers */ unsigned long shadow_map[NR_MPX_BOUNDS_REGISTERS ]; +/* Failed address bound checks: */ +#ifndef SEGV_BNDERR +# define SEGV_BNDERR 3 +#endif +/* * The kernel is supposed to provide some information about the bounds * exception in the siginfo. It should match what we have in the bounds
@@ -419,8 +424,6 @@ void handler(int signum, siginfo_t *si, br_count++;dprintf1 ("#BR 0x%jx (total seen: %d)\n" , status, br_count); -#define SEGV_BNDERR 3/* failed address bound checks */ -dprintf2 ("Saw a #BR! status 0x%jx at %016lx br_reason: %jx\n" , status, ip, br_reason);dprintf2 ("si_signo: %d\n" , si->si_signo);
Greg Kroah-Hartman
maintainerPATCH 236/279 x86/selftests: Add mov_to_ss test
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
[ Upstream commit 59c2a7226fc5130032021c99f05ad5c0a56551cd ]
This exercises a nasty corner case of the x86 ISA.
--- tools/testing/selftests/x86/Makefile | 2 tools/testing/selftests/x86/mov_ss_trap.c | 285 ++++++++++++++++++++++++++++++ 2 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/x86/mov_ss_trap.c
tools/testing/selftests/x86/Makefile +1 -1
@@ -11,7 +11,7 @@ CAN_BUILD_X86_64 := $(shell ./check_cc.s TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ check_initial_reg_state sigreturn iopl mpx-mini-test ioperm \ - protection_keys test_vdso test_vsyscall + protection_keys test_vdso test_vsyscall mov_ss_trap TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \ test_FCMOV test_FCOMI test_FISTTP \ vdso_restorer
tools/testing/selftests/x86/mov_ss_trap.c new file +285 -0
285 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 237/279 x86/pkeys/selftests: Give better unexpected fault error messages
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 55556b0b2016806b2e16a20b62d143383983a34a ]
do_not_expect_pk_fault() is a helper that we call when we do not expect a PK fault to have occurred. But, it is a function, which means that it obscures the line numbers from pkey_assert(). It also gives no details.
Replace it with an implementation that gives nice line numbers and also lets callers pass in a more descriptive message about what happened that caused the unexpected fault.
--- tools/testing/selftests/x86/protection_keys.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
tools/testing/selftests/x86/protection_keys.c +7 -6
@@ -954,10 +954,11 @@ void expected_pk_fault(int pkey) last_si_pkey =-1 ; } -void do_not_expect_pk_fault (void ) -{ -pkey_assert (last_pkru_faults == pkru_faults); -} +#define do_not_expect_pk_fault (msg) do { \ + if (last_pkru_faults != pkru_faults) \ + dprintf0("unexpected PK fault: %s\n", msg); \ + pkey_assert(last_pkru_faults == pkru_faults); \ +} while (0)int test_fds[10 ] = {-1 };int nr_test_fds;
@@ -1243,7 +1244,7 @@ void test_ptrace_of_child(int *ptr, u16pkey_assert (ret !=-1 );/* Now access from the current task, and expect NO exception: */ peek_result =read_ptr (plain_ptr); -do_not_expect_pk_fault (); +do_not_expect_pk_fault ("read plain pointer after ptrace" ); ret =ptrace (PTRACE_DETACH , child_pid, ignored,0 );pkey_assert (ret !=-1 );
@@ -1287,7 +1288,7 @@ void test_executing_on_unreadable_memory*/ madvise (p1,PAGE_SIZE ,MADV_DONTNEED );lots_o_noops_around_write (&scratch); -do_not_expect_pk_fault (); +do_not_expect_pk_fault ("executing on PROT_EXEC memory" ); ptr_contents =read_ptr (p1);dprintf2 ("ptr (%p) contents@%d: %x\n" , p1, __LINE__, ptr_contents);expected_pk_fault (pkey);
Greg Kroah-Hartman
maintainerPATCH 238/279 x86/pkeys/selftests: Stop using assert()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 86b9eea230edf4c67d4d4a70fba9b74505867a25 ]
If we use assert(), the program "crashes". That can be scary to users, so stop doing it. Just exit with a >0 exit code instead.
--- tools/testing/selftests/x86/protection_keys.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
tools/testing/selftests/x86/protection_keys.c +8 -4
@@ -72,10 +72,9 @@ extern void abort_hooks(void); test_nr, iteration_nr); \dprintf0 ("errno at assert: %d" , errno); \abort_hooks (); \ -assert (condition); \ +exit (__LINE__); \ } \ }while (0 ) -#define raw_assert (cond) assert(cond) void cat_into_file(char *str, char *file) {
@@ -87,12 +86,17 @@ void cat_into_file(char *str, char *file* these need to be raw because they are called under * pkey_assert() */ -raw_assert (fd >=0 ); +if (fd <0 ) { +fprintf (stderr,"error opening '%s'\n" , str); +perror ("error: " ); +exit (__LINE__); + } + ret =write (fd, str,strlen (str));if (ret !=strlen (str)) {perror ("write to file failed" );fprintf (stderr,"filename: '%s' str: '%s'\n" , file, str); -raw_assert (0 ); +exit (__LINE__); }close (fd); }
Greg Kroah-Hartman
maintainerPATCH 239/279 x86/pkeys/selftests: Remove dead debugging code, fix dprint_in_signal
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit a50093d60464dd51d1ae0c2267b0abe9e1de77f3 ]
There is some noisy debug code at the end of the signal handler. It was disabled by an early, unconditional "return". However, that return also hid a dprint_in_signal=0, which kept dprint_in_signal=1 and effectively locked us into permanent dprint_in_signal=1 behavior.
Remove the return and the dead code, fixing dprint_in_signal.
--- tools/testing/selftests/x86/protection_keys.c | 16 ---------------- 1 file changed, 16 deletions(-)
tools/testing/selftests/x86/protection_keys.c +0 -16
@@ -325,22 +325,6 @@ void signal_handler(int signum, siginfo_dprintf1 ("WARNING: set PRKU=0 to allow faulting instruction to continue\n" ); pkru_faults++;dprintf1 ("<<<<==================================================\n" ); -return ; -if (trapno ==14 ) { -fprintf (stderr, -"ERROR: In signal handler, page fault, trapno = %d, ip = %016lx\n" , - trapno, ip); -fprintf (stderr,"si_addr %p\n" , si->si_addr); -fprintf (stderr,"REG_ERR: %lx\n" , - (unsigned long )uctxt->uc_mcontext.gregs[REG_ERR ]); -exit (1 ); - }else { -fprintf (stderr,"unexpected trap %d! at 0x%lx\n" , trapno, ip); -fprintf (stderr,"si_addr %p\n" , si->si_addr); -fprintf (stderr,"REG_ERR: %lx\n" , - (unsigned long )uctxt->uc_mcontext.gregs[REG_ERR ]); -exit (2 ); - } dprint_in_signal =0 ; }
Greg Kroah-Hartman
maintainerPATCH 240/279 x86/pkeys/selftests: Avoid printf-in-signal deadlocks
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit caf9eb6b4c82fc6cbd03697052ff22d97b0c377b ]
printf() and friends are unusable in signal handlers. They deadlock. The pkey selftest does not do any normal printing in signal handlers, only extra debugging. So, just print the format string so we get *some* output when debugging.
--- tools/testing/selftests/x86/pkey-helpers.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
tools/testing/selftests/x86/pkey-helpers.h +8 -12
@@ -26,30 +26,26 @@ static inline void sigsafe_printf(const {va_list ap; -va_start (ap, format);if (!dprint_in_signal) { +va_start (ap, format);vprintf (format, ap); +va_end (ap); }else {int ret; -int len =vsnprintf (dprint_in_signal_buffer, -DPRINT_IN_SIGNAL_BUF_SIZE , - format, ap);/* -* len is amount that would have been printed, -* but actual write is truncated at BUF_SIZE. +* No printf() functions are signal-safe. +* They deadlock easily. Write the format +* string to get some output, even if +* incomplete. */ -if (len >DPRINT_IN_SIGNAL_BUF_SIZE ) - len =DPRINT_IN_SIGNAL_BUF_SIZE ; - ret =write (1 , dprint_in_signal_buffer, len); + ret =write (1 , format,strlen (format));if (ret <0 ) -abort (); +exit (1 ); } -va_end (ap); } #define dprintf_level(level, args...) do { \ if (level <= DEBUG_LEVEL) \ sigsafe_printf(args); \ - fflush(NULL); \ } while (0) #define dprintf0(args...) dprintf_level(0, args) #define dprintf1(args...) dprintf_level(1, args)
Greg Kroah-Hartman
maintainerPATCH 241/279 x86/pkeys/selftests: Allow faults on unknown keys
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 7e7fd67ca39335a49619729821efb7cbdd674eb0 ]
The exec-only pkey is allocated inside the kernel and userspace is not told what it is. So, allow PK faults to occur that have an unknown key.
--- tools/testing/selftests/x86/protection_keys.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/protection_keys.c +9 -1
@@ -921,13 +921,21 @@ void *malloc_pkey(long size, int prot, u }int last_pkru_faults; +#define UNKNOWN_PKEY -2void expected_pk_fault (int pkey) {dprintf2 ("%s(): last_pkru_faults: %d pkru_faults: %d\n" , __func__, last_pkru_faults, pkru_faults);dprintf2 ("%s(%d): last_si_pkey: %d\n" , __func__, pkey, last_si_pkey);pkey_assert (last_pkru_faults +1 == pkru_faults); -pkey_assert (last_si_pkey == pkey); + +/* +* For exec-only memory, we do not know the pkey in +* advance, so skip this check. +*/ +if (pkey !=UNKNOWN_PKEY ) +pkey_assert (last_si_pkey == pkey); +/* * The signal handler shold have cleared out PKRU to let the * test program continue. We now have to restore it.
Greg Kroah-Hartman
maintainerPATCH 242/279 x86/pkeys/selftests: Factor out "instruction page"
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 3fcd2b2d928904cbf30b01e2c5e4f1dd2f9ab262 ]
We currently have an execute-only test, but it is for the explicit mprotect_pkey() interface. We will soon add a test for the implicit mprotect(PROT_EXEC) enterface. We need this code in both tests.
--- tools/testing/selftests/x86/protection_keys.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
tools/testing/selftests/x86/protection_keys.c +17 -4
@@ -1253,12 +1253,9 @@ void test_ptrace_of_child(int *ptr, u16free (plain_ptr_unaligned); } -void test_executing_on_unreadable_memory (int *ptr,u16 pkey) +void *get_pointer_to_instructions (void ) {void *p1; -int scratch; -int ptr_contents; -int ret; p1 =ALIGN_PTR_UP (&lots_o_noops_around_write,PAGE_SIZE );dprintf3 ("&lots_o_noops: %p\n" , &lots_o_noops_around_write);
@@ -1268,7 +1265,23 @@ void test_executing_on_unreadable_memory/* Point 'p1' at the *second* page of the function: */ p1 +=PAGE_SIZE ; +/* +* Try to ensure we fault this in on next touch to ensure +* we get an instruction fault as opposed to a data one +*/ madvise (p1,PAGE_SIZE ,MADV_DONTNEED ); + +return p1; +} + +void test_executing_on_unreadable_memory (int *ptr,u16 pkey) +{ +void *p1; +int scratch; +int ptr_contents; +int ret; + + p1 =get_pointer_to_instructions ();lots_o_noops_around_write (&scratch); ptr_contents =read_ptr (p1);dprintf2 ("ptr (%p) contents@%d: %x\n" , p1, __LINE__, ptr_contents);
Greg Kroah-Hartman
maintainerPATCH 243/279 x86/pkeys/selftests: Add PROT_EXEC test
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 6af17cf89e99b64cf1f660bf848755442ab2f047 ]
Under the covers, implement executable-only memory with protection keys when userspace calls mprotect(PROT_EXEC).
But, we did not have a selftest for that. Now we do.
--- tools/testing/selftests/x86/protection_keys.c | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
tools/testing/selftests/x86/protection_keys.c +44 -0
@@ -1303,6 +1303,49 @@ void test_executing_on_unreadable_memoryexpected_pk_fault (pkey); } +void test_implicit_mprotect_exec_only_memory (int *ptr,u16 pkey) +{ +void *p1; +int scratch; +int ptr_contents; +int ret; + +dprintf1 ("%s() start\n" , __func__); + + p1 =get_pointer_to_instructions (); +lots_o_noops_around_write (&scratch); + ptr_contents =read_ptr (p1); +dprintf2 ("ptr (%p) contents@%d: %x\n" , p1, __LINE__, ptr_contents); + +/* Use a *normal* mprotect(), not mprotect_pkey(): */ + ret =mprotect (p1,PAGE_SIZE ,PROT_EXEC ); +pkey_assert (!ret); + +dprintf2 ("pkru: %x\n" ,rdpkru ()); + +/* Make sure this is an *instruction* fault */ +madvise (p1,PAGE_SIZE ,MADV_DONTNEED ); +lots_o_noops_around_write (&scratch); +do_not_expect_pk_fault ("executing on PROT_EXEC memory" ); + ptr_contents =read_ptr (p1); +dprintf2 ("ptr (%p) contents@%d: %x\n" , p1, __LINE__, ptr_contents); +expected_pk_fault (UNKNOWN_PKEY ); + +/* +* Put the memory back to non-PROT_EXEC. Should clear the +* exec-only pkey off the VMA and allow it to be readable +* again. Go to PROT_NONE first to check for a kernel bug +* that did not clear the pkey when doing PROT_NONE. +*/ + ret =mprotect (p1,PAGE_SIZE ,PROT_NONE ); +pkey_assert (!ret); + + ret =mprotect (p1,PAGE_SIZE ,PROT_READ |PROT_EXEC ); +pkey_assert (!ret); + ptr_contents =read_ptr (p1); +do_not_expect_pk_fault ("plain read on recently PROT_EXEC area" ); +} +void test_mprotect_pkey_on_unsupported_cpu (int *ptr,u16 pkey) {int size =PAGE_SIZE ;
@@ -1327,6 +1370,7 @@ void (*pkey_tests[])(int *ptr, u16 pkey) test_kernel_gup_of_access_disabled_region, test_kernel_gup_write_to_write_disabled_region, test_executing_on_unreadable_memory, + test_implicit_mprotect_exec_only_memory, test_ptrace_of_child, test_pkey_syscalls_on_non_allocated_pkey, test_pkey_syscalls_bad_args,
Greg Kroah-Hartman
maintainerPATCH 244/279 x86/pkeys/selftests: Fix pkey exhaustion test off-by-one
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit f50b4878329ab61d8e05796f655adeb6f5fb57c6 ]
In our "exhaust all pkeys" test, we make sure that there is the expected number available. Turns out that the test did not cover the execute-only key, but discussed it anyway. It did *not* discuss the test-allocated key.
Now that we have a test for the mprotect(PROT_EXEC) case, this off-by-one issue showed itself. Correct the off-by- one and add the explanation for the case we missed.
--- tools/testing/selftests/x86/protection_keys.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
tools/testing/selftests/x86/protection_keys.c +8 -5
@@ -1163,12 +1163,15 @@ void test_pkey_alloc_exhaust(int *ptr, upkey_assert (i <NR_PKEYS *2 );/* -* There are 16 pkeys supported in hardware. One is taken -* up for the default (0) and another can be taken up by -* an execute-only mapping. Ensure that we can allocate -* at least 14 (16-2). +* There are 16 pkeys supported in hardware. Three are +* allocated by the time we get here: +* 1. The default key (0) +* 2. One possibly consumed by an execute-only mapping. +* 3. One allocated by the test code and passed in via +* 'pkey' to this function. +* Ensure that we can allocate at least another 13 (16-3). */ -pkey_assert (i >=NR_PKEYS -2 ); +pkey_assert (i >=NR_PKEYS -3 );for (i =0 ; i < nr_allocated_pkeys; i++) { err =sys_pkey_free (allocated_pkeys[i]);
Greg Kroah-Hartman
maintainerPATCH 245/279 x86/pkeys/selftests: Fix pointer math
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 3d64f4ed15c3c53dba4c514bf59c334464dee373 ]
We dump out the entire area of the siginfo where the si_pkey_ptr is supposed to be. But, we do some math on the poitner, which is a u32. We intended to do byte math, not u32 math on the pointer.
Cast it over to a u8* so it works.
Also, move this block of code to below th si_code check. It doesn't hurt anything, but the si_pkey field is gibberish for other signal types.
--- tools/testing/selftests/x86/protection_keys.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/x86/protection_keys.c +7 -7
@@ -303,13 +303,6 @@ void signal_handler(int signum, siginfo_dump_mem (pkru_ptr -128 ,256 );pkey_assert (*pkru_ptr); - si_pkey_ptr = (u32 *)(((u8 *)si) + si_pkey_offset); -dprintf1 ("si_pkey_ptr: %p\n" , si_pkey_ptr); -dump_mem (si_pkey_ptr -8 ,24 ); - siginfo_pkey = *si_pkey_ptr; -pkey_assert (siginfo_pkey <NR_PKEYS ); - last_si_pkey = siginfo_pkey; -if ((si->si_code ==SEGV_MAPERR ) || (si->si_code ==SEGV_ACCERR ) || (si->si_code ==SEGV_BNDERR )) {
@@ -317,6 +310,13 @@ void signal_handler(int signum, siginfo_exit (4 ); } + si_pkey_ptr = (u32 *)(((u8 *)si) + si_pkey_offset); +dprintf1 ("si_pkey_ptr: %p\n" , si_pkey_ptr); +dump_mem ((u8 *)si_pkey_ptr -8 ,24 ); + siginfo_pkey = *si_pkey_ptr; +pkey_assert (siginfo_pkey <NR_PKEYS ); + last_si_pkey = siginfo_pkey; +dprintf1 ("signal pkru from xsave: %08x\n" , *pkru_ptr);/* need __rdpkru() version so we do not do shadow_pkru checking */ dprintf1 ("signal pkru from pkru: %08x\n" ,__rdpkru ());
Greg Kroah-Hartman
maintainerPATCH 246/279 x86/pkeys/selftests: Save off prot for allocations
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit acb25d761d6f2f64e785ccefc71e54f244f1eda4 ]
This makes it possible to to tell what 'prot' a given allocation is supposed to have. That way, if we want to change just the pkey, we know what 'prot' to pass to mprotect_pkey().
Also, keep a record of the most recent allocation so the tests can easily find it.
--- tools/testing/selftests/x86/protection_keys.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tools/testing/selftests/x86/protection_keys.c +9 -5
@@ -677,10 +677,12 @@ int mprotect_pkey(void *ptr, size_t sizestruct pkey_malloc_record {void *ptr;long size; +int prot; };struct pkey_malloc_record *pkey_malloc_records; +struct pkey_malloc_record *pkey_last_malloc_record;long nr_pkey_malloc_records; -void record_pkey_malloc (void *ptr,long size) +void record_pkey_malloc (void *ptr,long size,int prot) {long i;struct pkey_malloc_record *rec =NULL ;
@@ -712,6 +714,8 @@ void record_pkey_malloc(void *ptr, long (int)(rec - pkey_malloc_records), rec, ptr, size); rec->ptr = ptr; rec->size = size; + rec->prot = prot; + pkey_last_malloc_record = rec; nr_pkey_malloc_records++; }
@@ -756,7 +760,7 @@ void *malloc_pkey_with_mprotect(long sizpkey_assert (ptr != (void *)-1 ); ret =mprotect_pkey ((void *)ptr,PAGE_SIZE , prot, pkey);pkey_assert (!ret); -record_pkey_malloc (ptr, size); +record_pkey_malloc (ptr, size, prot);rdpkru ();dprintf1 ("%s() for pkey %d @ %p\n" , __func__, pkey, ptr);
@@ -777,7 +781,7 @@ void *malloc_pkey_anon_huge(long size, i size =ALIGN_UP (size,HPAGE_SIZE *2 ); ptr =mmap (NULL , size,PROT_NONE ,MAP_ANONYMOUS |MAP_PRIVATE ,-1 ,0 );pkey_assert (ptr != (void *)-1 ); -record_pkey_malloc (ptr, size); +record_pkey_malloc (ptr, size, prot);mprotect_pkey (ptr, size, prot, pkey);dprintf1 ("unaligned ptr: %p\n" , ptr);
@@ -850,7 +854,7 @@ void *malloc_pkey_hugetlb(long size, intpkey_assert (ptr != (void *)-1 );mprotect_pkey (ptr, size, prot, pkey); -record_pkey_malloc (ptr, size); +record_pkey_malloc (ptr, size, prot);dprintf1 ("mmap()'d hugetlbfs for pkey %d @ %p\n" , pkey, ptr);return ptr;
@@ -872,7 +876,7 @@ void *malloc_pkey_mmap_dax(long size, inmprotect_pkey (ptr, size, prot, pkey); -record_pkey_malloc (ptr, size); +record_pkey_malloc (ptr, size, prot);dprintf1 ("mmap()'d for pkey %d @ %p\n" , pkey, ptr);close (fd);
Greg Kroah-Hartman
maintainerPATCH 247/279 x86/pkeys/selftests: Add a test for pkey 0
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 3488a600d90bcaf061b104dbcfbdc8d99b398312 ]
Protection key 0 is the default key for all memory and will not normally come back from pkey_alloc(). But, you might still want pass it to mprotect_pkey().
This check ensures that you can use pkey 0.
--- tools/testing/selftests/x86/protection_keys.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
tools/testing/selftests/x86/protection_keys.c +30 -0
@@ -1184,6 +1184,35 @@ void test_pkey_alloc_exhaust(int *ptr, u } } +/* +* pkey 0 is special. It is allocated by default, so you do not +* have to call pkey_alloc() to use it first. Make sure that it +* is usable. +*/ +void test_mprotect_with_pkey_0 (int *ptr,u16 pkey) +{ +long size; +int prot; + +assert (pkey_last_malloc_record); + size = pkey_last_malloc_record->size; +/* +* This is a bit of a hack. But mprotect() requires +* huge-page-aligned sizes when operating on hugetlbfs. +* So, make sure that we use something that's a multiple +* of a huge page when we can. +*/ +if (size >=HPAGE_SIZE ) + size =HPAGE_SIZE ; + prot = pkey_last_malloc_record->prot; + +/* Use pkey 0 */ +mprotect_pkey (ptr, size, prot,0 ); + +/* Make sure that we can set it back to the original pkey. */ +mprotect_pkey (ptr, size, prot, pkey); +} +void test_ptrace_of_child (int *ptr,u16 pkey) { __attribute__((__unused__))int peek_result;
@@ -1378,6 +1407,7 @@ void (*pkey_tests[])(int *ptr, u16 pkey) test_kernel_gup_write_to_write_disabled_region, test_executing_on_unreadable_memory, test_implicit_mprotect_exec_only_memory, + test_mprotect_with_pkey_0, test_ptrace_of_child, test_pkey_syscalls_on_non_allocated_pkey, test_pkey_syscalls_bad_args,
Greg Kroah-Hartman
maintainerPATCH 248/279 afs: Fix address list parsing
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 01fd79e6de74a447c5657913a335d9ce6508cdb1 ]
The parsing of port specifiers in the address list obtained from the DNS resolution upcall doesn't work as in4_pton() and in6_pton() will fail on encountering an unexpected delimiter (in this case, the '+' marking the port number). However, in*_pton() can't be given multiple specifiers.
Fix this by finding the delimiter in advance and not relying on in*_pton() to find the end of the address for us.
--- fs/afs/addr_list.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
fs/afs/addr_list.c +15 -10
@@ -121,7 +121,7 @@ struct afs_addr_list *afs_parse_text_add p = text; do { struct sockaddr_rxrpc *srx = &alist->addrs[alist->nr_addrs]; - char tdelim = delim; + const char *q, *stop; if (*p == delim) { p++;
@@ -130,28 +130,33 @@ struct afs_addr_list *afs_parse_text_addif (*p =='[' ) { p++; - tdelim =']' ; + q =memchr (p,']' , end - p); + }else { +for (q = p; q < end; q++) +if (*q =='+' || *q == delim) +break ; } -if (in4_pton (p, end - p, +if (in4_pton (p, q - p, (u8 *)&srx->transport.sin6.sin6_addr.s6_addr32[3 ], - tdelim, &p)) { +-1 , &stop)) { srx->transport.sin6.sin6_addr.s6_addr32[0 ] =0 ; srx->transport.sin6.sin6_addr.s6_addr32[1 ] =0 ; srx->transport.sin6.sin6_addr.s6_addr32[2 ] =htonl (0xffff ); - }else if (in6_pton (p, end - p, + }else if (in6_pton (p, q - p, srx->transport.sin6.sin6_addr.s6_addr, - tdelim, &p)) { +-1 , &stop)) {/* Nothing to do */ }else { goto bad_address; } -if (tdelim ==']' ) { -if (p == end || *p !=']' ) - goto bad_address; +if (stop != q) + goto bad_address; + + p = q; +if (q < end && *q ==']' ) p++; - }if (p < end) {if (*p =='+' ) {
Greg Kroah-Hartman
maintainerPATCH 249/279 afs: Fix refcounting in callback registration
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit d4a96bec7a7362834ef5c31d7b2cc9bf36eb0570 ]
The refcounting on afs_cb_interest struct objects in afs_register_server_cb_interest() is wrong as it uses the server list entry's call back interest pointer without regard for the fact that it might be replaced at any time and the object thrown away.
Fix this by:
(1) Put a lock on the afs_server_list struct that can be used to mediate access to the callback interest pointers in the servers array.
(2) Keep a ref on the callback interest that we get from the entry.
(3) Dropping the old reference held by vnode->cb_interest if we replace the pointer.
--- fs/afs/callback.c | 56 ++++++++++++++++++++++++++++++++++++--------------- fs/afs/internal.h | 7 ++++-- fs/afs/rotate.c | 4 +-- fs/afs/server_list.c | 7 ++++-- 4 files changed, 52 insertions(+), 22 deletions(-)
fs/afs/callback.c +40 -16
@@ -23,36 +23,55 @@/* * Set up an interest-in-callbacks record for a volume on a server and * register it with the server. -* - Called with volume->server_sem held. +* - Called with vnode->io_lock held. */ int afs_register_server_cb_interest (struct afs_vnode *vnode, -struct afs_server_entry *entry) +struct afs_server_list *slist, +unsigned int index) { -struct afs_cb_interest *cbi = entry->cb_interest, *vcbi, *new, *x; +struct afs_server_entry *entry = &slist->servers[index]; +struct afs_cb_interest *cbi, *vcbi, *new, *old;struct afs_server *server = entry->server; again: +if (vnode->cb_interest && +likely (vnode->cb_interest == entry->cb_interest)) +return 0 ; + +read_lock (&slist->lock); + cbi =afs_get_cb_interest (entry->cb_interest); +read_unlock (&slist->lock); + vcbi = vnode->cb_interest;if (vcbi) { -if (vcbi == cbi) +if (vcbi == cbi) { +afs_put_cb_interest (afs_v2net (vnode), cbi);return 0 ; + } +/* Use a new interest in the server list for the same server +* rather than an old one that's still attached to a vnode. +*/ if (cbi && vcbi->server == cbi->server) {write_seqlock (&vnode->cb_lock); - vnode->cb_interest =afs_get_cb_interest (cbi); + old = vnode->cb_interest; + vnode->cb_interest = cbi;write_sequnlock (&vnode->cb_lock); -afs_put_cb_interest (afs_v2net (vnode), cbi); +afs_put_cb_interest (afs_v2net (vnode), old);return 0 ; } +/* Re-use the one attached to the vnode. */ if (!cbi && vcbi->server == server) { -afs_get_cb_interest (vcbi); - x =cmpxchg (&entry->cb_interest, cbi, vcbi); -if (x != cbi) { - cbi = x; -afs_put_cb_interest (afs_v2net (vnode), vcbi); +write_lock (&slist->lock); +if (entry->cb_interest) { +write_unlock (&slist->lock); +afs_put_cb_interest (afs_v2net (vnode), cbi); goto again; } + + entry->cb_interest = cbi; +write_unlock (&slist->lock);return 0 ; } }
@@ -72,13 +91,16 @@ again:list_add_tail (&new->cb_link, &server->cb_interests);write_unlock (&server->cb_break_lock); - x =cmpxchg (&entry->cb_interest, cbi, new); -if (x == cbi) { +write_lock (&slist->lock); +if (!entry->cb_interest) { + entry->cb_interest =afs_get_cb_interest (new); cbi = new; + new =NULL ; }else { - cbi = x; -afs_put_cb_interest (afs_v2net (vnode), new); + cbi =afs_get_cb_interest (entry->cb_interest); } +write_unlock (&slist->lock); +afs_put_cb_interest (afs_v2net (vnode), new); }ASSERT (cbi);
@@ -88,11 +110,13 @@ again:*/ write_seqlock (&vnode->cb_lock); - vnode->cb_interest =afs_get_cb_interest (cbi); + old = vnode->cb_interest; + vnode->cb_interest = cbi; vnode->cb_s_break = cbi->server->cb_s_break;clear_bit (AFS_VNODE_CB_PROMISED , &vnode->flags);write_sequnlock (&vnode->cb_lock); +afs_put_cb_interest (afs_v2net (vnode), old);return 0 ; }
fs/afs/internal.h +5 -2
@@ -399,6 +399,7 @@ struct afs_server_list {unsigned short index;/* Server currently in use */ unsigned short vnovol_mask;/* Servers to be skipped due to VNOVOL */ unsigned int seq;/* Set to ->servers_seq when installed */ +rwlock_t lock;struct afs_server_entry servers[]; };
@@ -605,13 +606,15 @@ extern void afs_init_callback_state(struextern void afs_break_callback (struct afs_vnode *);extern void afs_break_callbacks (struct afs_server *,size_t ,struct afs_callback []); -extern int afs_register_server_cb_interest (struct afs_vnode *,struct afs_server_entry *); +extern int afs_register_server_cb_interest (struct afs_vnode *, +struct afs_server_list *,unsigned int );extern void afs_put_cb_interest (struct afs_net *,struct afs_cb_interest *);extern void afs_clear_callback_interests (struct afs_net *,struct afs_server_list *);static inline struct afs_cb_interest *afs_get_cb_interest (struct afs_cb_interest *cbi) { -refcount_inc (&cbi->usage); +if (cbi) +refcount_inc (&cbi->usage);return cbi; }
fs/afs/rotate.c +2 -2
@@ -350,8 +350,8 @@ use_server:* break request before we've finished decoding the reply and * installing the vnode. */ - fc->ac.error =afs_register_server_cb_interest ( - vnode, &fc->server_list->servers[fc->index]); + fc->ac.error =afs_register_server_cb_interest (vnode, fc->server_list, + fc->index);if (fc->ac.error <0 ) goto failed;
fs/afs/server_list.c +5 -2
@@ -49,6 +49,7 @@ struct afs_server_list *afs_alloc_server goto error;refcount_set (&slist->usage,1 ); +rwlock_init (&slist->lock);/* Make sure a records exists for each server in the list. */ for (i =0 ; i < vldb->nr_servers; i++) {
@@ -64,9 +65,11 @@ struct afs_server_list *afs_alloc_server goto error_2; } -/* Insertion-sort by server pointer */ +/* Insertion-sort by UUID */ for (j =0 ; j < slist->nr_servers; j++) -if (slist->servers[j].server >= server) +if (memcmp (&slist->servers[j].server->uuid, + &server->uuid, +sizeof (server->uuid)) >=0 )break ;if (j < slist->nr_servers) {if (slist->servers[j].server == server) {
Greg Kroah-Hartman
maintainerPATCH 250/279 afs: Fix server rotations handling of fileserver probe failure
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit ec5a3b4b507efca903d848518dcf2ebf7b04b466 ]
The server rotation algorithm just gives up if it fails to probe a fileserver. Fix this by rotating to the next fileserver instead.
--- fs/afs/rotate.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/afs/rotate.c +10 -2
@@ -369,8 +369,16 @@ use_server:if (!test_bit (AFS_SERVER_FL_PROBED , &server->flags)) { fc->ac.alist =afs_get_addrlist (alist); -if (!afs_probe_fileserver (fc)) - goto failed; +if (!afs_probe_fileserver (fc)) { +switch (fc->ac.error) { +case -ENOMEM : +case -ERESTARTSYS : +case -EINTR : + goto failed; +default : + goto next_server; + } + } }if (!fc->ac.alist)
Greg Kroah-Hartman
maintainerPATCH 251/279 mtd: Fix comparison in map_word_andequal()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit ea739a287f4f16d6250bea779a1026ead79695f2 ]
Commit 9e343e87d2c4 ("mtd: cfi: convert inline functions to macros") changed map_word_andequal() into a macro, but also changed the right hand side of the comparison from val3 to val2. Change it back to use val3 on the right hand side.
Thankfully this did not cause a regression because all callers currently pass the same argument for val2 and val3.
--- include/linux/mtd/map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mtd/map.h +1 -1
@@ -312,7 +312,7 @@ void map_destroy(struct mtd_info *mtd); ({ \ int i, ret = 1; \ for (i = 0; i < map_words(map); i++) { \ - if (((val1).x[i] & (val2).x[i]) != (val2).x[i]) { \ + if (((val1).x[i] & (val2).x[i]) != (val3).x[i]) { \ ret = 0; \ break; \ } \
Greg Kroah-Hartman
maintainerPATCH 252/279 afs: Fix VNOVOL handling in address rotation
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 3d9fa91161387ee629e7a07c47934d119910c8ae ]
If a volume location record lists multiple file servers for a volume, then it's possible that due to a misconfiguration or a changing configuration that one of the file servers doesn't know about it yet and will abort VNOVOL. Currently, the rotation algorithm will stop with EREMOTEIO.
Fix this by moving on to try the next server if VNOVOL is returned. Once all the servers have been tried and the record rechecked, the algorithm will stop with EREMOTEIO or ENOMEDIUM.
--- fs/afs/rotate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/rotate.c +2 -2
@@ -179,7 +179,7 @@ bool afs_select_fileserver(struct afs_fs*/ if (fc->flags &AFS_FS_CURSOR_VNOVOL ) { fc->ac.error = -EREMOTEIO ; - goto failed; + goto next_server; }write_lock (&vnode->volume->servers_lock);
@@ -201,7 +201,7 @@ bool afs_select_fileserver(struct afs_fs*/ if (vnode->volume->servers == fc->server_list) { fc->ac.error = -EREMOTEIO ; - goto failed; + goto next_server; }/* Try again */
Greg Kroah-Hartman
maintainerPATCH 253/279 afs: Fix the handling of CB.InitCallBackState3 to find the server by UUID
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 001ab5a67ee5d191c64aebf4b4ef8c7a0dcfd2bc ]
Fix the handling of the CB.InitCallBackState3 service call to find the record of a server that we're using by looking it up by the UUID passed as the parameter rather than by its address (of which it might have many, and which may change).
--- fs/afs/cmservice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/afs/cmservice.c +3 -3
@@ -341,7 +341,6 @@ static int afs_deliver_cb_init_call_back*/ static int afs_deliver_cb_init_call_back_state3 (struct afs_call *call) { -struct sockaddr_rxrpc srx;struct afs_server *server;struct afs_uuid *r;unsigned loop;
@@ -398,8 +397,9 @@ static int afs_deliver_cb_init_call_back/* we'll need the file server record as that tells us which set of * vnodes to operate upon */ -rxrpc_kernel_get_peer (call->net->socket, call->rxcall, &srx); - server =afs_find_server (call->net, &srx); +rcu_read_lock (); + server =afs_find_server_by_uuid (call->net, call->request); +rcu_read_unlock ();if (!server)return -ENOTCONN ; call->cm_server = server;
Greg Kroah-Hartman
maintainerPATCH 254/279 afs: Fix afs_find_server search loop
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Dionne <[email protected]>
[ Upstream commit f9c1bba3d392843f046d2ee27b4dfcec989d8a4b ]
The code that looks up servers by addresses makes the assumption that the list of addresses for a server is sorted. It exits the loop if it finds that the target address is larger than the current candidate. As the list is not currently sorted, this can lead to a failure to find a matching server, which can cause callbacks from that server to be ignored.
Remove the early exit case so that the complete list is searched.
--- fs/afs/server.c | 13 ------------- 1 file changed, 13 deletions(-)
fs/afs/server.c +0 -13
@@ -66,12 +66,6 @@ struct afs_server *afs_find_server(struc sizeof(struct in6_addr));if (diff ==0 ) goto found; -if (diff <0 ) { -// TODO: Sort the list -//if (i == alist->nr_ipv4) -// goto not_found; -break ; - } } } }else {
@@ -85,17 +79,10 @@ struct afs_server *afs_find_server(struc (u32)b->sin6_addr.s6_addr32[3]);if (diff ==0 ) goto found; -if (diff <0 ) { -// TODO: Sort the list -//if (i == 0) -// goto not_found; -break ; - } } } } -//not_found: server =NULL ; found:if (server && !atomic_inc_not_zero (&server->usage))
Greg Kroah-Hartman
maintainerPATCH 255/279 afs: Fix the non-encryption of calls
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 4776cab43fd3111618112737a257dc3ef368eddd ]
Some AFS servers refuse to accept unencrypted traffic, so can't be accessed with kAFS. Set the AF_RXRPC security level to encrypt client calls to deal with this.
Note that incoming service calls are set by the remote client and so aren't affected by this.
This requires an AF_RXRPC patch to pass the value set by setsockopt to calls begun by the kernel.
--- fs/afs/rxrpc.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/afs/rxrpc.c +7 -0
@@ -41,6 +41,7 @@ int afs_open_socket(struct afs_net *net) {struct sockaddr_rxrpc srx;struct socket *socket; +unsigned int min_level;int ret;_enter ("" );
@@ -60,6 +61,12 @@ int afs_open_socket(struct afs_net *net) srx.transport.sin6.sin6_family =AF_INET6 ; srx.transport.sin6.sin6_port =htons (AFS_CM_PORT ); + min_level =RXRPC_SECURITY_ENCRYPT ; + ret =kernel_setsockopt (socket,SOL_RXRPC ,RXRPC_MIN_SECURITY_LEVEL , + (void *)&min_level,sizeof (min_level)); +if (ret <0 ) + goto error_2; + ret =kernel_bind (socket, (struct sockaddr *) &srx,sizeof (srx));if (ret == -EADDRINUSE ) { srx.transport.sin6.sin6_port =0 ;
Greg Kroah-Hartman
maintainerPATCH 257/279 ARM: keystone: fix platform_domain_notifier array overrun
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit 9954b80b8c0e8abc98e17bba0fccd9876211ceaa ]
platform_domain_notifier contains a variable sized array, which the pm_clk_notify() notifier treats as a NULL terminated array:
for (con_id = clknb->con_ids; *con_id; con_id++)
pm_clk_add(dev, *con_id);Omitting the initialiser for con_ids means that the array is zero sized, and there is no NULL terminator. This leads to pm_clk_notify() overrunning into what ever structure follows, which may not be NULL. This leads to an oops:
Unable to handle kernel NULL pointer dereference at virtual address 0000008c pgd = c0003000 [0000008c] *pgd=80000800004003c, *pmd=00000000c Internal error: Oops: 206 [#1] PREEMPT SMP ARM Modules linked in:c CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.16.0+ #9 Hardware name: Keystone PC is at strlen+0x0/0x34 LR is at kstrdup+0x18/0x54 pc : [<c0623340>] lr : [<c0111d6c>] psr: 20000013
sp : eec73dc0 ip : eed780c0 fp : 00000001
r10: 00000000 r9 : 00000000 r8 : eed71e10
r7 : 0000008c r6 : 0000008c r5 : 014000c0 r4 : c03a6ff4 r3 : c09445d0 r2 : 00000000 r1 : 014000c0 r0 : 0000008c
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 30c5387d Table: 00003000 DAC: fffffffd Process swapper/0 (pid: 1, stack limit = 0xeec72210)
Stack: (0xeec73dc0 to 0xeec74000)
...
[<c0623340>] (strlen) from [<c0111d6c>] (kstrdup+0x18/0x54)
[<c0111d6c>] (kstrdup) from [<c03a6ff4>] (__pm_clk_add+0x58/0x120)
[<c03a6ff4>] (__pm_clk_add) from [<c03a731c>] (pm_clk_notify+0x64/0xa8)
[<c03a731c>] (pm_clk_notify) from [<c004614c>] (notifier_call_chain+0x44/0x84) [<c004614c>] (notifier_call_chain) from [<c0046320>] (__blocking_notifier_call_chain+0x48/0x60) [<c0046320>] (__blocking_notifier_call_chain) from [<c0046350>] (blocking_notifier_call_chain+0x18/0x20) [<c0046350>] (blocking_notifier_call_chain) from [<c0390234>] (device_add+0x36c/0x534) [<c0390234>] (device_add) from [<c047fc00>] (of_platform_device_create_pdata+0x70/0xa4) [<c047fc00>] (of_platform_device_create_pdata) from [<c047fea0>] (of_platform_bus_create+0xf0/0x1ec) [<c047fea0>] (of_platform_bus_create) from [<c047fff8>] (of_platform_populate+0x5c/0xac) [<c047fff8>] (of_platform_populate) from [<c08b1f04>] (of_platform_default_populate_init+0x8c/0xa8) [<c08b1f04>] (of_platform_default_populate_init) from [<c000a78c>] (do_one_initcall+0x3c/0x164) [<c000a78c>] (do_one_initcall) from [<c087bd9c>] (kernel_init_freeable+0x10c/0x1d0) [<c087bd9c>] (kernel_init_freeable) from [<c0628db0>] (kernel_init+0x8/0xf0) [<c0628db0>] (kernel_init) from [<c00090d8>] (ret_from_fork+0x14/0x3c)
Exception stack(0xeec73fb0 to 0xeec73ff8) 3fa0: 00000000 00000000 00000000 00000000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 Code: e3520000 1afffff7 e12fff1e c0801730 (e5d02000) ---[ end trace cafa8f148e262e80 ]---
Fix this by adding the necessary initialiser.
--- arch/arm/mach-keystone/pm_domain.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-keystone/pm_domain.c +1 -0
@@ -29,6 +29,7 @@ static struct dev_pm_domain keystone_pm_static struct pm_clk_notifier_block platform_domain_notifier = { .pm_domain = &keystone_pm_domain, + .con_ids = {NULL }, };static const struct of_device_id of_keystone_table[] = {
Greg Kroah-Hartman
maintainerPATCH 258/279 i2c: pmcmsp: return message count on master_xfer success
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Rosin <[email protected]>
[ Upstream commit de9a8634f1cb4560a35696d472cc7f1383d9b866 ]
Returning zero is wrong in this case.
--- drivers/i2c/busses/i2c-pmcmsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-pmcmsp.c +1 -1
@@ -567,7 +567,7 @@ static int pmcmsptwi_master_xfer(structreturn -1 ; } -return 0 ; +return num; }static u32 pmcmsptwi_i2c_func (struct i2c_adapter *adapter)
Greg Kroah-Hartman
maintainerPATCH 259/279 i2c: pmcmsp: fix error return from master_xfer
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Rosin <[email protected]>
[ Upstream commit 12d9bbc5a7f347eaa65ff2a9d34995cadc05eb1b ]
Returning -1 (-EPERM) is not appropriate here, go with -EIO.
--- drivers/i2c/busses/i2c-pmcmsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-pmcmsp.c +1 -1
@@ -564,7 +564,7 @@ static int pmcmsptwi_master_xfer(struct* TODO: We could potentially loop and retry in the case * of MSP_TWI_XFER_TIMEOUT. */ -return -1 ; +return -EIO ; }return num;
Greg Kroah-Hartman
maintainerPATCH 260/279 i2c: viperboard: return message count on master_xfer success
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Rosin <[email protected]>
[ Upstream commit 35cd67a0caf767aba472452865dcb4471fcce2b1 ]
Returning zero is wrong in this case.
--- drivers/i2c/busses/i2c-viperboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-viperboard.c +1 -1
@@ -337,7 +337,7 @@ static int vprbrd_i2c_xfer(struct i2c_ad }mutex_unlock (&vb->lock); } -return 0 ; +return num; error:mutex_unlock (&vb->lock);return error;
Greg Kroah-Hartman
maintainerPATCH 261/279 ARM: davinci: dm646x: fix timer interrupt generation
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
[ Upstream commit 73d4337ed9ceddef4b2f0e226634d5f985aa2d1c ]
commit b38434145b34 ("ARM: davinci: irqs: Correct McASP1 TX interrupt definition for DM646x") inadvertently removed priority setting for timer0_12 (bottom half of timer0). This timer is used as clockevent.
When INTPRIn register setting for an interrupt is left at 0, it is mapped to FIQ by the AINTC causing the timer interrupt to not get generated.
Fix it by including an entry for timer0_12 in interrupt priority map array. While at it, move the clockevent comment to the right place.
--- arch/arm/mach-davinci/dm646x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/dm646x.c +2 -1
@@ -495,7 +495,8 @@ static u8 dm646x_default_priorities[DAVI [IRQ_DM646X_MCASP0TXINT] = 7, [IRQ_DM646X_MCASP0RXINT] = 7, [IRQ_DM646X_RESERVED_3] = 7, - [IRQ_DM646X_MCASP1TXINT] = 7, /* clockevent */ + [IRQ_DM646X_MCASP1TXINT] = 7, + [IRQ_TINT0_TINT12] = 7, /* clockevent */ [IRQ_TINT0_TINT34] = 7, /* clocksource */ [IRQ_TINT1_TINT12] = 7, /* DSP timer */ [IRQ_TINT1_TINT34] = 7, /* system tick */
Greg Kroah-Hartman
maintainerPATCH 262/279 ARM: davinci: board-dm646x-evm: pass correct I2C adapter id for VPIF
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
[ Upstream commit 7d46899d57f8b61eb28701d9a4043b71e3392c26 ]
commit a16cb91ad9c4 ("[media] media: vpif: use a configurable i2c_adapter_id for vpif display") removed hardcoded I2C adaptor setting in VPIF driver, but missed updating platform data passed from DM646x board.
Fix it.
--- arch/arm/mach-davinci/board-dm646x-evm.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-davinci/board-dm646x-evm.c +2 -0
@@ -534,6 +534,7 @@ static struct vpif_display_config dm646x .set_clock = set_vpif_clock, .subdevinfo = dm646x_vpif_subdev, .subdev_count = ARRAY_SIZE(dm646x_vpif_subdev), + .i2c_adapter_id = 1, .chan_config[0] = { .outputs = dm6467_ch0_outputs, .output_count = ARRAY_SIZE(dm6467_ch0_outputs),
@@ -676,6 +677,7 @@ static struct vpif_capture_config dm646x .setup_input_channel_mode = setup_vpif_input_channel_mode, .subdev_info = vpif_capture_sdev_info, .subdev_count = ARRAY_SIZE(vpif_capture_sdev_info), + .i2c_adapter_id = 1, .chan_config[0] = { .inputs = dm6467_ch0_inputs, .input_count = ARRAY_SIZE(dm6467_ch0_inputs),
Greg Kroah-Hartman
maintainerPATCH 263/279 ARM: davinci: board-dm646x-evm: set VPIF capture card name
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
[ Upstream commit bb7298a7e87cf3430eb62be8746e5d7a07ca9d7c ]
VPIF capture driver expects card name to be set since it uses it without checking for NULL. The commit which introduced VPIF display and capture support added card name only for display, not for capture.
Set it in platform data to probe driver successfully.
While at it, also fix the display card name to something more appropriate.
--- arch/arm/mach-davinci/board-dm646x-evm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/board-dm646x-evm.c +2 -1
@@ -539,7 +539,7 @@ static struct vpif_display_config dm646x .outputs = dm6467_ch0_outputs, .output_count = ARRAY_SIZE(dm6467_ch0_outputs), }, - .card_name = "DM646x EVM", + .card_name = "DM646x EVM Video Display", };/**
@@ -698,6 +698,7 @@ static struct vpif_capture_config dm646x .fid_pol = 0, }, }, + .card_name = "DM646x EVM Video Capture", };static void __init evm_init_video (void )
Greg Kroah-Hartman
maintainerPATCH 265/279 mtd: rawnand: Fix return type of __DIVIDE() when called with 32-bit
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9f825e74d761c13b0cfaa5f65344d64ff970e252 ]
The __DIVIDE() macro checks whether it is called with a 32-bit or 64-bit dividend, to select the appropriate divide-and-round-up routine. As the check uses the ternary operator, the result will always be promoted to a type that can hold both results, i.e. unsigned long long.
When using this result in a division on a 32-bit system, this may lead to link errors like:
ERROR: "__udivdi3" [drivers/mtd/nand/raw/nand.ko] undefined!
Fix this by casting the result of the division to the type of the dividend.
--- include/linux/mtd/rawnand.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
include/linux/mtd/rawnand.h +11 -5
@@ -824,12 +824,18 @@ struct nand_op_instr {* tBERS (during an erase) which all of them are u64 values that cannot be * divided by usual kernel macros and must be handled with the special * DIV_ROUND_UP_ULL() macro. +* +* Cast to type of dividend is needed here to guarantee that the result won't +* be an unsigned long long when the dividend is an unsigned long (or smaller), +* which is what the compiler does when it sees ternary operator with 2 +* different return types (picks the largest type to make sure there's no +* loss). */ -#define __DIVIDE (dividend, divisor) ({ \ - sizeof(dividend) == sizeof(u32) ? \ - DIV_ROUND_UP(dividend, divisor) : \ - DIV_ROUND_UP_ULL(dividend, divisor); \ - }) +#define __DIVIDE (dividend, divisor) ({ \ + (__typeof__(dividend))(sizeof(dividend) <= sizeof(unsigned long) ? \ + DIV_ROUND_UP(dividend, divisor) : \ + DIV_ROUND_UP_ULL(dividend, divisor)); \ + })#define PSEC_TO_NSEC (x) __DIVIDE(x, 1000)#define PSEC_TO_MSEC (x) __DIVIDE(x, 1000000000)
Greg Kroah-Hartman
maintainerPATCH 266/279 clk: imx6ull: use OSC clock during AXI rate change
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Agner <[email protected]>
[ Upstream commit 2e5be528ab0182ad4b42b9feea3b80f85f37179b ]
On i.MX6 ULL using PLL3 seems to cause a freeze when setting the parent to IMX6UL_CLK_PLL3_USB_OTG. This only seems to appear since commit 6f9575e55632 ("clk: imx: Add CLK_IS_CRITICAL flag for busy divider and busy mux"), probably because the clock is now forced to be on.
--- drivers/clk/imx/clk-imx6ul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx6ul.c +1 -1
@@ -461,7 +461,7 @@ static void __init imx6ul_clocks_init(stclk_set_rate (clks[IMX6UL_CLK_AHB ],99000000 );/* Change periph_pre clock to pll2_bus to adjust AXI rate to 264MHz */ -clk_set_parent (clks[IMX6UL_CLK_PERIPH_CLK2_SEL ], clks[IMX6UL_CLK_PLL3_USB_OTG ]); +clk_set_parent (clks[IMX6UL_CLK_PERIPH_CLK2_SEL ], clks[IMX6UL_CLK_OSC ]);clk_set_parent (clks[IMX6UL_CLK_PERIPH ], clks[IMX6UL_CLK_PERIPH_CLK2 ]);clk_set_parent (clks[IMX6UL_CLK_PERIPH_PRE ], clks[IMX6UL_CLK_PLL2_BUS ]);clk_set_parent (clks[IMX6UL_CLK_PERIPH ], clks[IMX6UL_CLK_PERIPH_PRE ]);
Greg Kroah-Hartman
maintainerPATCH 267/279 locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit d7d760efad70c7a030725499bf9f342f04af24dd ]
There are use cases where a rwsem can be acquired by one task, but released by another task. In thess cases, optimistic spinning may need to be disabled. One example will be the filesystem freeze/thaw code where the task that freezes the filesystem will acquire a write lock on a rwsem and then un-owns it before returning to userspace. Later on, another task will come along, acquire the ownership, thaw the filesystem and release the rwsem.
Bit 0 of the owner field was used to designate that it is a reader owned rwsem. It is now repurposed to mean that the owner of the rwsem is not known. If only bit 0 is set, the rwsem is reader owned. If bit 0 and other bits are set, it is writer owned with an unknown owner. One such value for the latter case is (-1L). So we can set owner to 1 for reader-owned, -1 for writer-owned. The owner is unknown in both cases.
To handle transfer of rwsem ownership, the higher level code should set the owner field to -1 to indicate a write-locked rwsem with unknown owner. Optimistic spinning will be disabled in this case.
Once the higher level code figures who the new owner is, it can then set the owner field accordingly.
--- kernel/locking/rwsem-xadd.c | 17 +++++++---------- kernel/locking/rwsem.c | 2 -- kernel/locking/rwsem.h | 30 +++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 21 deletions(-)
kernel/locking/rwsem-xadd.c +7 -10
@@ -357,11 +357,8 @@ static inline bool rwsem_can_spin_on_ownrcu_read_lock (); owner =READ_ONCE (sem->owner); -if (!rwsem_owner_is_writer (owner)) { -/* -* Don't spin if the rwsem is readers owned. -*/ - ret = !rwsem_owner_is_reader (owner); +if (!owner || !is_rwsem_owner_spinnable (owner)) { + ret = !owner;/* !owner is spinnable */ goto done; }
@@ -382,11 +379,11 @@ static noinline bool rwsem_spin_on_owner {struct task_struct *owner =READ_ONCE (sem->owner); -if (!rwsem_owner_is_writer (owner)) - goto out; +if (!is_rwsem_owner_spinnable (owner)) +return false;rcu_read_lock (); -while (sem->owner == owner) { +while (owner && (READ_ONCE (sem->owner) == owner)) {/* * Ensure we emit the owner->on_cpu, dereference _after_ * checking sem->owner still matches owner, if that fails,
@@ -408,12 +405,12 @@ static noinline bool rwsem_spin_on_ownercpu_relax (); }rcu_read_unlock (); -out: +/* * If there is a new owner or the owner is not set, we continue * spinning. */ -return !rwsem_owner_is_reader (READ_ONCE (sem->owner)); +return is_rwsem_owner_spinnable (READ_ONCE (sem->owner)); }static bool rwsem_optimistic_spin (struct rw_semaphore *sem)
kernel/locking/rwsem.c +0 -2
@@ -217,5 +217,3 @@ void up_read_non_owner(struct rw_semaphoEXPORT_SYMBOL (up_read_non_owner);#endif - -
kernel/locking/rwsem.h +21 -9
@@ -1,20 +1,24 @@/* SPDX-License-Identifier: GPL-2.0 */ /* * The owner field of the rw_semaphore structure will be set to -* RWSEM_READ_OWNED when a reader grabs the lock. A writer will clear +* RWSEM_READER_OWNED when a reader grabs the lock. A writer will clear * the owner field when it unlocks. A reader, on the other hand, will * not touch the owner field when it unlocks. * -* In essence, the owner field now has the following 3 states: +* In essence, the owner field now has the following 4 states: * 1) 0 * - lock is free or the owner hasn't set the field yet * 2) RWSEM_READER_OWNED * - lock is currently or previously owned by readers (lock is free * or not set by owner yet) -* 3) Other non-zero value -* - a writer owns the lock +* 3) RWSEM_ANONYMOUSLY_OWNED bit set with some other bits set as well +* - lock is owned by an anonymous writer, so spinning on the lock +* owner should be disabled. +* 4) Other non-zero value +* - a writer owns the lock and other writers can spin on the lock owner. */ -#define RWSEM_READER_OWNED ((struct task_struct *)1UL) +#define RWSEM_ANONYMOUSLY_OWNED (1UL << 0) +#define RWSEM_READER_OWNED ((struct task_struct *)RWSEM_ANONYMOUSLY_OWNED)#ifdef CONFIG_RWSEM_SPIN_ON_OWNER /*
@@ -45,14 +49,22 @@ static inline void rwsem_set_reader_owne WRITE_ONCE(sem->owner, RWSEM_READER_OWNED); } -static inline bool rwsem_owner_is_writer (struct task_struct *owner) +/* +* Return true if the a rwsem waiter can spin on the rwsem's owner +* and steal the lock, i.e. the lock is not anonymously owned. +* N.B. !owner is considered spinnable. +*/ +static inline bool is_rwsem_owner_spinnable (struct task_struct *owner) { -return owner && owner !=RWSEM_READER_OWNED ; +return !((unsigned long )owner &RWSEM_ANONYMOUSLY_OWNED ); } -static inline bool rwsem_owner_is_reader (struct task_struct *owner) +/* +* Return true if rwsem is owned by an anonymous writer or readers. +*/ +static inline bool rwsem_has_anonymous_owner (struct task_struct *owner) { -return owner ==RWSEM_READER_OWNED ; +return (unsigned long )owner &RWSEM_ANONYMOUSLY_OWNED ; }#else static inline void rwsem_set_owner (struct rw_semaphore *sem)
Greg Kroah-Hartman
maintainerPATCH 268/279 locking/percpu-rwsem: Annotate rwsem ownership transfer by setting RWSEM_OWNER_UNKNOWN
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 5a817641f68a6399a5fac8b7d2da67a73698ffed ]
The filesystem freezing code needs to transfer ownership of a rwsem embedded in a percpu-rwsem from the task that does the freezing to another one that does the thawing by calling percpu_rwsem_release() after freezing and percpu_rwsem_acquire() before thawing.
However, the new rwsem debug code runs afoul with this scheme by warning that the task that releases the rwsem isn't the one that acquires it, as reported by Amir Goldstein:
DEBUG_LOCKS_WARN_ON(sem->owner != get_current())
WARNING: CPU: 1 PID: 1401 at /home/amir/build/src/linux/kernel/locking/rwsem.c:133 up_write+0x59/0x79 Call Trace: percpu_up_write+0x1f/0x28 thaw_super_locked+0xdf/0x120 do_vfs_ioctl+0x270/0x5f1 ksys_ioctl+0x52/0x71 __x64_sys_ioctl+0x16/0x19 do_syscall_64+0x5d/0x167 entry_SYSCALL_64_after_hwframe+0x49/0xbe
To work properly with the rwsem debug code, we need to annotate that the rwsem ownership is unknown during the tranfer period until a brave soul comes forward to acquire the ownership. During that period, optimistic spinning will be disabled.
--- include/linux/percpu-rwsem.h | 6 +++++- include/linux/rwsem.h | 6 ++++++ kernel/locking/rwsem-xadd.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-)
include/linux/percpu-rwsem.h +5 -1
@@ -133,7 +133,7 @@ static inline void percpu_rwsem_release(lock_release (&sem->rw_sem.dep_map,1 , ip);#ifdef CONFIG_RWSEM_SPIN_ON_OWNER if (!read) - sem->rw_sem.owner =NULL ; + sem->rw_sem.owner =RWSEM_OWNER_UNKNOWN ;#endif }
@@ -141,6 +141,10 @@ static inline void percpu_rwsem_acquire( bool read, unsigned long ip) {lock_acquire (&sem->rw_sem.dep_map,0 ,1 , read,1 ,NULL , ip); +#ifdef CONFIG_RWSEM_SPIN_ON_OWNER +if (!read) + sem->rw_sem.owner = current; +#endif }#endif
include/linux/rwsem.h +6 -0
@@ -44,6 +44,12 @@ struct rw_semaphore {#endif }; +/* +* Setting bit 0 of the owner field with other non-zero bits will indicate +* that the rwsem is writer-owned with an unknown owner. +*/ +#define RWSEM_OWNER_UNKNOWN ((struct task_struct *)-1L) +extern struct rw_semaphore *rwsem_down_read_failed (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_read_failed_killable (struct rw_semaphore *sem);extern struct rw_semaphore *rwsem_down_write_failed (struct rw_semaphore *sem);
kernel/locking/rwsem-xadd.c +2 -0
@@ -352,6 +352,8 @@ static inline bool rwsem_can_spin_on_ownstruct task_struct *owner;bool ret = true; +BUILD_BUG_ON (!rwsem_has_anonymous_owner (RWSEM_OWNER_UNKNOWN )); +if (need_resched ())return false;
Greg Kroah-Hartman
maintainerPATCH 269/279 drm/dumb-buffers: Integer overflow in drm_mode_create_ioctl()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 2b6207291b7b277a5df9d1aab44b56815a292dba ]
There is a comment here which says that DIV_ROUND_UP() and that's where the problem comes from. Say you pick:
args->bpp = UINT_MAX - 7; args->width = 4; args->height = 1;
The integer overflow in DIV_ROUND_UP() means "cpp" is UINT_MAX / 8 and because of how we picked args->width that means cpp < UINT_MAX / 4.
I've fixed it by preventing the integer overflow in DIV_ROUND_UP(). I removed the check for !cpp because it's not possible after this change. I also changed all the 0xffffffffU references to U32_MAX.
--- drivers/gpu/drm/drm_dumb_buffers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dumb_buffers.c +4 -3
@@ -65,12 +65,13 @@ int drm_mode_create_dumb_ioctl(struct drreturn -EINVAL ;/* overflow checks for 32bit size calculations */ -/* NOTE: DIV_ROUND_UP() can overflow */ +if (args->bpp >U32_MAX -8 ) +return -EINVAL ; cpp =DIV_ROUND_UP (args->bpp,8 ); -if (!cpp || cpp >0xffffffffU / args->width) +if (cpp >U32_MAX / args->width)return -EINVAL ; stride = cpp * args->width; -if (args->height >0xffffffffU / stride) +if (args->height >U32_MAX / stride)return -EINVAL ;/* test for wrap-around */
Greg Kroah-Hartman
maintainerPATCH 272/279 parisc: Move setup_profiling_timer() out of init section
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 01f56832cfb6fcc204e7203f46841b6185ebd574 ]
No other architecture has setup_profiling_timer() in the init section,
thus on parisc we face this section mismatch warning:
Reference from the function devm_device_add_group() to the function .init.text:setup_profiling_timer()
--- arch/parisc/kernel/smp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/parisc/kernel/smp.c +1 -2
@@ -423,8 +423,7 @@ int __cpu_up(unsigned int cpu, struct ta }#ifdef CONFIG_PROC_FS -int __init -setup_profiling_timer (unsigned int multiplier) +int setup_profiling_timer (unsigned int multiplier) {return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 273/279 platform/x86: DELL_WMI use depends on instead of select for DELL_SMBIOS
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
[ Upstream commit 54940fa60ad3728c592f62dadb558165495a6938 ]
If DELL_WMI "select"s DELL_SMBIOS, the DELL_SMBIOS dependencies are ignored and it is still possible to end up with unmet direct dependencies.
Change the select to a depends on.
--- drivers/platform/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -1
@@ -168,8 +168,8 @@ config DELL_WMI depends on DMI depends on INPUT depends on ACPI_VIDEO || ACPI_VIDEO = n + depends on DELL_SMBIOS select DELL_WMI_DESCRIPTOR - select DELL_SMBIOS select INPUT_SPARSEKMAP ---help--- Say Y here if you want to support WMI-based hotkeys on Dell laptops.
Greg Kroah-Hartman
maintainerPATCH 274/279 efi/libstub/arm64: Handle randomized TEXT_OFFSET
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
[ Upstream commit 4f74d72aa7067e75af92fbab077e6d7d0210be66 ]
When CONFIG_RANDOMIZE_TEXT_OFFSET=y, TEXT_OFFSET is an arbitrary multiple of PAGE_SIZE in the interval [0, 2MB).
The EFI stub does not account for the potential misalignment of TEXT_OFFSET relative to EFI_KIMG_ALIGN, and produces a randomized physical offset which is always a round multiple of EFI_KIMG_ALIGN. This may result in statically allocated objects whose alignment exceeds PAGE_SIZE to appear misaligned in memory. This has been observed to result in spurious stack overflow reports and failure to make use of the IRQ stacks, and theoretically could result in a number of other issues.
We can OR in the low bits of TEXT_OFFSET to ensure that we have the necessary offset (and hence preserve the misalignment of TEXT_OFFSET relative to EFI_KIMG_ALIGN), so let's do that.
--- drivers/firmware/efi/libstub/arm64-stub.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/firmware/efi/libstub/arm64-stub.c +10 -0
@@ -98,6 +98,16 @@ efi_status_t handle_kernel_image(efi_sys (phys_seed >> 32) & mask : TEXT_OFFSET;/* +* With CONFIG_RANDOMIZE_TEXT_OFFSET=y, TEXT_OFFSET may not +* be a multiple of EFI_KIMG_ALIGN, and we must ensure that +* we preserve the misalignment of 'offset' relative to +* EFI_KIMG_ALIGN so that statically allocated objects whose +* alignment exceeds PAGE_SIZE appear correctly aligned in +* memory. +*/ + offset |=TEXT_OFFSET %EFI_KIMG_ALIGN ; + +/* * If KASLR is enabled, and we have some randomness available, * locate the kernel at a randomized offset in physical memory. */
Greg Kroah-Hartman
maintainerPATCH 277/279 ARM: kexec: fix kdump register saving on panic()
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit 2d7b3c64431245c95b05a441669c074da10db943 ]
When a panic() occurs, the kexec code uses smp_send_stop() to stop the other CPUs, but this results in the CPU register state not being saved, and gdb is unable to inspect the state of other CPUs.
Commit 0ee59413c967 ("x86/panic: replace smp_send_stop() with kdump friendly version in panic path") addressed the issue on x86, but ignored other architectures. Address the issue on ARM by splitting out the crash stop implementation to crash_smp_send_stop() and adding the necessary protection.
--- arch/arm/kernel/machine_kexec.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
arch/arm/kernel/machine_kexec.c +22 -12
@@ -95,6 +95,27 @@ void machine_crash_nonpanic_core(void *ucpu_relax (); } +void crash_smp_send_stop (void ) +{ +static int cpus_stopped; +unsigned long msecs; + +if (cpus_stopped) +return ; + +atomic_set (&waiting_for_crash_ipi,num_online_cpus () -1 ); +smp_call_function (machine_crash_nonpanic_core,NULL , false); + msecs =1000 ;/* Wait at most a second for the other cpus to stop */ +while ((atomic_read (&waiting_for_crash_ipi) >0 ) && msecs) { +mdelay (1 ); + msecs--; + } +if (atomic_read (&waiting_for_crash_ipi) >0 ) +pr_warn ("Non-crashing CPUs did not react to IPI\n" ); + + cpus_stopped =1 ; +} +static void machine_kexec_mask_interrupts (void ) {unsigned int i;
@@ -120,19 +141,8 @@ static void machine_kexec_mask_interruptvoid machine_crash_shutdown (struct pt_regs *regs) { -unsigned long msecs; -local_irq_disable (); - -atomic_set (&waiting_for_crash_ipi,num_online_cpus () -1 ); -smp_call_function (machine_crash_nonpanic_core,NULL , false); - msecs =1000 ;/* Wait at most a second for the other cpus to stop */ -while ((atomic_read (&waiting_for_crash_ipi) >0 ) && msecs) { -mdelay (1 ); - msecs--; - } -if (atomic_read (&waiting_for_crash_ipi) >0 ) -pr_warn ("Non-crashing CPUs did not react to IPI\n" ); +crash_smp_send_stop ();crash_save_cpu (regs,smp_processor_id ());machine_kexec_mask_interrupts ();
Greg Kroah-Hartman
maintainerPATCH 278/279 ARM: replace unnecessary perl with sed and the shell $(( )) operator
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit 6cea14f55474ec71f1098228e0ae5dd2a8f22c0a ]
You can build a kernel in a cross compiling environment that doesn't have perl in the $PATH. Commit 429f7a062e3b broke that for 32 bit ARM. Fix it.
As reported by Stephen Rothwell, it appears that the symbols can be either part of the BSS section or absolute symbols depending on the binutils version. When they're an absolute symbol, the $(( )) operator errors out and the build fails. Fix this as well.
--- arch/arm/boot/compressed/Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/boot/compressed/Makefile +3 -5
@@ -117,11 +117,9 @@ ccflags-y := -fpic -mno-single-pic-base asflags-y := -DZIMAGE # Supply kernel BSS size to the decompressor via a linker symbol. -KBSS_SZ = $(shell $(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ - perl -e 'while (<>) { \ - $$bss_start=hex($$1) if /^([[:xdigit:]]+) B __bss_start$$/; \ - $$bss_end=hex($$1) if /^([[:xdigit:]]+) B __bss_stop$$/; \ - }; printf "%d\n", $$bss_end - $$bss_start;') +KBSS_SZ = $(shell echo $$(($$($(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ + sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \ + -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) ) LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) # Supply ZRELADDR to the decompressor via a linker symbol. ifneq ($(CONFIG_AUTO_ZRELADDR),y)
Greg Kroah-Hartman
maintainerPATCH 279/279 ARM: fix kill( ,SIGFPE) breakage
In reply to Greg Kroah-Hartman4.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit 92d44a42af81e850a038c38278ff4f434b2871df ]
Commit 7771c6645700 ("signal/arm: Document conflicts with SI_USER and SIGFPE") broke the siginfo structure for userspace triggered signals, causing the strace testsuite to regress. Fix this by eliminating the FPE_FIXME definition (which is at the root of the breakage) and use FPE_FLTINV instead for the case where the hardware appears to be reporting nonsense.
--- arch/arm/include/uapi/asm/siginfo.h | 13 ------------- arch/arm/vfp/vfpmodule.c | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 arch/arm/include/uapi/asm/siginfo.h
arch/arm/include/uapi/asm/siginfo.h deleted +0 -13
@@ -1,13 +0,0 @@ -#ifndef __ASM_SIGINFO_H -#define __ASM_SIGINFO_H - -#include <asm-generic/siginfo.h> - -/* -* SIGFPE si_codes -*/ -#ifdef __KERNEL__ -#define FPE_FIXME 0/* Broken dup of SI_USER */ -#endif /* __KERNEL__ */ - -#endif
arch/arm/vfp/vfpmodule.c +1 -1
@@ -257,7 +257,7 @@ static void vfp_raise_exceptions(u32 excif (exceptions ==VFP_EXCEPTION_ERROR ) {vfp_panic ("unhandled bounce" , inst); -vfp_raise_sigfpe (FPE_FIXME , regs); +vfp_raise_sigfpe (FPE_FLTINV , regs);return ; }
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
This patch:
Quoted 2 lines
Igor Russkikh <[email protected]>
net: aquantia: Limit number of vectors to actually allocated irqs
should also get an additional followup with mainline 58d813afbe89658 ("net: aquantia: fix unsigned numvecs comparison with less than zero"), otherwise error handling might be subtly broken.
cheers,
Holger
Greg Kroah-Hartman
maintainerQuoted 6 lines · Holger Hoffst�tte
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
This patch:
Quoted 2 lines
Igor Russkikh <[email protected]>
net: aquantia: Limit number of vectors to actually allocated irqsshould also get an additional followup with mainline
58d813afbe89658("net: aquantia: fix unsigned numvecs comparison with less than zero"), otherwise error handling might be subtly broken.
Thanks, now queued up for 4.16.y and 4.17.y
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 20 08:05:28 UTC 2018. Anything received after that time might be too late.
For v4.16.16-279-g957de89:
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 152 pass: 152 fail: 0
Details are available at http://kerneltests.org/builders/.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 20 08:05:28 UTC 2018. Anything received after that time might be too late.
Quoted 8 lines
For v4.16.16-279-g957de89:
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 152 pass: 152 fail: 0Details are available at http://kerneltests.org/builders/.
Great, thanks for testing and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 20 08:05:28 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.16.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.16.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.
Summary
------------------------------------------------------------------------
kernel: 4.16.17-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.16.y
git commit: 957de898f0f3aac469028d303d1384bc0a975e93
git describe: v4.16.16-279-g957de898f0f3
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.16-oe/build/v4.16.16-279-g957de898f0f3
No regressions (compared to build v4.16.16-280-g893364ab48d9)
Ran 11514 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* ltp-filecaps-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 15 lines · Naresh Kamboju
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.16.17 release. There are 279 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jun 20 08:05:28 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.16.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.16.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm andx86_64.
Thanks for testing both of these and letting me know.
greg k-h