Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.4 commit in: /
Date: Sat, 02 Aug 2014 14:43:29
Message-Id: 1406990481.6170daa192bd78ce9c1c618fdcf4acb5e0bb0c8c.mpagano@gentoo
1 commit: 6170daa192bd78ce9c1c618fdcf4acb5e0bb0c8c
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 2 14:41:21 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 2 14:41:21 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=6170daa1
7
8 Linux patch 3.4.101
9
10 ---
11 0000_README | 4 +
12 1100_linux-3.4.101.patch | 349 +++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 353 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index af7f3f3..0f65113 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -439,6 +439,10 @@ Patch: 1099_linux-3.4.100.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.4.100
22
23 +Patch: 1100_linux-3.4.101.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.4.101
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1100_linux-3.4.101.patch b/1100_linux-3.4.101.patch
32 new file mode 100644
33 index 0000000..54832f4
34 --- /dev/null
35 +++ b/1100_linux-3.4.101.patch
36 @@ -0,0 +1,349 @@
37 +diff --git a/Makefile b/Makefile
38 +index d6c64eb82525..a22bcb567348 100644
39 +--- a/Makefile
40 ++++ b/Makefile
41 +@@ -1,6 +1,6 @@
42 + VERSION = 3
43 + PATCHLEVEL = 4
44 +-SUBLEVEL = 100
45 ++SUBLEVEL = 101
46 + EXTRAVERSION =
47 + NAME = Saber-toothed Squirrel
48 +
49 +@@ -592,6 +592,8 @@ KBUILD_CFLAGS += -fomit-frame-pointer
50 + endif
51 + endif
52 +
53 ++KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
54 ++
55 + ifdef CONFIG_DEBUG_INFO
56 + KBUILD_CFLAGS += -g
57 + KBUILD_AFLAGS += -gdwarf-2
58 +diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
59 +index 02f300fbf070..e0a8707dd137 100644
60 +--- a/arch/s390/kernel/ptrace.c
61 ++++ b/arch/s390/kernel/ptrace.c
62 +@@ -292,7 +292,9 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)
63 + * psw and gprs are stored on the stack
64 + */
65 + if (addr == (addr_t) &dummy->regs.psw.mask &&
66 +- ((data & ~PSW_MASK_USER) != psw_user_bits ||
67 ++ (((data^psw_user_bits) & ~PSW_MASK_USER) ||
68 ++ (((data^psw_user_bits) & PSW_MASK_ASC) &&
69 ++ ((data|psw_user_bits) & PSW_MASK_ASC) == PSW_MASK_ASC) ||
70 + ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA))))
71 + /* Invalid psw mask. */
72 + return -EINVAL;
73 +@@ -595,7 +597,10 @@ static int __poke_user_compat(struct task_struct *child,
74 + */
75 + if (addr == (addr_t) &dummy32->regs.psw.mask) {
76 + /* Build a 64 bit psw mask from 31 bit mask. */
77 +- if ((tmp & ~PSW32_MASK_USER) != psw32_user_bits)
78 ++ if (((tmp^psw32_user_bits) & ~PSW32_MASK_USER) ||
79 ++ (((tmp^psw32_user_bits) & PSW32_MASK_ASC) &&
80 ++ ((tmp|psw32_user_bits) & PSW32_MASK_ASC)
81 ++ == PSW32_MASK_ASC))
82 + /* Invalid psw mask. */
83 + return -EINVAL;
84 + regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
85 +diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
86 +index e1e7f9c831da..e36c5cf38fde 100644
87 +--- a/arch/x86/kernel/entry_32.S
88 ++++ b/arch/x86/kernel/entry_32.S
89 +@@ -428,8 +428,8 @@ sysenter_do_call:
90 + cmpl $(NR_syscalls), %eax
91 + jae sysenter_badsys
92 + call *sys_call_table(,%eax,4)
93 +- movl %eax,PT_EAX(%esp)
94 + sysenter_after_call:
95 ++ movl %eax,PT_EAX(%esp)
96 + LOCKDEP_SYS_EXIT
97 + DISABLE_INTERRUPTS(CLBR_ANY)
98 + TRACE_IRQS_OFF
99 +@@ -510,6 +510,7 @@ ENTRY(system_call)
100 + jae syscall_badsys
101 + syscall_call:
102 + call *sys_call_table(,%eax,4)
103 ++syscall_after_call:
104 + movl %eax,PT_EAX(%esp) # store the return value
105 + syscall_exit:
106 + LOCKDEP_SYS_EXIT
107 +@@ -678,12 +679,12 @@ syscall_fault:
108 + END(syscall_fault)
109 +
110 + syscall_badsys:
111 +- movl $-ENOSYS,PT_EAX(%esp)
112 +- jmp syscall_exit
113 ++ movl $-ENOSYS,%eax
114 ++ jmp syscall_after_call
115 + END(syscall_badsys)
116 +
117 + sysenter_badsys:
118 +- movl $-ENOSYS,PT_EAX(%esp)
119 ++ movl $-ENOSYS,%eax
120 + jmp sysenter_after_call
121 + END(syscall_badsys)
122 + CFI_ENDPROC
123 +diff --git a/block/blk-tag.c b/block/blk-tag.c
124 +index 4af6f5cc1167..f606487bba56 100644
125 +--- a/block/blk-tag.c
126 ++++ b/block/blk-tag.c
127 +@@ -27,18 +27,15 @@ struct request *blk_queue_find_tag(struct request_queue *q, int tag)
128 + EXPORT_SYMBOL(blk_queue_find_tag);
129 +
130 + /**
131 +- * __blk_free_tags - release a given set of tag maintenance info
132 ++ * blk_free_tags - release a given set of tag maintenance info
133 + * @bqt: the tag map to free
134 + *
135 +- * Tries to free the specified @bqt. Returns true if it was
136 +- * actually freed and false if there are still references using it
137 ++ * Drop the reference count on @bqt and frees it when the last reference
138 ++ * is dropped.
139 + */
140 +-static int __blk_free_tags(struct blk_queue_tag *bqt)
141 ++void blk_free_tags(struct blk_queue_tag *bqt)
142 + {
143 +- int retval;
144 +-
145 +- retval = atomic_dec_and_test(&bqt->refcnt);
146 +- if (retval) {
147 ++ if (atomic_dec_and_test(&bqt->refcnt)) {
148 + BUG_ON(find_first_bit(bqt->tag_map, bqt->max_depth) <
149 + bqt->max_depth);
150 +
151 +@@ -50,9 +47,8 @@ static int __blk_free_tags(struct blk_queue_tag *bqt)
152 +
153 + kfree(bqt);
154 + }
155 +-
156 +- return retval;
157 + }
158 ++EXPORT_SYMBOL(blk_free_tags);
159 +
160 + /**
161 + * __blk_queue_free_tags - release tag maintenance info
162 +@@ -69,28 +65,13 @@ void __blk_queue_free_tags(struct request_queue *q)
163 + if (!bqt)
164 + return;
165 +
166 +- __blk_free_tags(bqt);
167 ++ blk_free_tags(bqt);
168 +
169 + q->queue_tags = NULL;
170 + queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q);
171 + }
172 +
173 + /**
174 +- * blk_free_tags - release a given set of tag maintenance info
175 +- * @bqt: the tag map to free
176 +- *
177 +- * For externally managed @bqt frees the map. Callers of this
178 +- * function must guarantee to have released all the queues that
179 +- * might have been using this tag map.
180 +- */
181 +-void blk_free_tags(struct blk_queue_tag *bqt)
182 +-{
183 +- if (unlikely(!__blk_free_tags(bqt)))
184 +- BUG();
185 +-}
186 +-EXPORT_SYMBOL(blk_free_tags);
187 +-
188 +-/**
189 + * blk_queue_free_tags - release tag maintenance info
190 + * @q: the request queue for the device
191 + *
192 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
193 +index 0e87baf8fcc2..0a450eb517e0 100644
194 +--- a/drivers/ata/ahci.c
195 ++++ b/drivers/ata/ahci.c
196 +@@ -446,6 +446,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
197 +
198 + /* Promise */
199 + { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
200 ++ { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
201 +
202 + /* Asmedia */
203 + { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
204 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
205 +index 6e67fdebdada..6b922365d5e9 100644
206 +--- a/drivers/ata/libata-core.c
207 ++++ b/drivers/ata/libata-core.c
208 +@@ -4693,6 +4693,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
209 + * ata_qc_new - Request an available ATA command, for queueing
210 + * @ap: target port
211 + *
212 ++ * Some ATA host controllers may implement a queue depth which is less
213 ++ * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond
214 ++ * the hardware limitation.
215 ++ *
216 + * LOCKING:
217 + * None.
218 + */
219 +@@ -4700,14 +4704,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
220 + static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
221 + {
222 + struct ata_queued_cmd *qc = NULL;
223 ++ unsigned int max_queue = ap->host->n_tags;
224 + unsigned int i, tag;
225 +
226 + /* no command while frozen */
227 + if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
228 + return NULL;
229 +
230 +- for (i = 0; i < ATA_MAX_QUEUE; i++) {
231 +- tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE;
232 ++ for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {
233 ++ tag = tag < max_queue ? tag : 0;
234 +
235 + /* the last tag is reserved for internal command. */
236 + if (tag == ATA_TAG_INTERNAL)
237 +@@ -5959,6 +5964,7 @@ void ata_host_init(struct ata_host *host, struct device *dev,
238 + {
239 + spin_lock_init(&host->lock);
240 + mutex_init(&host->eh_mutex);
241 ++ host->n_tags = ATA_MAX_QUEUE - 1;
242 + host->dev = dev;
243 + host->flags = flags;
244 + host->ops = ops;
245 +@@ -6041,6 +6047,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
246 + {
247 + int i, rc;
248 +
249 ++ host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1);
250 ++
251 + /* host must have been started */
252 + if (!(host->flags & ATA_HOST_STARTED)) {
253 + dev_err(host->dev, "BUG: trying to register unstarted host\n");
254 +diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
255 +index f04c0961f993..e5206fc76562 100644
256 +--- a/fs/ceph/snap.c
257 ++++ b/fs/ceph/snap.c
258 +@@ -331,7 +331,7 @@ static int build_snap_context(struct ceph_snap_realm *realm)
259 +
260 + /* alloc new snap context */
261 + err = -ENOMEM;
262 +- if (num > (ULONG_MAX - sizeof(*snapc)) / sizeof(u64))
263 ++ if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64))
264 + goto fail;
265 + snapc = kzalloc(sizeof(*snapc) + num*sizeof(u64), GFP_NOFS);
266 + if (!snapc)
267 +diff --git a/include/drm/drm_mem_util.h b/include/drm/drm_mem_util.h
268 +index 6bd325fedc87..19a240446fca 100644
269 +--- a/include/drm/drm_mem_util.h
270 ++++ b/include/drm/drm_mem_util.h
271 +@@ -31,7 +31,7 @@
272 +
273 + static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
274 + {
275 +- if (size != 0 && nmemb > ULONG_MAX / size)
276 ++ if (size != 0 && nmemb > SIZE_MAX / size)
277 + return NULL;
278 +
279 + if (size * nmemb <= PAGE_SIZE)
280 +@@ -44,7 +44,7 @@ static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
281 + /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
282 + static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
283 + {
284 +- if (size != 0 && nmemb > ULONG_MAX / size)
285 ++ if (size != 0 && nmemb > SIZE_MAX / size)
286 + return NULL;
287 +
288 + if (size * nmemb <= PAGE_SIZE)
289 +diff --git a/include/linux/kernel.h b/include/linux/kernel.h
290 +index 645231c373c8..b795ee5cd208 100644
291 +--- a/include/linux/kernel.h
292 ++++ b/include/linux/kernel.h
293 +@@ -35,6 +35,7 @@
294 + #define LLONG_MAX ((long long)(~0ULL>>1))
295 + #define LLONG_MIN (-LLONG_MAX - 1)
296 + #define ULLONG_MAX (~0ULL)
297 ++#define SIZE_MAX (~(size_t)0)
298 +
299 + #define STACK_MAGIC 0xdeadbeef
300 +
301 +diff --git a/include/linux/libata.h b/include/linux/libata.h
302 +index 50d7cb1ee947..dd16deb27dd8 100644
303 +--- a/include/linux/libata.h
304 ++++ b/include/linux/libata.h
305 +@@ -539,6 +539,7 @@ struct ata_host {
306 + struct device *dev;
307 + void __iomem * const *iomap;
308 + unsigned int n_ports;
309 ++ unsigned int n_tags; /* nr of NCQ tags */
310 + void *private_data;
311 + struct ata_port_operations *ops;
312 + unsigned long flags;
313 +diff --git a/include/linux/slab.h b/include/linux/slab.h
314 +index a595dce6b0c7..67d5d94b783a 100644
315 +--- a/include/linux/slab.h
316 ++++ b/include/linux/slab.h
317 +@@ -242,7 +242,7 @@ size_t ksize(const void *);
318 + */
319 + static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
320 + {
321 +- if (size != 0 && n > ULONG_MAX / size)
322 ++ if (size != 0 && n > SIZE_MAX / size)
323 + return NULL;
324 + return __kmalloc(n * size, flags);
325 + }
326 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
327 +index 0d4e0ad97a04..efd682099a0a 100644
328 +--- a/mm/hugetlb.c
329 ++++ b/mm/hugetlb.c
330 +@@ -2348,6 +2348,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
331 + } else {
332 + if (cow)
333 + huge_ptep_set_wrprotect(src, addr, src_pte);
334 ++ entry = huge_ptep_get(src_pte);
335 + ptepage = pte_page(entry);
336 + get_page(ptepage);
337 + page_dup_rmap(ptepage);
338 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
339 +index 45eb6217bf38..ad6ee88a3d48 100644
340 +--- a/mm/kmemleak.c
341 ++++ b/mm/kmemleak.c
342 +@@ -750,7 +750,9 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp)
343 + }
344 +
345 + spin_lock_irqsave(&object->lock, flags);
346 +- if (ptr + size > object->pointer + object->size) {
347 ++ if (size == SIZE_MAX) {
348 ++ size = object->pointer + object->size - ptr;
349 ++ } else if (ptr + size > object->pointer + object->size) {
350 + kmemleak_warn("Scan area larger than object 0x%08lx\n", ptr);
351 + dump_object_info(object);
352 + kmem_cache_free(scan_area_cache, area);
353 +diff --git a/mm/vmalloc.c b/mm/vmalloc.c
354 +index 1196c7728ede..ad9d90064a4b 100644
355 +--- a/mm/vmalloc.c
356 ++++ b/mm/vmalloc.c
357 +@@ -349,6 +349,12 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
358 + if (unlikely(!va))
359 + return ERR_PTR(-ENOMEM);
360 +
361 ++ /*
362 ++ * Only scan the relevant parts containing pointers to other objects
363 ++ * to avoid false negatives.
364 ++ */
365 ++ kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask & GFP_RECLAIM_MASK);
366 ++
367 + retry:
368 + spin_lock(&vmap_area_lock);
369 + /*
370 +@@ -1669,11 +1675,11 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
371 + insert_vmalloc_vmlist(area);
372 +
373 + /*
374 +- * A ref_count = 3 is needed because the vm_struct and vmap_area
375 +- * structures allocated in the __get_vm_area_node() function contain
376 +- * references to the virtual address of the vmalloc'ed block.
377 ++ * A ref_count = 2 is needed because vm_struct allocated in
378 ++ * __get_vm_area_node() contains a reference to the virtual address of
379 ++ * the vmalloc'ed block.
380 + */
381 +- kmemleak_alloc(addr, real_size, 3, gfp_mask);
382 ++ kmemleak_alloc(addr, real_size, 2, gfp_mask);
383 +
384 + return addr;
385 +