Skip to content

Commit b1a6274

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Pull updates from Andrew Morton: "A few fixes and stragglers. Subsystems affected by this patch series: mm/memory-failure, ocfs2, lib/lzo, misc" * emailed patches from Andrew Morton <[email protected]>: amdgpu: a NULL ->mm does not mean a thread is a kthread lib/lzo: fix ambiguous encoding bug in lzo-rle ocfs2: fix build failure when TCP/IP is disabled mm/memory-failure: send SIGBUS(BUS_MCEERR_AR) only to current thread mm/memory-failure: prioritize prctl(PR_MCE_KILL) over vm.memory_failure_early_kill
2 parents b961f8d + 8449d15 commit b1a6274

File tree

5 files changed

+47
-21
lines changed

5 files changed

+47
-21
lines changed

Documentation/lzo.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,15 @@ Byte sequences
159159
distance = 16384 + (H << 14) + D
160160
state = S (copy S literals after this block)
161161
End of stream is reached if distance == 16384
162+
In version 1 only, to prevent ambiguity with the RLE case when
163+
((distance & 0x803f) == 0x803f) && (261 <= length <= 264), the
164+
compressor must not emit block copies where distance and length
165+
meet these conditions.
162166

163167
In version 1 only, this instruction is also used to encode a run of
164-
zeros if distance = 0xbfff, i.e. H = 1 and the D bits are all 1.
168+
zeros if distance = 0xbfff, i.e. H = 1 and the D bits are all 1.
165169
In this case, it is followed by a fourth byte, X.
166-
run length = ((X << 3) | (0 0 0 0 0 L L L)) + 4.
170+
run length = ((X << 3) | (0 0 0 0 0 L L L)) + 4
167171

168172
0 0 1 L L L L L (32..63)
169173
Copy of small block within 16kB distance (preferably less than 34B)

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s
196196
pagefault_disable(); \
197197
if ((mmptr) == current->mm) { \
198198
valid = !get_user((dst), (wptr)); \
199-
} else if (current->mm == NULL) { \
199+
} else if (current->flags & PF_KTHREAD) { \
200200
kthread_use_mm(mmptr); \
201201
valid = !get_user((dst), (wptr)); \
202202
kthread_unuse_mm(mmptr); \

fs/ocfs2/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config OCFS2_FS
33
tristate "OCFS2 file system support"
4-
depends on NET && SYSFS && CONFIGFS_FS
4+
depends on INET && SYSFS && CONFIGFS_FS
55
select JBD2
66
select CRC32
77
select QUOTA

lib/lzo/lzo1x_compress.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,19 @@ lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
268268
*op++ = (M4_MARKER | ((m_off >> 11) & 8)
269269
| (m_len - 2));
270270
else {
271+
if (unlikely(((m_off & 0x403f) == 0x403f)
272+
&& (m_len >= 261)
273+
&& (m_len <= 264))
274+
&& likely(bitstream_version)) {
275+
// Under lzo-rle, block copies
276+
// for 261 <= length <= 264 and
277+
// (distance & 0x80f3) == 0x80f3
278+
// can result in ambiguous
279+
// output. Adjust length
280+
// to 260 to prevent ambiguity.
281+
ip -= m_len - 260;
282+
m_len = 260;
283+
}
271284
m_len -= M4_MAX_LEN;
272285
*op++ = (M4_MARKER | ((m_off >> 11) & 8));
273286
while (unlikely(m_len > 255)) {

mm/memory-failure.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,13 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
212212
short addr_lsb = tk->size_shift;
213213
int ret = 0;
214214

215-
if ((t->mm == current->mm) || !(flags & MF_ACTION_REQUIRED))
216-
pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n",
215+
pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n",
217216
pfn, t->comm, t->pid);
218217

219218
if (flags & MF_ACTION_REQUIRED) {
220-
if (t->mm == current->mm)
221-
ret = force_sig_mceerr(BUS_MCEERR_AR,
219+
WARN_ON_ONCE(t != current);
220+
ret = force_sig_mceerr(BUS_MCEERR_AR,
222221
(void __user *)tk->addr, addr_lsb);
223-
/* send no signal to non-current processes */
224222
} else {
225223
/*
226224
* Don't use force here, it's convenient if the signal
@@ -402,9 +400,15 @@ static struct task_struct *find_early_kill_thread(struct task_struct *tsk)
402400
{
403401
struct task_struct *t;
404402

405-
for_each_thread(tsk, t)
406-
if ((t->flags & PF_MCE_PROCESS) && (t->flags & PF_MCE_EARLY))
407-
return t;
403+
for_each_thread(tsk, t) {
404+
if (t->flags & PF_MCE_PROCESS) {
405+
if (t->flags & PF_MCE_EARLY)
406+
return t;
407+
} else {
408+
if (sysctl_memory_failure_early_kill)
409+
return t;
410+
}
411+
}
408412
return NULL;
409413
}
410414

@@ -413,21 +417,26 @@ static struct task_struct *find_early_kill_thread(struct task_struct *tsk)
413417
* to be signaled when some page under the process is hwpoisoned.
414418
* Return task_struct of the dedicated thread (main thread unless explicitly
415419
* specified) if the process is "early kill," and otherwise returns NULL.
420+
*
421+
* Note that the above is true for Action Optional case, but not for Action
422+
* Required case where SIGBUS should sent only to the current thread.
416423
*/
417424
static struct task_struct *task_early_kill(struct task_struct *tsk,
418425
int force_early)
419426
{
420-
struct task_struct *t;
421427
if (!tsk->mm)
422428
return NULL;
423-
if (force_early)
424-
return tsk;
425-
t = find_early_kill_thread(tsk);
426-
if (t)
427-
return t;
428-
if (sysctl_memory_failure_early_kill)
429-
return tsk;
430-
return NULL;
429+
if (force_early) {
430+
/*
431+
* Comparing ->mm here because current task might represent
432+
* a subthread, while tsk always points to the main thread.
433+
*/
434+
if (tsk->mm == current->mm)
435+
return current;
436+
else
437+
return NULL;
438+
}
439+
return find_early_kill_thread(tsk);
431440
}
432441

433442
/*

0 commit comments

Comments
 (0)