From nobody Mon Nov 29 22:05:36 2021 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 B0D0F18C7CA5; Mon, 29 Nov 2021 22:05:39 +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 4J2ztn1XSbz3GVp; Mon, 29 Nov 2021 22:05:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E71482741; Mon, 29 Nov 2021 22:05:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ATM5awG075738; Mon, 29 Nov 2021 22:05:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ATM5auY075737; Mon, 29 Nov 2021 22:05:36 GMT (envelope-from git) Date: Mon, 29 Nov 2021 22:05:36 GMT Message-Id: <202111292205.1ATM5auY075737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: d7f306c5be6f - main - makesyscalls: add a new SYSMUX type 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: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7f306c5be6fb4b4ab4455e1d033cc9545ce015d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638223538; 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=Djl4XCzaipP1P0zy/Q0IK38uUcJlvgu3dm7vkNXbeJ4=; b=Mt5Y9KuJFYzpx6KARVu8UOz7YLRBeSbpHbUZgd7V23bB3rBPGXRTsxYDexRi702qsRUuMK Mvyzp8i9U8qkH0ZCB9z3tF6KSTpMc/yBNdduqCwvgIG858ZdaQI92PKmxbVWreX7iL2noa iI3Q9Q4OHw78VXRsQZ8dSlRtELhijPAFdrLNIToIPmT5OVlcemJnBFp5P03lw0KCGognac 2Atgivr+quEdPuXnYwznk3IJ9PKXwyKZyAUENzw+WMit76AeHpbn2061c3Hv5PyCY8GMUm VeVKHkhRDyIJPTpWzw09lUjfnJqfWM0Ae6dk/T94onJcXpaSNSUD66QDaQ+xZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638223538; a=rsa-sha256; cv=none; b=BSSzKEe2X0vzvrF+NnnIvoSzehMKYVh27+CcrSKHXStyAbkRRymdgFGiiR5ZUm1FoLzmWN rgCw4XeSmefOCQwtfsEnj8uwtACS9uv9+r+DcbykfZBqI5d8NDfQsIRWXfp/nVUhxhrpp7 /NsqfIr06C0lt76l/NaXQmV/ssNVo1hKU3I1DBJoyinfEjtxQr8tFjAddE27OUMqGuY5Wx W+KndbPT2okaNVZKa42zvA5iDdrLWIwk+mpiOTE8CoyDd4K/9k+0cjFYrszQWEjlzhq41h S++8rnA3KK7Hp98f+E3iw/qp9NwO3ASzvBSW2yOkU8jiTPnuiEkuOFpSTY7lMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=d7f306c5be6fb4b4ab4455e1d033cc9545ce015d commit d7f306c5be6fb4b4ab4455e1d033cc9545ce015d Author: Brooks Davis AuthorDate: 2021-11-29 22:03:00 +0000 Commit: Brooks Davis CommitDate: 2021-11-29 22:04:43 +0000 makesyscalls: add a new SYSMUX type This type is for system call multiplexers (syscall(2), __syscall(2)) that don't have a normal handler and instead are handled in the machine-dependent syscall code. Reviewed by: kib, imp --- sys/kern/syscalls.master | 6 ++++-- sys/tools/makesyscalls.lua | 23 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 693454c67eca..96541023ec28 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -13,8 +13,8 @@ ; there is no audit event for the call at this time. For the ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, RESERVED, UNIMPL, COMPAT, COMPAT4, COMPAT6, -; COMPAT7, COMPAT11, COMPAT12, NODEF, NOARGS, NOPROTO, NOSTD +; type one of STD, OBSOL, RESERVED, UNIMPL, SYSMUX, COMPAT*, +; NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) ; The CAPENABLED option may be ORed into a type. @@ -48,6 +48,8 @@ ; function prototype in sys/sysproto.h. Does add a ; definition to syscall.h besides adding a sysent. ; NOTSTATIC syscall is loadable +; SYSMUX syscall multiplexer. No prototype, argument struct, or +; handler is declared or used. Handled in MD syscall code. ; CAPENABLED syscall is allowed in capability mode ; ; To support programmatic generation of both the default ABI and 32-bit compat diff --git a/sys/tools/makesyscalls.lua b/sys/tools/makesyscalls.lua index e8f882f6641d..4fa5727470a8 100644 --- a/sys/tools/makesyscalls.lua +++ b/sys/tools/makesyscalls.lua @@ -196,6 +196,7 @@ local known_flags = { NOSTD = 0x00000080, NOTSTATIC = 0x00000100, CAPENABLED = 0x00000200, + SYSMUX = 0x00000400, -- Compat flags start from here. We have plenty of space. } @@ -733,7 +734,9 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, auditev, syscallret, funcname, funcalias, funcargs, argalias) local argssize - if #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then + if flags & known_flags["SYSMUX"] ~= 0 then + argssize = "0" + elseif #funcargs > 0 or flags & known_flags["NODEF"] ~= 0 then argssize = "AS(" .. argalias .. ")" else argssize = "0" @@ -752,7 +755,7 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, case %d: ]], funcname, sysnum)) - if #funcargs > 0 then + if #funcargs > 0 and flags & known_flags["SYSMUX"] == 0 then write_line("systracetmp", "\t\tswitch (ndx) {\n") write_line("systrace", string.format( "\t\tstruct %s *p = params;\n", argalias)) @@ -820,8 +823,12 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, break; ]], syscallret)) end + local n_args = #funcargs + if flags & known_flags["SYSMUX"] ~= 0 then + n_args = 0 + end write_line("systrace", string.format( - "\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", #funcargs)) + "\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", n_args)) write_line("systracetmp", "\t\tbreak;\n") local nargflags = get_mask({"NOARGS", "NOPROTO", "NODEF"}) @@ -872,7 +879,13 @@ local function handle_noncompat(sysnum, thr_flag, flags, sysflags, rettype, string.format("\t{ .sy_narg = %s, .sy_call = (sy_call_t *)", argssize)) local column = 8 + 2 + #argssize + 15 - if flags & known_flags["NOSTD"] ~= 0 then + if flags & known_flags["SYSMUX"] ~= 0 then + write_line("sysent", string.format( + "nosys, .sy_auevent = AUE_NULL, " .. + ".sy_flags = %s, .sy_thrcnt = SY_THR_STATIC },", + sysflags)) + column = column + #"nosys" + #"AUE_NULL" + 3 + elseif flags & known_flags["NOSTD"] ~= 0 then write_line("sysent", string.format( "lkmressys, .sy_auevent = AUE_NULL, " .. ".sy_flags = %s, .sy_thrcnt = SY_THR_ABSENT },", @@ -1271,7 +1284,7 @@ process_syscall_def = function(line) local ncompatflags = get_mask({"STD", "NODEF", "NOARGS", "NOPROTO", "NOSTD"}) local compatflags = get_mask_pat("COMPAT.*") - if noproto then + if noproto or flags & known_flags["SYSMUX"] ~= 0 then flags = flags | known_flags["NOPROTO"]; end if flags & known_flags["OBSOL"] ~= 0 then