exec.c (38713c6028a3172c4c256512c3fbcfc799fe2d43) | exec.c (bd74fdaea146029e4fa12c6de89adbe0779348a9) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/fs/exec.c 4 * 5 * Copyright (C) 1991, 1992 Linus Torvalds 6 */ 7 8/* --- 51 unchanged lines hidden (view full) --- 60#include <linux/fsnotify.h> 61#include <linux/fs_struct.h> 62#include <linux/oom.h> 63#include <linux/compat.h> 64#include <linux/vmalloc.h> 65#include <linux/io_uring.h> 66#include <linux/syscall_user_dispatch.h> 67#include <linux/coredump.h> | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/fs/exec.c 4 * 5 * Copyright (C) 1991, 1992 Linus Torvalds 6 */ 7 8/* --- 51 unchanged lines hidden (view full) --- 60#include <linux/fsnotify.h> 61#include <linux/fs_struct.h> 62#include <linux/oom.h> 63#include <linux/compat.h> 64#include <linux/vmalloc.h> 65#include <linux/io_uring.h> 66#include <linux/syscall_user_dispatch.h> 67#include <linux/coredump.h> |
68#include <linux/time_namespace.h> |
|
68 69#include <linux/uaccess.h> 70#include <asm/mmu_context.h> 71#include <asm/tlb.h> 72 73#include <trace/events/task.h> 74#include "internal.h" 75 --- 897 unchanged lines hidden (view full) --- 973 * Maps the mm_struct mm into the current task struct. 974 * On success, this function returns with exec_update_lock 975 * held for writing. 976 */ 977static int exec_mmap(struct mm_struct *mm) 978{ 979 struct task_struct *tsk; 980 struct mm_struct *old_mm, *active_mm; | 69 70#include <linux/uaccess.h> 71#include <asm/mmu_context.h> 72#include <asm/tlb.h> 73 74#include <trace/events/task.h> 75#include "internal.h" 76 --- 897 unchanged lines hidden (view full) --- 974 * Maps the mm_struct mm into the current task struct. 975 * On success, this function returns with exec_update_lock 976 * held for writing. 977 */ 978static int exec_mmap(struct mm_struct *mm) 979{ 980 struct task_struct *tsk; 981 struct mm_struct *old_mm, *active_mm; |
982 bool vfork; |
|
981 int ret; 982 983 /* Notify parent that we're no longer interested in the old VM */ 984 tsk = current; | 983 int ret; 984 985 /* Notify parent that we're no longer interested in the old VM */ 986 tsk = current; |
987 vfork = !!tsk->vfork_done; |
|
985 old_mm = current->mm; 986 exec_mm_release(tsk, old_mm); 987 if (old_mm) 988 sync_mm_rss(old_mm); 989 990 ret = down_write_killable(&tsk->signal->exec_update_lock); 991 if (ret) 992 return ret; --- 13 unchanged lines hidden (view full) --- 1006 1007 task_lock(tsk); 1008 membarrier_exec_mmap(mm); 1009 1010 local_irq_disable(); 1011 active_mm = tsk->active_mm; 1012 tsk->active_mm = mm; 1013 tsk->mm = mm; | 988 old_mm = current->mm; 989 exec_mm_release(tsk, old_mm); 990 if (old_mm) 991 sync_mm_rss(old_mm); 992 993 ret = down_write_killable(&tsk->signal->exec_update_lock); 994 if (ret) 995 return ret; --- 13 unchanged lines hidden (view full) --- 1009 1010 task_lock(tsk); 1011 membarrier_exec_mmap(mm); 1012 1013 local_irq_disable(); 1014 active_mm = tsk->active_mm; 1015 tsk->active_mm = mm; 1016 tsk->mm = mm; |
1017 lru_gen_add_mm(mm); |
|
1014 /* 1015 * This prevents preemption while active_mm is being loaded and 1016 * it and mm are being updated, which could cause problems for 1017 * lazy tlb mm refcounting when these are updated by context 1018 * switches. Not all architectures can handle irqs off over 1019 * activate_mm yet. 1020 */ 1021 if (!IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM)) 1022 local_irq_enable(); 1023 activate_mm(active_mm, mm); 1024 if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM)) 1025 local_irq_enable(); 1026 tsk->mm->vmacache_seqnum = 0; 1027 vmacache_flush(tsk); 1028 task_unlock(tsk); | 1018 /* 1019 * This prevents preemption while active_mm is being loaded and 1020 * it and mm are being updated, which could cause problems for 1021 * lazy tlb mm refcounting when these are updated by context 1022 * switches. Not all architectures can handle irqs off over 1023 * activate_mm yet. 1024 */ 1025 if (!IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM)) 1026 local_irq_enable(); 1027 activate_mm(active_mm, mm); 1028 if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM)) 1029 local_irq_enable(); 1030 tsk->mm->vmacache_seqnum = 0; 1031 vmacache_flush(tsk); 1032 task_unlock(tsk); |
1033 lru_gen_use_mm(mm); 1034 1035 if (vfork) 1036 timens_on_fork(tsk->nsproxy, tsk); 1037 |
|
1029 if (old_mm) { 1030 mmap_read_unlock(old_mm); 1031 BUG_ON(active_mm != old_mm); 1032 setmax_mm_hiwater_rss(&tsk->signal->maxrss, old_mm); 1033 mm_update_next_owner(old_mm); 1034 mmput(old_mm); 1035 return 0; 1036 } --- 1122 unchanged lines hidden --- | 1038 if (old_mm) { 1039 mmap_read_unlock(old_mm); 1040 BUG_ON(active_mm != old_mm); 1041 setmax_mm_hiwater_rss(&tsk->signal->maxrss, old_mm); 1042 mm_update_next_owner(old_mm); 1043 mmput(old_mm); 1044 return 0; 1045 } --- 1122 unchanged lines hidden --- |