From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 12 Feb 2024 12:34:06 +0200 From: "Dmitry V. Levin" To: devel@lists.altlinux.org Message-ID: <20240212103406.GB1493@altlinux.org> References: <1bb82ee2-b4d6-4245-9428-6f01ab19bb67@basealt.ru> <20240211221230.GA28464@altlinux.org> <067bf2a1-7222-4959-827d-541d12a2a1fe@basealt.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <067bf2a1-7222-4959-827d-541d12a2a1fe@basealt.ru> Subject: Re: [devel] I: brp-verify-unit: "... assumes overflowugid credentials" X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2024 10:34:08 -0000 Archived-At: List-Archive: List-Post: On Mon, Feb 12, 2024 at 08:58:30AM +0300, Anton Farygin wrote: > On 12.02.2024 01:12, Dmitry V. Levin wrote: > > Кто-нибудь может мне рассказать, почему ядро до сих пор ещё разрешает > > setuid(overflowuid)? Это же по сути отменяет саму идею, заложенную > > в overflowuid. > > > Сейчас при входе в систему доменным пользователем UID получается 32-х > битный. > > overflow оно только на старых системах, где UID/GID 16-бит. Всё обстоит несколько иначе. Не готов читать лекцию, желающие могут обратиться к первоисточнику самостоятельно: linux$ git grep overflowuid Documentation/admin-guide/sysctl/fs.rst:overflowgid & overflowuid Documentation/admin-guide/sysctl/kernel.rst:overflowgid & overflowuid Documentation/filesystems/idmappings.rst:third idmapping. The kernel will report unmapped ids as the overflowuid drivers/gpu/drm/drm_ioctl.c: client->uid = overflowuid; fs/sysctls.c: .procname = "overflowuid", fs/sysctls.c: .data = &fs_overflowuid, fs/udf/super.c: uopt.uid = make_kuid(current_user_ns(), overflowuid); include/linux/highuid.h:extern int overflowuid; include/linux/highuid.h:#define high2lowuid(uid) ((uid) & ~0xFFFF ? (old_uid_t)overflowuid : (old_uid_t)(uid)) include/linux/highuid.h:extern int fs_overflowuid; include/linux/highuid.h:#define fs_high2lowuid(uid) ((uid) & ~0xFFFF ? (uid16_t)fs_overflowuid : (uid16_t)(uid)) include/linux/uidgid.h: uid = overflowuid; include/uapi/linux/bpf.h: * time-wait or a request socket instead), **overflowuid** value include/uapi/linux/bpf.h: * is returned (note that **overflowuid** might also be the actual kernel/sys.c:int overflowuid = DEFAULT_OVERFLOWUID; kernel/sys.c:EXPORT_SYMBOL(overflowuid); kernel/sys.c:int fs_overflowuid = DEFAULT_FS_OVERFLOWUID; kernel/sys.c:EXPORT_SYMBOL(fs_overflowuid); kernel/sysctl.c: .procname = "overflowuid", kernel/sysctl.c: .data = &overflowuid, kernel/user_namespace.c: * If @kuid has no mapping in @targ overflowuid is returned. kernel/user_namespace.c: uid = overflowuid; net/core/filter.c: return overflowuid; -- ldv