From nobody Mon Mar 11 00:29:25 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 4TtHhj60mhz5DDH4; Mon, 11 Mar 2024 00:29:25 +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 4TtHhj5SF4z4sZ7; Mon, 11 Mar 2024 00:29:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710116965; 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=M4oIY2UYnPCCfhFy6JmddxErYM7Oacpz3uxSkBKMcI8=; b=SsmXcoVWoxY9BLdAT6mQJThrBjNH4fIypXkIFg8OHxiP1ghGjmiViYadExC4qawA/lwdwD QZEgdbQph+6YLZpaArh6KV37FwXar9YRcB6mZbBeDorxpdj3KCJ25Jrx0tHx4+tsY/LyLM W60eDkFwv4BTe3G6UweRCuAJOIJqodhB2rF4XCaczPB6zc+3dXiPhwRYW4wMWqbrkfRvE3 iRR3aGKed/TO9tkD6CAGO2dDqAyUIvH15sz3rCx9thOMHPIaWIMAOzu1Q413YV+O9vU5wX v0muu2qzPfiY2mjsfneCJPyCpNglB9EwDry1b5KqIbWzyPXB4kerWHYhAAGqpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710116965; a=rsa-sha256; cv=none; b=OQQ0Z0vIHe1XE78eyczsxW1VE/mhkCB26keIOfCKlSPr4L1D0e7TqxlNyAn+pZDee5ZdvB f56tLdcA7Sz9UAVXorelJ35XkWXlwL/Xzjql2r7mC4lrLPX4+6ZBCHlqS/dgTvSUpSkDb/ uFndbFxTuYOAWPf8eA+HrbmiPKIYAie/RJR97oA3RYrVnomfPY5yEPe1/fnGrBkQFBbjqv KNEAlPpXkrMwBzrEw97kNU97ruGC87eA11VDAGhRsLJgIVQcj2GIlN6UkG+aoUzxpBp47l bCvpN64Tn/4QnJIWJX8bcxMIhfhxobb5aDr2H9Vm7MQzuJ7/Meu2NBFUssJrOw== 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=1710116965; 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=M4oIY2UYnPCCfhFy6JmddxErYM7Oacpz3uxSkBKMcI8=; b=OTD+3L1jcE4jPfK/FyCn/tumWOXX+ycIR8OhdHvRx62YWW1qsTlPa6//RKNnX+uD2jq4XO hMIA5/+d59SVO039u5smOFCDgUaRV7otMQvPCFxujYbj3sCcXZcJD0/kxegcKgaCay69V8 ao1G1cW6GDIGDeF57W+p/LgaQMgadPp9zMELPDddDoSUXzGMbM8x1Ee9m39jwkoDtfWmHg W+0p4M6yr/HoNf2NeQ44f5JLN96wilmhvumfcBikPE4BXfoo3AYfeNexWUHtYJBPjWKZ1m IQaxMwBSMj5zs3fumfSeX197MUUz8UmJ+h06teDwJtbZpzMdTw8+2UDL9UYdkg== 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 4TtHhj4wdFz17J6; Mon, 11 Mar 2024 00:29:25 +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 42B0TP7G093856; Mon, 11 Mar 2024 00:29:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42B0TPYs093853; Mon, 11 Mar 2024 00:29:25 GMT (envelope-from git) Date: Mon, 11 Mar 2024 00:29:25 GMT Message-Id: <202403110029.42B0TPYs093853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: eb36277dc926 - stable/14 - posix_spawnattr_setflags(3): validate argument 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: eb36277dc926b671b520ca0ecb1da54eacf424a2 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=eb36277dc926b671b520ca0ecb1da54eacf424a2 commit eb36277dc926b671b520ca0ecb1da54eacf424a2 Author: Konstantin Belousov AuthorDate: 2024-03-03 13:19:37 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-11 00:25:58 +0000 posix_spawnattr_setflags(3): validate argument (cherry picked from commit 80ac36c3a2a87a19790eba487466bf70d55f566e) --- lib/libc/gen/posix_spawn.c | 4 ++++ lib/libc/gen/posix_spawnattr_getflags.3 | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index a067d1f68ea5..41e059cf437b 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -629,6 +629,10 @@ posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict sa, int posix_spawnattr_setflags(posix_spawnattr_t *sa, short flags) { + if ((flags & ~(POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP | + POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER | + POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK)) != 0) + return (EINVAL); (*sa)->sa_flags = flags; return (0); } diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3 index 9a468cbb8b0f..18cf6683e935 100644 --- a/lib/libc/gen/posix_spawnattr_getflags.3 +++ b/lib/libc/gen/posix_spawnattr_getflags.3 @@ -83,9 +83,12 @@ The default value of this attribute is as if no flags were set. .Sh RETURN VALUES The .Fn posix_spawnattr_getflags -and +function returns zero. +The .Fn posix_spawnattr_setflags -functions return zero. +function returns zero on success, and +.Er EINVAL +on failure due to invalid flag specified. .Sh SEE ALSO .Xr posix_spawn 3 , .Xr posix_spawnattr_destroy 3 ,