From owner-svn-src-all@freebsd.org Wed Dec 11 22:00:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A195F1E17DA; Wed, 11 Dec 2019 22:00:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Y9pr2wmkz3CKR; Wed, 11 Dec 2019 22:00:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xBBM0T0f019480 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 12 Dec 2019 00:00:32 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xBBM0T0f019480 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xBBM0SUq019479; Thu, 12 Dec 2019 00:00:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 12 Dec 2019 00:00:28 +0200 From: Konstantin Belousov To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355611 - head/sys/kern Message-ID: <20191211220028.GW2744@kib.kiev.ua> References: <201912111552.xBBFqUq9009116@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201912111552.xBBFqUq9009116@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47Y9pr2wmkz3CKR X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Dec 2019 22:00:36 -0000 On Wed, Dec 11, 2019 at 03:52:30PM +0000, Andriy Gapon wrote: > Author: avg > Date: Wed Dec 11 15:52:29 2019 > New Revision: 355611 > URL: https://svnweb.freebsd.org/changeset/base/355611 > > Log: > add a sanity check to the system call registration code > > A system call number should be at least reserved. > We do not expect an attempt to register a fixed number system call > when nothing at all is known about it. > > MFC after: 3 weeks > Sponsored by: Panzura > > Modified: > head/sys/kern/kern_syscalls.c > > Modified: head/sys/kern/kern_syscalls.c > ============================================================================== > --- head/sys/kern/kern_syscalls.c Wed Dec 11 15:15:21 2019 (r355610) > +++ head/sys/kern/kern_syscalls.c Wed Dec 11 15:52:29 2019 (r355611) > @@ -120,11 +120,14 @@ kern_syscall_register(struct sysent *sysents, int *off > if (i == SYS_MAXSYSCALL) > return (ENFILE); > *offset = i; > - } else if (*offset < 0 || *offset >= SYS_MAXSYSCALL) > + } else if (*offset < 0 || *offset >= SYS_MAXSYSCALL) { > return (EINVAL); > - else if (sysents[*offset].sy_call != (sy_call_t *)lkmnosys && > - sysents[*offset].sy_call != (sy_call_t *)lkmressys) > + } else if (sysents[*offset].sy_call != (sy_call_t *)lkmnosys && > + sysents[*offset].sy_call != (sy_call_t *)lkmressys) { > + KASSERT(sysents[*offset].sy_call != NULL, > + ("undefined syscall %d", *offset)); I do not think that the assert is very useful. On debug kernels, where the development would most likely take place, its only function is to annoy developer by requiring him to reboot the host if he did not guessed a free syscall number right. I suggest to convert this into printf, might be also under bootverbose. Also, why do you say that the syscall is undefined ? I would state that it is not reusable for dynamically loaded syscall, instead. > return (EEXIST); > + } > > KASSERT(sysents[*offset].sy_thrcnt == SY_THR_ABSENT, > ("dynamic syscall is not protected"));