Skip to contentSkip to conversation

prctl: Deprecate non PR_SET_MM_MAP operations

RFC In review Cyrill Gorcunov 3 participants 6 messages Apr 3, 2018 – Apr 4, 2018

lore
Share & tools
lore
#0 lore raw

RFC 1/1 prctl: Deprecate non PR_SET_MM_MAP operations

An ability to manipulate mm_struct fields was introduced in sake of CRIU in first place. Later we provide more suitable and safe operation PR_SET_MM_MAP where all fields to be modifed are passed in one structure which allows us to make more detailed verification.

Still old interface remains present for compatibility reason though CRIU itself already switched to PR_SET_MM_MAP on its own long ago.

Googling didn't reveal some other users of this operation so I think it should be safe to issue deprecation warning first time and get rid of this interface after a couple of releases.

CC Andrey Vagin <[email protected]>
CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Michael Kerrisk <[email protected]>
CC Yang Shi <[email protected]>
CC Michal Hocko <[email protected]>

---
Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that asap.

 kernel/sys.c |    2 ++
 1 file changed, 2 insertions(+)
kernel/sys.c +2 -0
Index: linux-ml.git/kernel/sys.c
===================================================================
@@ -2052,6 +2052,8 @@ static int prctl_set_mm(int opt, unsigne
 	if (!capable(CAP_SYS_RESOURCE))
 		return -EPERM;
 
+	pr_warn_once("Non PR_SET_MM_MAP operations are deprecated\n");
+
 	if (opt == PR_SET_MM_EXE_FILE)
 		return prctl_set_mm_exe_file(mm, (unsigned int)addr);
 
#1 lore raw
Quoted 22 lines · Cyrill Gorcunov

An ability to manipulate mm_struct fields was introduced in sake of CRIU in first place. Later we provide more suitable and safe operation PR_SET_MM_MAP where all fields to be modifed are passed in one structure which allows us to make more detailed verification.

Still old interface remains present for compatibility reason though CRIU itself already switched to PR_SET_MM_MAP on its own long ago.

Googling didn't reveal some other users of this operation so I think it should be safe to issue deprecation warning first time and get rid of this interface after a couple of releases.

CC Andrey Vagin <[email protected]>
CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Michael Kerrisk <[email protected]>
CC Yang Shi <[email protected]>
CC Michal Hocko <[email protected]>
Quoted 3 lines

---
Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that asap.

Thanks for making it deprecated. I'd prefer just drop it off if nobody objects. The change will get soaked in linux-next for a while , we will know if it breaks compatibility (it sounds very unlikely).

Yang

Quoted 17 lines
  kernel/sys.c |    2 ++
  1 file changed, 2 insertions(+)

Index: linux-ml.git/kernel/sys.c
===================================================================

kernel/sys.c +2 -0
@@ -2052,6 +2052,8 @@ static int prctl_set_mm(int opt, unsigne
  	if (!capable(CAP_SYS_RESOURCE))
  		return -EPERM;
 
+	pr_warn_once("Non PR_SET_MM_MAP operations are deprecated\n");
+
  	if (opt == PR_SET_MM_EXE_FILE)
  		return prctl_set_mm_exe_file(mm, (unsigned int)addr);
 
Acked-by
#2 lore raw
Quoted 29 lines · Yang Shi
Quoted 22 lines · Cyrill Gorcunov

An ability to manipulate mm_struct fields was introduced in sake of CRIU in first place. Later we provide more suitable and safe operation PR_SET_MM_MAP where all fields to be modifed are passed in one structure which allows us to make more detailed verification.

Still old interface remains present for compatibility reason though CRIU itself already switched to PR_SET_MM_MAP on its own long ago.

Googling didn't reveal some other users of this operation so I think it should be safe to issue deprecation warning first time and get rid of this interface after a couple of releases.

CC Andrey Vagin <[email protected]>
CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Michael Kerrisk <[email protected]>
CC Yang Shi <[email protected]>
CC Michal Hocko <[email protected]>
Quoted 3 lines

---
Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that asap.

Quoted 3 lines

Thanks for making it deprecated. I'd prefer just drop it off if nobody objects. The change will get soaked in linux-next for a while , we will know if it breaks compatibility (it sounds very unlikely).

Yeah, let's just drop it and have the patch in linux-next (via mmotm) for 2 release cycles and see whether somebody complains.

You can add

for such a patch.

Signature · 2 lines
Michal Hocko
SUSE Labs
#3 lore raw
Quoted 7 lines · Michal Hocko
Quoted 6 lines
Quoted 2 lines

Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that asap.

Thanks for making it deprecated. I'd prefer just drop it off if nobody objects. The change will get soaked in linux-next for a while , we will know if it breaks compatibility (it sounds very unlikely).

Quoted 6 lines

Yeah, let's just drop it and have the patch in linux-next (via mmotm) for 2 release cycles and see whether somebody complains.

You can add

for such a patch.

Sure. Thanks!

#4 lore raw
In reply to Michal Hocko
Quoted 28 lines · Michal Hocko
Quoted 27 lines · Yang Shi
Quoted 25 lines · Cyrill Gorcunov

An ability to manipulate mm_struct fields was introduced in sake of CRIU in first place. Later we provide more suitable and safe operation PR_SET_MM_MAP where all fields to be modifed are passed in one structure which allows us to make more detailed verification.

Still old interface remains present for compatibility reason though CRIU itself already switched to PR_SET_MM_MAP on its own long ago.

Googling didn't reveal some other users of this operation so I think it should be safe to issue deprecation warning first time and get rid of this interface after a couple of releases.

CC Andrey Vagin <[email protected]>
CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Michael Kerrisk <[email protected]>
CC Yang Shi <[email protected]>
CC Michal Hocko <[email protected]>

---
Or we can simply drop it off because PR_SET_MM_MAP covers all needs, and I would rather prefer to do that asap.

Quoted 5 lines
Quoted 3 lines

Thanks for making it deprecated. I'd prefer just drop it off if nobody objects. The change will get soaked in linux-next for a while , we will know if it breaks compatibility (it sounds very unlikely).

Yeah, let's just drop it and have the patch in linux-next (via mmotm) for 2 release cycles and see whether somebody complains.

BTW, I will do my v3 on top of the patch (drop off prctl_set_mm).

Yang

Quoted 4 lines

You can add

for such a patch.

#5 lore raw
Quoted 4 lines · Yang Shi
Quoted 2 lines

Yeah, let's just drop it and have the patch in linux-next (via mmotm) for 2 release cycles and see whether somebody complains.

BTW, I will do my v3 on top of the patch (drop off prctl_set_mm).

Sorry for delay, will do in a couple of hours.