From nobody Fri May 10 20:51:31 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vbgz76YDjz5KPwX; Fri, 10 May 2024 20:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vbgz75zjgz4YMJ; Fri, 10 May 2024 20:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715374291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hFJhSddDwloXi/XBWWhdcjV2xa9KiE+qTFbT2rqvIiY=; b=NWt5NkP1utSmIT3Ghrz8V3Kg5iON66uqwYOV3lm/dyGpaV1ypBFk2/O9rt4t/EnTNTobtc KjjkFBIJceQ1yTJyUK9QLwKadThkYraCJo/3P1nDn+wRxy+selhP/W0p4UwsM1E3SYlT+M 47Hprzv57JCBys44b3bXdoGJu4zYjOvVTkyjVpg+rsIa90FrmZSLDSTJyKbwc5mc6WBopw CheQXYPiiX97FnafPxYWf7eOhbVtYTpkxINXWekhmkCevI6rsmNBY0oRvq9cT36L2bCbCH 0f+OTJMrY4rtOr+IzE1Xoq44e+ppFrR6U0XXQwXXa7hXvjK1MGYMZyWc3R5RUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715374291; a=rsa-sha256; cv=none; b=Tz5P3FrEhvkfs1hlKKUB//wJ0eW1e6EpB+dCL0tp1gWMwo2HKEu/5fOVWVSjH0ZpdRCIRv lSyfr3NpDM9hhHt0dZDaUt38i9BhUGoyF8wiOoeXbU72NF01vrtJOBC+CHZ/vxkJD1HD9G 4Hvh+602zgVoMSCKHeJSE1JpAeOa+QDunvdhgtvoQ/r0VAQEf7mHigwTCaI0KWf5WHhT/e vjRjM5u54v3uZk3lPMtB/yc69BFwMxf3e41LyzgzVX9DVFp1ZXll9Tfz27UYkZmCPI9FUb 46vWKXcHgkyfhmWQKYV2M9j52UIf9GKhQmcUQiZdG0Kf24WHkTeUGcxDpk+tAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715374291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hFJhSddDwloXi/XBWWhdcjV2xa9KiE+qTFbT2rqvIiY=; b=raWHP4xh2mPjy9UyIrPi47xNAixHRT6Gnft5xz+B0SUlfiX1V3Cos2kl32My9IuJ1S9UmE EGcU9UXoOjKFd7EAYOqCYViqY1vTm/0SusiFNXHSCa0YS/z37DgGb97x5rQBl+I7h82bBv JdXj8gFHwKlRCC3MPDZfLLjUHbLqyy6N/3bKABOe70bS/MuyqTxyUnU5RJvlrk+gm75CSG JBtcOsk/TgYtvDfu0PJRvknI5quKGxGr/0iES+1h1BGiKBuUWyyyaZJnXnXl1M4i94e6Z4 fM+PEnL4Q5etcuOCkmBQaFbQmHjzvJjFvgVXrwxqn0YTchFS2qfu5NK75nNrRg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vbgz75ZwYzs8l; Fri, 10 May 2024 20:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44AKpVkc043287; Fri, 10 May 2024 20:51:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44AKpV0h043284; Fri, 10 May 2024 20:51:31 GMT (envelope-from git) Date: Fri, 10 May 2024 20:51:31 GMT Message-Id: <202405102051.44AKpV0h043284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a7cc56b28fb1 - main - linux: Adjust rlimit SIGPENDING & MSGQUEUE behaviour to match linprocfs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7cc56b28fb1615a8ac4ebe826312a5d8a0f17da Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a7cc56b28fb1615a8ac4ebe826312a5d8a0f17da commit a7cc56b28fb1615a8ac4ebe826312a5d8a0f17da Author: Ricardo Branco AuthorDate: 2024-05-10 14:20:16 +0000 Commit: Warner Losh CommitDate: 2024-05-10 20:50:04 +0000 linux: Adjust rlimit SIGPENDING & MSGQUEUE behaviour to match linprocfs Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1227 --- sys/compat/linux/linux_misc.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index cb62b0e70c0d..9b8ab193f2bd 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1125,16 +1125,16 @@ linux_getgroups(struct thread *td, struct linux_getgroups_args *args) } static bool -linux_get_dummy_limit(l_uint resource, struct rlimit *rlim) +linux_get_dummy_limit(struct thread *td, l_uint resource, struct rlimit *rlim) { + ssize_t size; + int res, error; if (linux_dummy_rlimits == 0) return (false); switch (resource) { case LINUX_RLIMIT_LOCKS: - case LINUX_RLIMIT_SIGPENDING: - case LINUX_RLIMIT_MSGQUEUE: case LINUX_RLIMIT_RTTIME: rlim->rlim_cur = LINUX_RLIM_INFINITY; rlim->rlim_max = LINUX_RLIM_INFINITY; @@ -1144,6 +1144,23 @@ linux_get_dummy_limit(l_uint resource, struct rlimit *rlim) rlim->rlim_cur = 0; rlim->rlim_max = 0; return (true); + case LINUX_RLIMIT_SIGPENDING: + error = kernel_sysctlbyname(td, + "kern.sigqueue.max_pending_per_proc", + &res, &size, 0, 0, 0, 0); + if (error != 0) + return (false); + rlim->rlim_cur = res; + rlim->rlim_max = res; + return (true); + case LINUX_RLIMIT_MSGQUEUE: + error = kernel_sysctlbyname(td, + "kern.ipc.msgmnb", &res, &size, 0, 0, 0, 0); + if (error != 0) + return (false); + rlim->rlim_cur = res; + rlim->rlim_max = res; + return (true); default: return (false); } @@ -1181,7 +1198,7 @@ linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args) struct rlimit bsd_rlim; u_int which; - if (linux_get_dummy_limit(args->resource, &bsd_rlim)) { + if (linux_get_dummy_limit(td, args->resource, &bsd_rlim)) { rlim.rlim_cur = bsd_rlim.rlim_cur; rlim.rlim_max = bsd_rlim.rlim_max; return (copyout(&rlim, args->rlim, sizeof(rlim))); @@ -1222,7 +1239,7 @@ linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args) struct rlimit bsd_rlim; u_int which; - if (linux_get_dummy_limit(args->resource, &bsd_rlim)) { + if (linux_get_dummy_limit(td, args->resource, &bsd_rlim)) { rlim.rlim_cur = bsd_rlim.rlim_cur; rlim.rlim_max = bsd_rlim.rlim_max; return (copyout(&rlim, args->rlim, sizeof(rlim))); @@ -2009,7 +2026,7 @@ linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args) int error; if (args->new == NULL && args->old != NULL) { - if (linux_get_dummy_limit(args->resource, &rlim)) { + if (linux_get_dummy_limit(td, args->resource, &rlim)) { lrlim.rlim_cur = rlim.rlim_cur; lrlim.rlim_max = rlim.rlim_max; return (copyout(&lrlim, args->old, sizeof(lrlim)));