Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mm-hotfixes-stable-2024-10-09-15-46' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
"12 hotfixes, 5 of which are c:stable. All singletons, about half of
which are MM"

* tag 'mm-hotfixes-stable-2024-10-09-15-46' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
mm: zswap: delete comments for "value" member of 'struct zswap_entry'.
CREDITS: sort alphabetically by name
secretmem: disable memfd_secret() if arch cannot set direct map
.mailmap: update Fangrui's email
mm/huge_memory: check pmd_special() only after pmd_present()
resource, kunit: fix user-after-free in resource_test_region_intersects()
fs/proc/kcore.c: allow translation of physical memory addresses
selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test
device-dax: correct pgoff align in dax_set_mapping()
kthread: unpark only parked kthread
Revert "mm: introduce PF_MEMALLOC_NORECLAIM, PF_MEMALLOC_NOWARN"
bcachefs: do not use PF_MEMALLOC_NORECLAIM

+117 -73
+1
.mailmap
··· 203 203 Faith Ekstrand <faith.ekstrand@collabora.com> <jason@jlekstrand.net> 204 204 Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@intel.com> 205 205 Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@collabora.com> 206 + Fangrui Song <i@maskray.me> <maskray@google.com> 206 207 Felipe W Damasio <felipewd@terra.com.br> 207 208 Felix Kuhling <fxkuehl@gmx.de> 208 209 Felix Moeller <felix@derklecks.de>
+27 -27
CREDITS
··· 1358 1358 D: ISDN Maintainer 1359 1359 S: USA 1360 1360 1361 - N: Gerrit Renker 1362 - E: gerrit@erg.abdn.ac.uk 1363 - D: DCCP protocol support. 1364 - 1365 1361 N: Philip Gladstone 1366 1362 E: philip@gladstonefamily.net 1367 1363 D: Kernel / timekeeping stuff ··· 1673 1677 D: bug toaster (A1 sauce makes all the difference) 1674 1678 D: Random linux hacker 1675 1679 1676 - N: James Hogan 1677 - E: jhogan@kernel.org 1678 - D: Metag architecture maintainer 1679 - D: TZ1090 SoC maintainer 1680 - 1681 1680 N: Tim Hockin 1682 1681 E: thockin@hockin.org 1683 1682 W: http://www.hockin.org/~thockin ··· 1687 1696 D: hwmon subsystem maintainer 1688 1697 D: i2c-sis96x and i2c-stub SMBus drivers 1689 1698 S: USA 1699 + 1700 + N: James Hogan 1701 + E: jhogan@kernel.org 1702 + D: Metag architecture maintainer 1703 + D: TZ1090 SoC maintainer 1690 1704 1691 1705 N: Dirk Hohndel 1692 1706 E: hohndel@suse.de ··· 1867 1871 S: K osmidomkum 723 1868 1872 S: 160 00 Praha 6 1869 1873 S: Czech Republic 1874 + 1875 + N: Seth Jennings 1876 + E: sjenning@redhat.com 1877 + D: Creation and maintenance of zswap 1870 1878 1871 1879 N: Jeremy Kerr 1872 1880 D: Maintainer of SPU File System ··· 2187 2187 N: Mike Kravetz 2188 2188 E: mike.kravetz@oracle.com 2189 2189 D: Maintenance and development of the hugetlb subsystem 2190 - 2191 - N: Seth Jennings 2192 - E: sjenning@redhat.com 2193 - D: Creation and maintenance of zswap 2194 - 2195 - N: Dan Streetman 2196 - E: ddstreet@ieee.org 2197 - D: Maintenance and development of zswap 2198 - D: Creation and maintenance of the zpool API 2199 - 2200 - N: Vitaly Wool 2201 - E: vitaly.wool@konsulko.com 2202 - D: Maintenance and development of zswap 2203 2190 2204 2191 N: Andreas S. Krebs 2205 2192 E: akrebs@altavista.net ··· 3178 3191 E: ken@halcyon.com 3179 3192 D: CDROM driver "sonycd535" (Sony CDU-535/531) 3180 3193 3194 + N: Mathieu Poirier 3195 + E: mathieu.poirier@linaro.org 3196 + D: CoreSight kernel subsystem, Maintainer 2014-2022 3197 + D: Perf tool support for CoreSight 3198 + 3181 3199 N: Stelian Pop 3182 3200 E: stelian@popies.net 3183 3201 P: 1024D/EDBB6147 7B36 0E07 04BC 11DC A7A0 D3F7 7185 9E7A EDBB 6147 ··· 3291 3299 S: Schlossbergring 9 3292 3300 S: 79098 Freiburg 3293 3301 S: Germany 3302 + 3303 + N: Gerrit Renker 3304 + E: gerrit@erg.abdn.ac.uk 3305 + D: DCCP protocol support. 3294 3306 3295 3307 N: Thomas Renninger 3296 3308 E: trenn@suse.de ··· 3572 3576 S: Oldenburg 3573 3577 S: Germany 3574 3578 3575 - N: Mathieu Poirier 3576 - E: mathieu.poirier@linaro.org 3577 - D: CoreSight kernel subsystem, Maintainer 2014-2022 3578 - D: Perf tool support for CoreSight 3579 - 3580 3579 N: Robert Schwebel 3581 3580 E: robert@schwebel.de 3582 3581 W: https://www.schwebel.de ··· 3761 3770 S: Chr. Winthersvej 1 B, st.th. 3762 3771 S: DK-1860 Frederiksberg C 3763 3772 S: Denmark 3773 + 3774 + N: Dan Streetman 3775 + E: ddstreet@ieee.org 3776 + D: Maintenance and development of zswap 3777 + D: Creation and maintenance of the zpool API 3764 3778 3765 3779 N: Drew Sullivan 3766 3780 E: drew@ss.org ··· 4281 4285 S: Pipers Way 4282 4286 S: Swindon. SN3 1RJ 4283 4287 S: England 4288 + 4289 + N: Vitaly Wool 4290 + E: vitaly.wool@konsulko.com 4291 + D: Maintenance and development of zswap 4284 4292 4285 4293 N: Chris Wright 4286 4294 E: chrisw@sous-sol.org
+2
arch/s390/include/asm/io.h
··· 16 16 #include <asm/pci_io.h> 17 17 18 18 #define xlate_dev_mem_ptr xlate_dev_mem_ptr 19 + #define kc_xlate_dev_mem_ptr xlate_dev_mem_ptr 19 20 void *xlate_dev_mem_ptr(phys_addr_t phys); 20 21 #define unxlate_dev_mem_ptr unxlate_dev_mem_ptr 22 + #define kc_unxlate_dev_mem_ptr unxlate_dev_mem_ptr 21 23 void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); 22 24 23 25 #define IO_SPACE_LIMIT 0
+1 -1
drivers/dax/device.c
··· 86 86 nr_pages = 1; 87 87 88 88 pgoff = linear_page_index(vmf->vma, 89 - ALIGN(vmf->address, fault_size)); 89 + ALIGN_DOWN(vmf->address, fault_size)); 90 90 91 91 for (i = 0; i < nr_pages; i++) { 92 92 struct page *page = pfn_to_page(pfn_t_to_pfn(pfn) + i);
+6 -8
fs/bcachefs/fs.c
··· 300 300 BUG(); 301 301 } 302 302 303 - static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c) 303 + static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c, gfp_t gfp) 304 304 { 305 305 struct bch_inode_info *inode = alloc_inode_sb(c->vfs_sb, 306 - bch2_inode_cache, GFP_NOFS); 306 + bch2_inode_cache, gfp); 307 307 if (!inode) 308 308 return NULL; 309 309 ··· 315 315 mutex_init(&inode->ei_quota_lock); 316 316 memset(&inode->ei_devs_need_flush, 0, sizeof(inode->ei_devs_need_flush)); 317 317 318 - if (unlikely(inode_init_always(c->vfs_sb, &inode->v))) { 318 + if (unlikely(inode_init_always_gfp(c->vfs_sb, &inode->v, gfp))) { 319 319 kmem_cache_free(bch2_inode_cache, inode); 320 320 return NULL; 321 321 } ··· 328 328 */ 329 329 static struct bch_inode_info *bch2_new_inode(struct btree_trans *trans) 330 330 { 331 - struct bch_inode_info *inode = 332 - memalloc_flags_do(PF_MEMALLOC_NORECLAIM|PF_MEMALLOC_NOWARN, 333 - __bch2_new_inode(trans->c)); 331 + struct bch_inode_info *inode = __bch2_new_inode(trans->c, GFP_NOWAIT); 334 332 335 333 if (unlikely(!inode)) { 336 - int ret = drop_locks_do(trans, (inode = __bch2_new_inode(trans->c)) ? 0 : -ENOMEM); 334 + int ret = drop_locks_do(trans, (inode = __bch2_new_inode(trans->c, GFP_NOFS)) ? 0 : -ENOMEM); 337 335 if (ret && inode) { 338 336 __destroy_inode(&inode->v); 339 337 kmem_cache_free(bch2_inode_cache, inode); ··· 405 407 if (ret) 406 408 return ERR_PTR(ret); 407 409 #endif 408 - inode = __bch2_new_inode(c); 410 + inode = __bch2_new_inode(c, GFP_NOFS); 409 411 if (unlikely(!inode)) { 410 412 inode = ERR_PTR(-ENOMEM); 411 413 goto err;
+6 -4
fs/inode.c
··· 146 146 } 147 147 148 148 /** 149 - * inode_init_always - perform inode structure initialisation 149 + * inode_init_always_gfp - perform inode structure initialisation 150 150 * @sb: superblock inode belongs to 151 151 * @inode: inode to initialise 152 + * @gfp: allocation flags 152 153 * 153 154 * These are initializations that need to be done on every inode 154 155 * allocation as the fields are not initialised by slab allocation. 156 + * If there are additional allocations required @gfp is used. 155 157 */ 156 - int inode_init_always(struct super_block *sb, struct inode *inode) 158 + int inode_init_always_gfp(struct super_block *sb, struct inode *inode, gfp_t gfp) 157 159 { 158 160 static const struct inode_operations empty_iops; 159 161 static const struct file_operations no_open_fops = {.open = no_open}; ··· 232 230 #endif 233 231 inode->i_flctx = NULL; 234 232 235 - if (unlikely(security_inode_alloc(inode))) 233 + if (unlikely(security_inode_alloc(inode, gfp))) 236 234 return -ENOMEM; 237 235 238 236 this_cpu_inc(nr_inodes); 239 237 240 238 return 0; 241 239 } 242 - EXPORT_SYMBOL(inode_init_always); 240 + EXPORT_SYMBOL(inode_init_always_gfp); 243 241 244 242 void free_inode_nonrcu(struct inode *inode) 245 243 {
+34 -2
fs/proc/kcore.c
··· 50 50 #define kc_offset_to_vaddr(o) ((o) + PAGE_OFFSET) 51 51 #endif 52 52 53 + #ifndef kc_xlate_dev_mem_ptr 54 + #define kc_xlate_dev_mem_ptr kc_xlate_dev_mem_ptr 55 + static inline void *kc_xlate_dev_mem_ptr(phys_addr_t phys) 56 + { 57 + return __va(phys); 58 + } 59 + #endif 60 + #ifndef kc_unxlate_dev_mem_ptr 61 + #define kc_unxlate_dev_mem_ptr kc_unxlate_dev_mem_ptr 62 + static inline void kc_unxlate_dev_mem_ptr(phys_addr_t phys, void *virt) 63 + { 64 + } 65 + #endif 66 + 53 67 static LIST_HEAD(kclist_head); 54 68 static DECLARE_RWSEM(kclist_lock); 55 69 static int kcore_need_update = 1; ··· 485 471 while (buflen) { 486 472 struct page *page; 487 473 unsigned long pfn; 474 + phys_addr_t phys; 475 + void *__start; 488 476 489 477 /* 490 478 * If this is the first iteration or the address is not within ··· 553 537 } 554 538 break; 555 539 case KCORE_RAM: 556 - pfn = __pa(start) >> PAGE_SHIFT; 540 + phys = __pa(start); 541 + pfn = phys >> PAGE_SHIFT; 557 542 page = pfn_to_online_page(pfn); 558 543 559 544 /* ··· 574 557 fallthrough; 575 558 case KCORE_VMEMMAP: 576 559 case KCORE_TEXT: 560 + if (m->type == KCORE_RAM) { 561 + __start = kc_xlate_dev_mem_ptr(phys); 562 + if (!__start) { 563 + ret = -ENOMEM; 564 + if (iov_iter_zero(tsz, iter) != tsz) 565 + ret = -EFAULT; 566 + goto out; 567 + } 568 + } else { 569 + __start = (void *)start; 570 + } 571 + 577 572 /* 578 573 * Sadly we must use a bounce buffer here to be able to 579 574 * make use of copy_from_kernel_nofault(), as these 580 575 * memory regions might not always be mapped on all 581 576 * architectures. 582 577 */ 583 - if (copy_from_kernel_nofault(buf, (void *)start, tsz)) { 578 + ret = copy_from_kernel_nofault(buf, __start, tsz); 579 + if (m->type == KCORE_RAM) 580 + kc_unxlate_dev_mem_ptr(phys, __start); 581 + if (ret) { 584 582 if (iov_iter_zero(tsz, iter) != tsz) { 585 583 ret = -EFAULT; 586 584 goto out;
+6 -1
include/linux/fs.h
··· 3082 3082 3083 3083 extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence); 3084 3084 3085 - extern int inode_init_always(struct super_block *, struct inode *); 3085 + extern int inode_init_always_gfp(struct super_block *, struct inode *, gfp_t); 3086 + static inline int inode_init_always(struct super_block *sb, struct inode *inode) 3087 + { 3088 + return inode_init_always_gfp(sb, inode, GFP_NOFS); 3089 + } 3090 + 3086 3091 extern void inode_init_once(struct inode *); 3087 3092 extern void address_space_init_once(struct address_space *mapping); 3088 3093 extern struct inode * igrab(struct inode *);
+2 -2
include/linux/sched.h
··· 1681 1681 * I am cleaning dirty pages from some other bdi. */ 1682 1682 #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 1683 1683 #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ 1684 - #define PF_MEMALLOC_NORECLAIM 0x00800000 /* All allocation requests will clear __GFP_DIRECT_RECLAIM */ 1685 - #define PF_MEMALLOC_NOWARN 0x01000000 /* All allocation requests will inherit __GFP_NOWARN */ 1684 + #define PF__HOLE__00800000 0x00800000 1685 + #define PF__HOLE__01000000 0x01000000 1686 1686 #define PF__HOLE__02000000 0x02000000 1687 1687 #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ 1688 1688 #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
+4 -13
include/linux/sched/mm.h
··· 251 251 { 252 252 unsigned int pflags = READ_ONCE(current->flags); 253 253 254 - if (unlikely(pflags & (PF_MEMALLOC_NOIO | 255 - PF_MEMALLOC_NOFS | 256 - PF_MEMALLOC_NORECLAIM | 257 - PF_MEMALLOC_NOWARN | 258 - PF_MEMALLOC_PIN))) { 254 + if (unlikely(pflags & (PF_MEMALLOC_NOIO | PF_MEMALLOC_NOFS | PF_MEMALLOC_PIN))) { 259 255 /* 260 - * Stronger flags before weaker flags: 261 - * NORECLAIM implies NOIO, which in turn implies NOFS 256 + * NOIO implies both NOIO and NOFS and it is a weaker context 257 + * so always make sure it makes precedence 262 258 */ 263 - if (pflags & PF_MEMALLOC_NORECLAIM) 264 - flags &= ~__GFP_DIRECT_RECLAIM; 265 - else if (pflags & PF_MEMALLOC_NOIO) 259 + if (pflags & PF_MEMALLOC_NOIO) 266 260 flags &= ~(__GFP_IO | __GFP_FS); 267 261 else if (pflags & PF_MEMALLOC_NOFS) 268 262 flags &= ~__GFP_FS; 269 - 270 - if (pflags & PF_MEMALLOC_NOWARN) 271 - flags |= __GFP_NOWARN; 272 263 273 264 if (pflags & PF_MEMALLOC_PIN) 274 265 flags &= ~__GFP_MOVABLE;
+2 -2
include/linux/security.h
··· 348 348 struct cred *new); 349 349 int security_path_notify(const struct path *path, u64 mask, 350 350 unsigned int obj_type); 351 - int security_inode_alloc(struct inode *inode); 351 + int security_inode_alloc(struct inode *inode, gfp_t gfp); 352 352 void security_inode_free(struct inode *inode); 353 353 int security_inode_init_security(struct inode *inode, struct inode *dir, 354 354 const struct qstr *qstr, ··· 789 789 return 0; 790 790 } 791 791 792 - static inline int security_inode_alloc(struct inode *inode) 792 + static inline int security_inode_alloc(struct inode *inode, gfp_t gfp) 793 793 { 794 794 return 0; 795 795 }
+2
kernel/kthread.c
··· 623 623 { 624 624 struct kthread *kthread = to_kthread(k); 625 625 626 + if (!test_bit(KTHREAD_SHOULD_PARK, &kthread->flags)) 627 + return; 626 628 /* 627 629 * Newly created kthread was parked when the CPU was offline. 628 630 * The binding was lost and we need to set it again.
+14 -4
kernel/resource_kunit.c
··· 169 169 #define RES_TEST_RAM3_SIZE SZ_1M 170 170 #define RES_TEST_TOTAL_SIZE ((RES_TEST_WIN1_OFFSET + RES_TEST_WIN1_SIZE)) 171 171 172 + KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *); 173 + 172 174 static void remove_free_resource(void *ctx) 173 175 { 174 176 struct resource *res = (struct resource *)ctx; 175 177 176 178 remove_resource(res); 177 179 kfree(res); 180 + } 181 + 182 + static void resource_test_add_action_or_abort( 183 + struct kunit *test, void (*action)(void *), void *ctx) 184 + { 185 + KUNIT_ASSERT_EQ_MSG(test, 0, 186 + kunit_add_action_or_reset(test, action, ctx), 187 + "Fail to add action"); 178 188 } 179 189 180 190 static void resource_test_request_region(struct kunit *test, struct resource *parent, ··· 195 185 196 186 res = __request_region(parent, start, size, name, flags); 197 187 KUNIT_ASSERT_NOT_NULL(test, res); 198 - kunit_add_action_or_reset(test, remove_free_resource, res); 188 + resource_test_add_action_or_abort(test, remove_free_resource, res); 199 189 } 200 190 201 191 static void resource_test_insert_resource(struct kunit *test, struct resource *parent, ··· 212 202 res->end = start + size - 1; 213 203 res->flags = flags; 214 204 if (insert_resource(parent, res)) { 215 - kfree(res); 205 + resource_test_add_action_or_abort(test, kfree_wrapper, res); 216 206 KUNIT_FAIL_AND_ABORT(test, "Fail to insert resource %pR\n", res); 217 207 } 218 208 219 - kunit_add_action_or_reset(test, remove_free_resource, res); 209 + resource_test_add_action_or_abort(test, remove_free_resource, res); 220 210 } 221 211 222 212 static void resource_test_region_intersects(struct kunit *test) ··· 230 220 "test resources"); 231 221 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); 232 222 start = parent->start; 233 - kunit_add_action_or_reset(test, remove_free_resource, parent); 223 + resource_test_add_action_or_abort(test, remove_free_resource, parent); 234 224 235 225 resource_test_request_region(test, parent, start + RES_TEST_RAM0_OFFSET, 236 226 RES_TEST_RAM0_SIZE, "Test System RAM 0", flags);
+1 -1
mm/huge_memory.c
··· 1586 1586 int ret = -ENOMEM; 1587 1587 1588 1588 pmd = pmdp_get_lockless(src_pmd); 1589 - if (unlikely(pmd_special(pmd))) { 1589 + if (unlikely(pmd_present(pmd) && pmd_special(pmd))) { 1590 1590 dst_ptl = pmd_lock(dst_mm, dst_pmd); 1591 1591 src_ptl = pmd_lockptr(src_mm, src_pmd); 1592 1592 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
+2 -2
mm/secretmem.c
··· 238 238 /* make sure local flags do not confict with global fcntl.h */ 239 239 BUILD_BUG_ON(SECRETMEM_FLAGS_MASK & O_CLOEXEC); 240 240 241 - if (!secretmem_enable) 241 + if (!secretmem_enable || !can_set_direct_map()) 242 242 return -ENOSYS; 243 243 244 244 if (flags & ~(SECRETMEM_FLAGS_MASK | O_CLOEXEC)) ··· 280 280 281 281 static int __init secretmem_init(void) 282 282 { 283 - if (!secretmem_enable) 283 + if (!secretmem_enable || !can_set_direct_map()) 284 284 return 0; 285 285 286 286 secretmem_mnt = kern_mount(&secretmem_fs);
-1
mm/zswap.c
··· 190 190 * section for context. 191 191 * pool - the zswap_pool the entry's data is in 192 192 * handle - zpool allocation handle that stores the compressed page data 193 - * value - value of the same-value filled pages which have same content 194 193 * objcg - the obj_cgroup that the compressed memory is charged to 195 194 * lru - handle to the pool's lru used to evict pages. 196 195 */
+6 -4
security/security.c
··· 740 740 /** 741 741 * lsm_inode_alloc - allocate a composite inode blob 742 742 * @inode: the inode that needs a blob 743 + * @gfp: allocation flags 743 744 * 744 745 * Allocate the inode blob for all the modules 745 746 * 746 747 * Returns 0, or -ENOMEM if memory can't be allocated. 747 748 */ 748 - static int lsm_inode_alloc(struct inode *inode) 749 + static int lsm_inode_alloc(struct inode *inode, gfp_t gfp) 749 750 { 750 751 if (!lsm_inode_cache) { 751 752 inode->i_security = NULL; 752 753 return 0; 753 754 } 754 755 755 - inode->i_security = kmem_cache_zalloc(lsm_inode_cache, GFP_NOFS); 756 + inode->i_security = kmem_cache_zalloc(lsm_inode_cache, gfp); 756 757 if (inode->i_security == NULL) 757 758 return -ENOMEM; 758 759 return 0; ··· 1679 1678 /** 1680 1679 * security_inode_alloc() - Allocate an inode LSM blob 1681 1680 * @inode: the inode 1681 + * @gfp: allocation flags 1682 1682 * 1683 1683 * Allocate and attach a security structure to @inode->i_security. The 1684 1684 * i_security field is initialized to NULL when the inode structure is ··· 1687 1685 * 1688 1686 * Return: Return 0 if operation was successful. 1689 1687 */ 1690 - int security_inode_alloc(struct inode *inode) 1688 + int security_inode_alloc(struct inode *inode, gfp_t gfp) 1691 1689 { 1692 - int rc = lsm_inode_alloc(inode); 1690 + int rc = lsm_inode_alloc(inode, gfp); 1693 1691 1694 1692 if (unlikely(rc)) 1695 1693 return rc;
+1 -1
tools/testing/selftests/mm/hmm-tests.c
··· 1657 1657 1658 1658 buffer->fd = -1; 1659 1659 buffer->size = size; 1660 - buffer->mirror = malloc(npages); 1660 + buffer->mirror = malloc(size); 1661 1661 ASSERT_NE(buffer->mirror, NULL); 1662 1662 1663 1663 /* Reserve a range of addresses. */