public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: setrlimit: Add a permission check Date: Tue, 30 Nov 2021 11:56:09 +0000 (GMT) [thread overview] Message-ID: <20211130115609.3C4EA3857406@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=670beaed0216aa59603501e8f14e1f04b138bc47 commit 670beaed0216aa59603501e8f14e1f04b138bc47 Author: Corinna Vinschen <corinna@vinschen.de> Date: Tue Nov 30 12:48:34 2021 +0100 Cygwin: setrlimit: Add a permission check If the incoming soft limit is less restrictive than the current hard limit, bail out with EPERM. Given the previous sanity check, this implies trying to raise the hard limit. While, theoretically, this should be allowed for privileged processes, Windows has no matching concept in terms of job limits Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/resource.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 46d74b984..c4c79ca6f 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -261,6 +261,12 @@ setrlimit (int resource, const struct rlimit *rlp) __leave; } + if (rlp->rlim_cur > oldlimits.rlim_max) + { + set_errno (EPERM); + __leave; + } + switch (resource) { case RLIMIT_AS:
reply other threads:[~2021-11-30 11:56 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211130115609.3C4EA3857406@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).