Bug 41283 - kernel.userns_restrict regression
Summary: kernel.userns_restrict regression
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: kernel-image-std-def (show other bugs)
Version: unstable
Hardware: all Linux
: P5 blocker
Assignee: Vitaly Chikunov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-03 13:41 MSK by Dmitry V. Levin
Modified: 2021-11-11 14:52 MSK (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry V. Levin 2021-11-03 13:41:54 MSK
kernel.userns_restrict default changed silently from 1 to 0, making the system open to all kinds of userns attacks by unprivileged users.
Comment 1 Gleb F-Malinovskiy 2021-11-03 13:47:10 MSK
(In reply to Dmitry V. Levin from comment #0)
> kernel.userns_restrict default changed silently from 1 to 0, making the
> system open to all kinds of userns attacks by unprivileged users.

It changed for std-def kernel during 5.4 -> 5.10 update, for un-def 5.7 -> 5.8.
Comment 2 Anton V. Boyarshinov 2021-11-09 10:06:09 MSK
Ooops...
To be fixed today
Comment 3 Anton V. Boyarshinov 2021-11-09 10:12:51 MSK
it was a fault using git rebase. I've reprodused it :(
Comment 4 Repository Robot 2021-11-09 19:02:41 MSK
kernel-image-std-def-2:5.10.78-alt2 -> sisyphus:

 Tue Nov 09 2021 Kernel Bot <kernelbot@altlinux> 2:5.10.78-alt2
 - CLONE_USERNS default restriction restored (Closes: 41283)
 - NVME fix for TF307-MB-S-D (Closes: 40718)
 - use VIRT_CPU_ACCOUNTING_NATIVE instead of TICK_CPU_ACCOUNTING
Comment 5 Andrew Vasilyev 2021-11-09 22:25:54 MSK
  А в un-def не нужно?

andy@andy:((kernel-image-un-def-5.14.17-alt1-0-g03720ea10a8a))$ gg sysctl_userns_restrict
...
kernel/user_namespace.c:int sysctl_userns_restrict __read_mostly;
Comment 6 Anton V. Boyarshinov 2021-11-10 11:31:21 MSK
(Ответ для Andrew Vasilyev на комментарий #5)
>   А в un-def не нужно?
> 
> andy@andy:((kernel-image-un-def-5.14.17-alt1-0-g03720ea10a8a))$ gg
> sysctl_userns_restrict
> ...
> kernel/user_namespace.c:int sysctl_userns_restrict __read_mostly;

Конечно, нужно. В git я уже поменял, но хотел дождаться сборки std-def и определённости -- помогла ли эта сборка с проблемами учёта времени (это не связанная проблема, но исправлялась той же сборкой).
Comment 7 Dmitry V. Levin 2021-11-11 03:04:00 MSK
(In reply to Repository Robot from comment #4)
> kernel-image-std-def-2:5.10.78-alt2 -> sisyphus:
> 
>  Tue Nov 09 2021 Kernel Bot <kernelbot@altlinux> 2:5.10.78-alt2
>  - CLONE_USERNS default restriction restored (Closes: 41283)
>  - NVME fix for TF307-MB-S-D (Closes: 40718)
>  - use VIRT_CPU_ACCOUNTING_NATIVE instead of TICK_CPU_ACCOUNTING

Попытка заменить TICK_CPU_ACCOUNTING на что-нибудь приличное не нашла отражение в /proc/config.gz:
-# Linux/x86_64 5.10.76-std-def-alt1 Kernel Configuration
+# Linux/x86_64 5.10.78-std-def-alt2 Kernel Configuration

Видимо, VIRT_CPU_ACCOUNTING_NATIVE на x86_64 нет, и это делается как-то иначе.
Comment 8 Anton V. Boyarshinov 2021-11-11 14:52:07 MSK
(Ответ для Dmitry V. Levin на комментарий #7)
> (In reply to Repository Robot from comment #4)
> > kernel-image-std-def-2:5.10.78-alt2 -> sisyphus:
> > 
> >  Tue Nov 09 2021 Kernel Bot <kernelbot@altlinux> 2:5.10.78-alt2
> >  - CLONE_USERNS default restriction restored (Closes: 41283)
> >  - NVME fix for TF307-MB-S-D (Closes: 40718)
> >  - use VIRT_CPU_ACCOUNTING_NATIVE instead of TICK_CPU_ACCOUNTING
> 
> Попытка заменить TICK_CPU_ACCOUNTING на что-нибудь приличное не нашла
> отражение в /proc/config.gz:
> -# Linux/x86_64 5.10.76-std-def-alt1 Kernel Configuration
> +# Linux/x86_64 5.10.78-std-def-alt2 Kernel Configuration
> 
> Видимо, VIRT_CPU_ACCOUNTING_NATIVE на x86_64 нет, и это делается как-то
> иначе.

Ок, буду копать дальше, но, видимо это не в этой баге...