Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread Cyrill Gorcunov
On Tue, Sep 25, 2018 at 07:37:14PM -0400, TongZhang wrote: > I can see there are two problems, > > First: In kernel/sys.c:2117 capable(CAP_SYS_RESOURCE), seems that ns_capable > should > be used to check capability against user namespace, instead of init_user_ns. > Because a > process in a user

Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread TongZhang
I can see there are two problems, First: In kernel/sys.c:2117 capable(CAP_SYS_RESOURCE), seems that ns_capable should be used to check capability against user namespace, instead of init_user_ns. Because a process in a user namespace may call prctl system call and this should be checked agains

Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread Cyrill Gorcunov
On Tue, Sep 25, 2018 at 08:40:54PM +0200, Greg KH wrote: > > > > It is done this way on purpose. The prctl_set_mm_map is a complex call > > which carries a bunch of parameters and allowed if you're inside user-ns > > admin, > > in turn prctl_set_mm allows to modify settings one by one. So no, it

Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread Greg KH
On Tue, Sep 25, 2018 at 09:34:27PM +0300, Cyrill Gorcunov wrote: > On Tue, Sep 25, 2018 at 07:37:45PM +0200, Greg KH wrote: > > On Tue, Sep 25, 2018 at 01:26:55PM -0400, Tong Zhang wrote: > > > Kernel Version: 4.18.5 > > > > > > Problem Description: > > > > > > We discovered inconsistent check wh

Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread Cyrill Gorcunov
On Tue, Sep 25, 2018 at 07:37:45PM +0200, Greg KH wrote: > On Tue, Sep 25, 2018 at 01:26:55PM -0400, Tong Zhang wrote: > > Kernel Version: 4.18.5 > > > > Problem Description: > > > > We discovered inconsistent check when using prctl_set_mm_exe_file(), which > > is used to setup exe file link. >

Re: different capability from different namespace required for prctl_set_mm_exe_file

2018-09-25 Thread Greg KH
On Tue, Sep 25, 2018 at 01:26:55PM -0400, Tong Zhang wrote: > Kernel Version: 4.18.5 > > Problem Description: > > We discovered inconsistent check when using prctl_set_mm_exe_file(), which is > used to setup exe file link. > > It is required to have capable(CAP_SYS_RESOURCE) in prctl_set_mm().