From nobody Mon Mar 04 01:00:45 2024 X-Original-To: dev-commits-src-main@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 4Tp0k54lYqz5Ch0q; Mon, 4 Mar 2024 01:00:45 +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 4Tp0k54Fj5z4lym; Mon, 4 Mar 2024 01:00:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709514045; 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=vGv+4td9GALXjYLDjQ7+H9GqtlcLrzucVlW/hCp2y5s=; b=ksG8RY7GI/64gxKeoEhfqiPXCWN+ro59Cm5YcXzN7ND7vjtu4kwHPggngZv7+W8hGclkUV e0jFalcDRpFfulW2kzOOQXXpjGo/HiEAMqG2gP9EUWXfzenrknJPeWjAT9MTGyJjMMWFso xgnYD33dQisG6ty7D0MpbO9PCQ30Oej85Hts6m1N+lS2S4dhqOeqWG6kct9znySYx6Acr3 jq99mhOWYh/xGU17VOBeZpTmSzJZ2vhr1B5tkJuQQNaYCyudyCEaXCAN9F4cnhmm0NpahH ekVGJ3J4Gup6a7hYJKnjhKYUsQK3Zj0miwt1C26D8ul9WlShsNIW2Tzzt1A09A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709514045; a=rsa-sha256; cv=none; b=Etyv8IrvOhJ8WRdvq0JJaa+E0yhETnVJAnREWMZMYheFuRUWVWtn6tWyV1lgr5nlz/ie4p Ax1PjzOudzaw/NQR1TMnguY7Pv5OlTeSfwmlqiJLFiwVssYQosj+uklNhpqCZXOvXY/xKw DrdcDbPvliUTJY+FZkSE6kIvX/5y4EQWdGwXzLPXhqCTWkDZya/psGxoItfaCuJ/3EHK88 mG/5E+ozgM/vkxZdWz2nW10Jvt+6hvtS9qsA/lTbyQvrlvm/95Sk2YXbdI4uRC/4WlLmz1 wRyQwUCiQOGPt5khOZl50FdCL8X6I01VSNUGON+cMKyg8NYtdcUSXbvvHZ3NeA== 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=1709514045; 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=vGv+4td9GALXjYLDjQ7+H9GqtlcLrzucVlW/hCp2y5s=; b=FGpI0foEczHvCP4vfERY9pOS9Dne58cCHml8zMgt1fMKQSVRBvB1l8PVcepw3RjCpctNLX J/lKbhBMgPHgR3aDMq9oztqQQW+WekqmTgcUaQXXZwQ6Ooi4ZCtCdPSTiM4rGN9PwxIpk5 5n5iVZTIHHT1eyuvowG7vODWxDZmZxOFSmI9aCkRG8gaS17regfbJ5X8h0xHPl5rlxyxL+ y2+WxLuRelRPP5dQowcoLd77l2bwKP/bLUlWFANkMd+Iwp6P+rLWC8/2Ke6rFbVYJ8SwYf Grg3tCMbEXi1rtK5jMG6ljttd48dppbNE7roQONlJVBpC52yJw1KOeaOkpIvHQ== 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 4Tp0k53qNFz11KJ; Mon, 4 Mar 2024 01:00:45 +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 42410jcx004169; Mon, 4 Mar 2024 01:00:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42410jsE004166; Mon, 4 Mar 2024 01:00:45 GMT (envelope-from git) Date: Mon, 4 Mar 2024 01:00:45 GMT Message-Id: <202403040100.42410jsE004166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 80ac36c3a2a8 - main - posix_spawnattr_setflags(3): validate argument List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 80ac36c3a2a87a19790eba487466bf70d55f566e Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=80ac36c3a2a87a19790eba487466bf70d55f566e commit 80ac36c3a2a87a19790eba487466bf70d55f566e Author: Konstantin Belousov AuthorDate: 2024-03-03 13:19:37 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-04 01:00:38 +0000 posix_spawnattr_setflags(3): validate argument Reviewed by: emaste, kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44195 --- 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 ,