* [PATCH 2/9] MIPS: Require O32 FP64 support for MIPS64 with O32 compat
[not found] <1437999987-24879-1-git-send-email-stefan@sevenbyte.org>
@ 2015-07-27 12:26 ` Stefan Tatschner
2015-07-27 12:26 ` [PATCH 4/9] st: null pointer dereference panic caused by use after kref_put by st_open Stefan Tatschner
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Tatschner @ 2015-07-27 12:26 UTC (permalink / raw)
To: ludwig.kuerzinger
Cc: Paul Burton, Markos Chandras, stable, linux-mips, Matthew Fortune,
linux-kernel, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
This is a multi-part message in MIME format.
[-- Attachment #2: Type: text/plain, Size: 961 bytes --]
MIPS32r6 code requires FP64 (ie. FR=1) support. Building a kernel with
support for MIPS32r6 binaries but without support for O32 with FP64 is
therefore a problem which can lead to incorrectly executed userland.
CONFIG_MIPS_O32_FP64_SUPPORT is already selected when the kernel is
configured for MIPS32r6, but not when the kernel is configured for
MIPS64r6 with O32 compat support. Select CONFIG_MIPS_O32_FP64_SUPPORT in
such configurations to prevent building kernels which execute MIPS32r6
userland incorrectly.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: <stable@vger.kernel.org> # v4.0-
Cc: linux-mips@linux-mips.org
Cc: Matthew Fortune <matthew.fortune@imgtec.com>
Cc: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/10674/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
arch/mips/Kconfig | 1 +
1 file changed, 1 insertion(+)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-MIPS-Require-O32-FP64-support-for-MIPS64-with-O32-co.patch --]
[-- Type: text/x-patch; name="0002-MIPS-Require-O32-FP64-support-for-MIPS64-with-O32-co.patch", Size: 446 bytes --]
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index aab7e46..66dc359 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1427,6 +1427,7 @@ config CPU_MIPS64_R6
select CPU_SUPPORTS_HIGHMEM
select CPU_SUPPORTS_MSA
select GENERIC_CSUM
+ select MIPS_O32_FP64_SUPPORT if MIPS32_O32
help
Choose this option to build a kernel for release 6 or later of the
MIPS64 architecture. New MIPS processors, starting with the Warrior
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/9] st: null pointer dereference panic caused by use after kref_put by st_open
[not found] <1437999987-24879-1-git-send-email-stefan@sevenbyte.org>
2015-07-27 12:26 ` [PATCH 2/9] MIPS: Require O32 FP64 support for MIPS64 with O32 compat Stefan Tatschner
@ 2015-07-27 12:26 ` Stefan Tatschner
2015-07-27 12:26 ` [PATCH 5/9] scsi: fix host max depth checking for the 'queue_depth' sysfs interface Stefan Tatschner
2015-07-27 12:26 ` [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU Stefan Tatschner
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Tatschner @ 2015-07-27 12:26 UTC (permalink / raw)
To: ludwig.kuerzinger
Cc: Seymour, Shane M, Darren Lavender, stable, James Bottomley
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
This is a multi-part message in MIME format.
[-- Attachment #2: Type: text/plain, Size: 6778 bytes --]
Two SLES11 SP3 servers encountered similar crashes simultaneously
following some kind of SAN/tape target issue:
...
qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 -- 1 2002.
qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 -- 1 2002.
qla2xxx [0000:81:00.0]-8009:3: DEVICE RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800f:3: DEVICE RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-8009:3: TARGET RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-800f:3: TARGET RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
qla2xxx [0000:81:00.0]-8012:3: BUS RESET ISSUED nexus=3:0:2.
qla2xxx [0000:81:00.0]-802b:3: BUS RESET SUCCEEDED nexus=3:0:2.
qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
qla2xxx [0000:81:00.0]-8018:3: ADAPTER RESET ISSUED nexus=3:0:2.
qla2xxx [0000:81:00.0]-00af:3: Performing ISP error recovery - ha=ffff88bf04d18000.
rport-3:0-0: blocked FC remote port time out: removing target and saving binding
qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
qla2xxx [0000:81:00.0]-8017:3: ADAPTER RESET SUCCEEDED nexus=3:0:2.
rport-2:0-0: blocked FC remote port time out: removing target and saving binding
sg_rq_end_io: device detached
BUG: unable to handle kernel NULL pointer dereference at 00000000000002a8
IP: [<ffffffff8133b268>] __pm_runtime_idle+0x28/0x90
PGD 7e6586f067 PUD 7e5af06067 PMD 0 [1739975.390354] Oops: 0002 [#1] SMP
CPU 0
...
Supported: No, Proprietary modules are loaded [1739975.390463]
Pid: 27965, comm: ABCD Tainted: PF X 3.0.101-0.29-default #1 HP ProLiant DL580 Gen8
RIP: 0010:[<ffffffff8133b268>] [<ffffffff8133b268>] __pm_runtime_idle+0x28/0x90
RSP: 0018:ffff8839dc1e7c68 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff883f0592fc00 RCX: 0000000000000090
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000138
RBP: 0000000000000138 R08: 0000000000000010 R09: ffffffff81bd39d0
R10: 00000000000009c0 R11: ffffffff81025790 R12: 0000000000000001
R13: ffff883022212b80 R14: 0000000000000004 R15: ffff883022212b80
FS: 00007f8e54560720(0000) GS:ffff88407f800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000000002a8 CR3: 0000007e6ced6000 CR4: 00000000001407f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process ABCD (pid: 27965, threadinfo ffff8839dc1e6000, task ffff883592e0c640)
Stack:
ffff883f0592fc00 00000000fffffffa 0000000000000001 ffff883022212b80
ffff883eff772400 ffffffffa03fa309 0000000000000000 0000000000000000
ffffffffa04003a0 ffff883f063196c0 ffff887f0379a930 ffffffff8115ea1e
Call Trace:
[<ffffffffa03fa309>] st_open+0x129/0x240 [st]
[<ffffffff8115ea1e>] chrdev_open+0x13e/0x200
[<ffffffff811588a8>] __dentry_open+0x198/0x310
[<ffffffff81167d74>] do_last+0x1f4/0x800
[<ffffffff81168fe9>] path_openat+0xd9/0x420
[<ffffffff8116946c>] do_filp_open+0x4c/0xc0
[<ffffffff8115a00f>] do_sys_open+0x17f/0x250
[<ffffffff81468d92>] system_call_fastpath+0x16/0x1b
[<00007f8e4f617fd0>] 0x7f8e4f617fcf
Code: eb d3 90 48 83 ec 28 40 f6 c6 04 48 89 6c 24 08 4c 89 74 24 20 48 89 fd 48 89 1c 24 4c 89 64 24 10 41 89 f6 4c 89 6c 24 18 74 11 <f0> ff 8f 70 01 00 00 0f 94 c0 45 31 ed 84 c0 74 2b 4c 8d a5 a0
RIP [<ffffffff8133b268>] __pm_runtime_idle+0x28/0x90
RSP <ffff8839dc1e7c68>
CR2: 00000000000002a8
Analysis reveals the cause of the crash to be due to STp->device
being NULL. The pointer was NULLed via scsi_tape_put(STp) when it
calls scsi_tape_release(). In st_open() we jump to err_out after
scsi_block_when_processing_errors() completes and returns the
device as offline (sdev_state was SDEV_DEL):
1180 /* Open the device. Needs to take the BKL only because of incrementing the SCSI host
1181 module count. */
1182 static int st_open(struct inode *inode, struct file *filp)
1183 {
1184 int i, retval = (-EIO);
1185 int resumed = 0;
1186 struct scsi_tape *STp;
1187 struct st_partstat *STps;
1188 int dev = TAPE_NR(inode);
1189 char *name;
...
1217 if (scsi_autopm_get_device(STp->device) < 0) {
1218 retval = -EIO;
1219 goto err_out;
1220 }
1221 resumed = 1;
1222 if (!scsi_block_when_processing_errors(STp->device)) {
1223 retval = (-ENXIO);
1224 goto err_out;
1225 }
...
1264 err_out:
1265 normalize_buffer(STp->buffer);
1266 spin_lock(&st_use_lock);
1267 STp->in_use = 0;
1268 spin_unlock(&st_use_lock);
1269 scsi_tape_put(STp); <-- STp->device = 0 after this
1270 if (resumed)
1271 scsi_autopm_put_device(STp->device);
1272 return retval;
The ref count for the struct scsi_tape had already been reduced
to 1 when the .remove method of the st module had been called.
The kref_put() in scsi_tape_put() caused scsi_tape_release()
to be called:
0266 static void scsi_tape_put(struct scsi_tape *STp)
0267 {
0268 struct scsi_device *sdev = STp->device;
0269
0270 mutex_lock(&st_ref_mutex);
0271 kref_put(&STp->kref, scsi_tape_release); <-- calls this
0272 scsi_device_put(sdev);
0273 mutex_unlock(&st_ref_mutex);
0274 }
In scsi_tape_release() the struct scsi_device in the struct
scsi_tape gets set to NULL:
4273 static void scsi_tape_release(struct kref *kref)
4274 {
4275 struct scsi_tape *tpnt = to_scsi_tape(kref);
4276 struct gendisk *disk = tpnt->disk;
4277
4278 tpnt->device = NULL; <<<---- where the dev is nulled
4279
4280 if (tpnt->buffer) {
4281 normalize_buffer(tpnt->buffer);
4282 kfree(tpnt->buffer->reserved_pages);
4283 kfree(tpnt->buffer);
4284 }
4285
4286 disk->private_data = NULL;
4287 put_disk(disk);
4288 kfree(tpnt);
4289 return;
4290 }
Although the problem was reported on SLES11.3 the problem appears
in linux-next as well.
The crash is fixed by reordering the code so we no longer access
the struct scsi_tape after the kref_put() is done on it in st_open().
Signed-off-by: Shane Seymour <shane.seymour@hp.com>
Signed-off-by: Darren Lavender <darren.lavender@hp.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Odin.com>
---
drivers/scsi/st.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0004-st-null-pointer-dereference-panic-caused-by-use-afte.patch --]
[-- Type: text/x-patch; name="0004-st-null-pointer-dereference-panic-caused-by-use-afte.patch", Size: 406 bytes --]
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 3f25b8f..871f355 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -1329,9 +1329,9 @@ static int st_open(struct inode *inode, struct file *filp)
spin_lock(&st_use_lock);
STp->in_use = 0;
spin_unlock(&st_use_lock);
- scsi_tape_put(STp);
if (resumed)
scsi_autopm_put_device(STp->device);
+ scsi_tape_put(STp);
return retval;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/9] scsi: fix host max depth checking for the 'queue_depth' sysfs interface
[not found] <1437999987-24879-1-git-send-email-stefan@sevenbyte.org>
2015-07-27 12:26 ` [PATCH 2/9] MIPS: Require O32 FP64 support for MIPS64 with O32 compat Stefan Tatschner
2015-07-27 12:26 ` [PATCH 4/9] st: null pointer dereference panic caused by use after kref_put by st_open Stefan Tatschner
@ 2015-07-27 12:26 ` Stefan Tatschner
2015-07-27 12:26 ` [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU Stefan Tatschner
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Tatschner @ 2015-07-27 12:26 UTC (permalink / raw)
To: ludwig.kuerzinger; +Cc: Jens Axboe, stable, James Bottomley
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
This is a multi-part message in MIME format.
[-- Attachment #2: Type: text/plain, Size: 817 bytes --]
Commit 1e6f2416044c0 changed the scsi sysfs 'queue_depth' code to
rejects depths higher than the scsi host template setting. But lots
of hosts set this to 1, and update the settings in the scsi host
when the controller/devices probing happens.
This breaks (at least) mpt2sas and mpt3sas runtime setting of queue
depth, returning EINVAL for all settings but '1'. And once it's set to
1, there's no way to go back up.
Cc: stable@vger.kernel.org
Fixes: 1e6f2416044c0 "scsi: don't allow setting of queue_depth bigger than can_queue"
Signed-off-by: Jens Axboe <axboe@fb.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
---
drivers/scsi/scsi_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0005-scsi-fix-host-max-depth-checking-for-the-queue_depth.patch --]
[-- Type: text/x-patch; name="0005-scsi-fix-host-max-depth-checking-for-the-queue_depth.patch", Size: 462 bytes --]
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 1ac38e7..9ad4116 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -859,7 +859,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
depth = simple_strtoul(buf, NULL, 0);
- if (depth < 1 || depth > sht->can_queue)
+ if (depth < 1 || depth > sdev->host->can_queue)
return -EINVAL;
retval = sht->change_queue_depth(sdev, depth);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU
[not found] <1437999987-24879-1-git-send-email-stefan@sevenbyte.org>
` (2 preceding siblings ...)
2015-07-27 12:26 ` [PATCH 5/9] scsi: fix host max depth checking for the 'queue_depth' sysfs interface Stefan Tatschner
@ 2015-07-27 12:26 ` Stefan Tatschner
2015-07-28 12:34 ` Ralf Baechle
3 siblings, 1 reply; 5+ messages in thread
From: Stefan Tatschner @ 2015-07-27 12:26 UTC (permalink / raw)
To: ludwig.kuerzinger; +Cc: Markos Chandras, stable, linux-mips, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
This is a multi-part message in MIME format.
[-- Attachment #2: Type: text/plain, Size: 780 bytes --]
Commit 6134d94923d0 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
added support for 64-bit FPU on a 32-bit MIPS R6 processor but it missed
the 64-bit CPU case leading to FPU failures when requesting FR=1 mode
(which is always the case for MIPS R6 userland) when running a 32-bit
kernel on a 64-bit CPU. We also fix the MIPS R2 case.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Fixes: 6134d94923d0 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
Reviewed-by: Paul Burton <paul.burton@imgtec.com>
Cc: <stable@vger.kernel.org> # 4.0+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10734/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
arch/mips/include/asm/fpu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0006-MIPS-fpu.h-Allow-64-bit-FPU-on-a-64-bit-MIPS-R6-CPU.patch --]
[-- Type: text/x-patch; name="0006-MIPS-fpu.h-Allow-64-bit-FPU-on-a-64-bit-MIPS-R6-CPU.patch", Size: 501 bytes --]
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 084780b..1b06251 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -74,7 +74,7 @@ static inline int __enable_fpu(enum fpu_mode mode)
goto fr_common;
case FPU_64BIT:
-#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS32_R6) \
+#if !(defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) \
|| defined(CONFIG_64BIT))
/* we only have a 32-bit FPU */
return SIGFPE;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU
2015-07-27 12:26 ` [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU Stefan Tatschner
@ 2015-07-28 12:34 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2015-07-28 12:34 UTC (permalink / raw)
To: Stefan Tatschner; +Cc: ludwig.kuerzinger, Markos Chandras, stable, linux-mips
Stefan,
On Mon, Jul 27, 2015 at 02:26:24PM +0200, Stefan Tatschner wrote:
> Date: Mon, 27 Jul 2015 14:26:24 +0200
> From: Stefan Tatschner <stefan@sevenbyte.org>
> To: ludwig.kuerzinger@aisec.fraunhofer.de
> Cc: Markos Chandras <markos.chandras@imgtec.com>, stable@vger.kernel.org,
> linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
> Subject: [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU
> Content-Type: multipart/mixed; boundary="------------2.4.6"
>
>
> Commit 6134d94923d0 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
> added support for 64-bit FPU on a 32-bit MIPS R6 processor but it missed
> the 64-bit CPU case leading to FPU failures when requesting FR=1 mode
> (which is always the case for MIPS R6 userland) when running a 32-bit
> kernel on a 64-bit CPU. We also fix the MIPS R2 case.
>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> Fixes: 6134d94923d0 ("MIPS: asm: fpu: Allow 64-bit FPU on MIPS32 R6")
> Reviewed-by: Paul Burton <paul.burton@imgtec.com>
> Cc: <stable@vger.kernel.org> # 4.0+
> Cc: linux-mips@linux-mips.org
> Patchwork: https://patchwork.linux-mips.org/patch/10734/
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> ---
> arch/mips/include/asm/fpu.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
> index 084780b..1b06251 100644
> --- a/arch/mips/include/asm/fpu.h
> +++ b/arch/mips/include/asm/fpu.h
> @@ -74,7 +74,7 @@ static inline int __enable_fpu(enum fpu_mode mode)
> goto fr_common;
>
> case FPU_64BIT:
> -#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS32_R6) \
> +#if !(defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) \
> || defined(CONFIG_64BIT))
> /* we only have a 32-bit FPU */
> return SIGFPE;
You seem to be reflecting patch back to the linux-mips mailing list and
other folks mentioned in patches, including myself. Please stop that.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-28 12:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1437999987-24879-1-git-send-email-stefan@sevenbyte.org>
2015-07-27 12:26 ` [PATCH 2/9] MIPS: Require O32 FP64 support for MIPS64 with O32 compat Stefan Tatschner
2015-07-27 12:26 ` [PATCH 4/9] st: null pointer dereference panic caused by use after kref_put by st_open Stefan Tatschner
2015-07-27 12:26 ` [PATCH 5/9] scsi: fix host max depth checking for the 'queue_depth' sysfs interface Stefan Tatschner
2015-07-27 12:26 ` [PATCH 6/9] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU Stefan Tatschner
2015-07-28 12:34 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).