From patchwork Thu Nov 9 17:01:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 56347 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5C0AC3857030 for ; Thu, 9 Nov 2023 17:01:52 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id BED073858D35 for ; Thu, 9 Nov 2023 17:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BED073858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BED073858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699549290; cv=none; b=w16E5ocPzq7d55QReEp0eRqwBmduTUhT48DD7yoUP4ayB2Gm9OVE0qE8FGpTEnMkLOSasyF+lNb3Hxyx/tHTWdgtGpxXOfZ9YJL7tlvcTvY8DkZOW2KsIhx/S2/tF4ycqtZGxOG5qTZljSqYolZV3UI1FjczN07862Dxrqbl3jA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699549290; c=relaxed/simple; bh=s2ITv5XT3S6JAP0bqLVVJCOPU5//I9AFM+NnG1hemVg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=PIUHx0bcIO7X5YrcldBvObQIbBQcWeyq2i6N5NZ/qsi07Ve+9MpbXD2mlRnx0yPz4BUvU9ZCgaNg3vrRfWL+GW9dmrrvTFGCeCmtsgRNexlfk++wDv/g2u4lh4D6Og+VPBUbR1Xl0WcQMRD3sh0ogXc5/e3R+2DWK58ZU4eFpDs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc58219376so9989205ad.1 for ; Thu, 09 Nov 2023 09:01:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699549285; x=1700154085; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UgoubRMhJnmEea+dVuI0uOnnvtglqSuD8x6fWjNIM/Q=; b=PmEyirCSi+1zdq8TxKA8AODzpMkYvbUYvbrsyEDwGqYttsa8h/yrChEqXrcReKnIR5 ztxk0yJfaNJxk1tPHcIV+pVFCrK9LXNhzxfo/DEbXjjzcljEE6mfwjNLIfFplFPcTiCC nW2MlMQMjWzR1mQrwYtyqV38UzAvoYeH7Kd7qZOuFoYHLklqXX98Xyq/C4hMoHBWpR+F OIiaBrc5dcDLs6hp6NodlUeHUSk7ezpY7UgIYRYKHGy7qKbs1mEaZl1z93IIfkPXVgDZ 4MXNVbFp1lK+Ky+tqO5DlPWG4kiSOTk/xNVwViM0gPpuJa+33irAjjMrGd0DuE3phlft LFXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699549285; x=1700154085; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UgoubRMhJnmEea+dVuI0uOnnvtglqSuD8x6fWjNIM/Q=; b=IBTTsQRX9tgwv4yQuU6/fFTiwxXl3/K20rqA0EbqpcQOYgv5QuvUNWI5Cp4YZP3Aua tQxFCy0pZwLhOsvT5LqibVioW6Ao0Wm0vyCnNJ6h2HXVi4SbqKlz9xOH2TKyTHcw2dy9 hSkdys3iLyXaHb+YYWY8QCUQ7hUt2xL3FUeITIgI83CSTPF/Oi4QQhlyenSxRq5E+Qj/ c5sW9Z92T3coOOCFsW6nVhkPKzV746m82B1Ud4T/Otu13BvWRChRowwhE/vBDwrkTPh3 NKq5A024+8HLkflNxDWhoqZRZtuYe+KRUieJ9S6rulrFzza8MAmKCKj+MolPRhOTAiKP /5Sg== X-Gm-Message-State: AOJu0YwNc2PoGe4L5MoVRTfpdpd0ERq/hDiqSIKr8upEz2VBC+TCgr+J KmAYsm970NJgx0rUyVXRgpGfS5eFhjEus4TU5M+bkA== X-Google-Smtp-Source: AGHT+IGnwdW/zDv5R6cHTc/crBTdV6ZAHmdylYEIl+3PsCVuA6i7Dz2O1KNB5zlxQ66y020EySi2KQ== X-Received: by 2002:a17:902:ce84:b0:1cc:47e7:5d3e with SMTP id f4-20020a170902ce8400b001cc47e75d3emr6992300plg.58.1699549285190; Thu, 09 Nov 2023 09:01:25 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a715:4c3a:174b:ee6:b242]) by smtp.gmail.com with ESMTPSA id y13-20020a17090322cd00b001c3f7fd1ef7sm3783556plg.12.2023.11.09.09.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 09:01:24 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Thorsten Kukuk Subject: [PATCH 0/3] Make accounting database no-op Date: Thu, 9 Nov 2023 14:01:16 -0300 Message-Id: <20231109170119.1664204-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org The utmp/utmpx interface is the missing piece to enable full y2038 support on glibc, and even some 64 bit architectures are not fully compatible (the ones that define __WORDSIZE_TIME64_COMPAT32). There are multiple issues regarding 64 bit time_t support [1] [2] [3] and a potential fix would either require breaking the ABI (as I suggested when I started the y2038 and decided to put it aside due to the required work) or use a different encoding for the timeval structure (suggested by Andreas [4]). The current implementation has some design flaws that are not straightforward to fix without a complete rewrite [5] [6]. A utmp/utmpx daemon will also require a security model and support for multiple different IPC systems, which is out of scope for glibc. Also, this is what systemd-logind essentially does so it would be a double effort (the pt_chwon daemon is a remind that it is not easy to get this right). This patchset removes all accounting database implementation and makes the function no-op and/or return an error. There is not much gain in moving the current implementation to compat symbols, it does not solve the 64 bit time_t support for old binaries, nor it is guaranteed that the UTMP/UTMPX files will exist in future environments. Keeping a compat symbol also does not help with some design flags like BZ#24492, which I am not sure why it did not raise more security concerns since it is easy to create DoS attacks by preventing utmp updates. The utmp.h/utmpx.h headers are kept as is, even though glibc does not use its definition. The related path _PATH_UTMP/_PATH_WTMP/etc. points to invalid paths, and stub link warnings are added to the affected symbols. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28146 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=17470 [3] https://sourceware.org/bugzilla/show_bug.cgi?id=30701 [4] https://sourceware.org/pipermail/libc-alpha/2023-August/150661.html Adhemerval Zanella (3): sysdeps: Re-flow and sort multiline gnu/Makefile definitions login: Remove utmp fallback for getlogin login: Make user accounting database no-op NEWS | 18 + include/set-freeres.h | 3 - include/unistd.h | 3 - include/utmp.h | 29 - login/Makefile | 9 +- login/endutxent.c | 25 - login/getlogin.c | 13 +- login/getutent.c | 28 +- login/getutent_r.c | 45 +- login/getutid.c | 25 +- login/getutid_r.c | 34 +- login/getutline.c | 27 +- login/getutline_r.c | 21 +- login/getutmp.c | 12 +- login/getutmpx.c | 34 -- login/getutxent.c | 25 - login/getutxid.c | 25 - login/getutxline.c | 25 - login/login.c | 118 +--- login/logout.c | 44 +- login/logwtmp.c | 22 +- login/programs/utmpdump.c | 62 --- login/pututxline.c | 25 - login/setutxent.c | 25 - login/tst-pututxline-cache.c | 193 ------- login/tst-pututxline-lockfail.c | 176 ------ login/tst-updwtmpx.c | 112 ---- login/tst-utmp.c | 377 ------------- login/tst-utmpx.c | 2 - login/updwtmp.c | 13 +- login/updwtmpx.c | 25 - login/utmp-private.h | 44 -- login/utmp_file.c | 506 ------------------ login/utmpname.c | 57 +- login/utmpxname.c | 25 - malloc/set-freeres.c | 6 - manual/users.texi | 446 ++------------- sysdeps/generic/paths.h | 6 +- sysdeps/gnu/Makefile | 43 +- sysdeps/gnu/getutmp.c | 34 -- sysdeps/gnu/getutmpx.c | 1 - sysdeps/gnu/updwtmp.c | 30 -- sysdeps/gnu/utmp_file.c | 30 -- sysdeps/mach/hurd/getlogin.c | 35 -- sysdeps/unix/getlogin.c | 81 --- sysdeps/unix/getlogin_r.c | 103 ---- sysdeps/unix/sysv/linux/getlogin.c | 39 -- sysdeps/unix/sysv/linux/getlogin_r.c | 34 +- sysdeps/unix/sysv/linux/paths.h | 4 +- sysdeps/unix/sysv/linux/s390/s390-32/Makefile | 4 - .../unix/sysv/linux/s390/s390-32/getutent.c | 19 +- .../unix/sysv/linux/s390/s390-32/getutent_r.c | 11 +- .../unix/sysv/linux/s390/s390-32/getutid.c | 4 +- .../unix/sysv/linux/s390/s390-32/getutid_r.c | 2 +- .../unix/sysv/linux/s390/s390-32/getutline.c | 4 +- .../sysv/linux/s390/s390-32/getutline_r.c | 2 +- .../unix/sysv/linux/s390/s390-32/getutmp.c | 20 +- .../unix/sysv/linux/s390/s390-32/getutxent.c | 29 - .../unix/sysv/linux/s390/s390-32/getutxid.c | 29 - .../unix/sysv/linux/s390/s390-32/getutxline.c | 29 - sysdeps/unix/sysv/linux/s390/s390-32/login.c | 1 + .../unix/sysv/linux/s390/s390-32/login32.c | 37 -- .../unix/sysv/linux/s390/s390-32/pututxline.c | 29 - .../unix/sysv/linux/s390/s390-32/updwtmp.c | 6 +- .../unix/sysv/linux/s390/s390-32/updwtmpx.c | 29 - .../sysv/linux/s390/s390-32/utmp-convert.h | 85 --- sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c | 183 ------- sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h | 51 -- .../sysv/linux/s390/s390-32/utmpx-convert.h | 84 --- .../unix/sysv/linux/s390/s390-32/utmpx32.c | 138 ----- .../unix/sysv/linux/s390/s390-32/utmpx32.h | 59 -- sysdeps/unix/sysv/linux/utmp_file.c | 36 -- 72 files changed, 212 insertions(+), 3798 deletions(-) delete mode 100644 login/endutxent.c delete mode 100644 login/getutmpx.c delete mode 100644 login/getutxent.c delete mode 100644 login/getutxid.c delete mode 100644 login/getutxline.c delete mode 100644 login/programs/utmpdump.c delete mode 100644 login/pututxline.c delete mode 100644 login/setutxent.c delete mode 100644 login/tst-pututxline-cache.c delete mode 100644 login/tst-pututxline-lockfail.c delete mode 100644 login/tst-updwtmpx.c delete mode 100644 login/tst-utmp.c delete mode 100644 login/tst-utmpx.c delete mode 100644 login/updwtmpx.c delete mode 100644 login/utmp-private.h delete mode 100644 login/utmp_file.c delete mode 100644 login/utmpxname.c delete mode 100644 sysdeps/gnu/getutmp.c delete mode 100644 sysdeps/gnu/getutmpx.c delete mode 100644 sysdeps/gnu/updwtmp.c delete mode 100644 sysdeps/gnu/utmp_file.c delete mode 100644 sysdeps/mach/hurd/getlogin.c delete mode 100644 sysdeps/unix/getlogin.c delete mode 100644 sysdeps/unix/getlogin_r.c delete mode 100644 sysdeps/unix/sysv/linux/getlogin.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxent.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxid.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/getutxline.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/login32.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/pututxline.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/updwtmpx.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h delete mode 100644 sysdeps/unix/sysv/linux/utmp_file.c