From owner-svn-src-head@freebsd.org Thu Jun 29 14:40:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9B17D9EE29; Thu, 29 Jun 2017 14:40:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 991BD2568; Thu, 29 Jun 2017 14:40:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5TEeX1R042497; Thu, 29 Jun 2017 14:40:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5TEeX2q042496; Thu, 29 Jun 2017 14:40:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201706291440.v5TEeX2q042496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Jun 2017 14:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320471 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 320471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2017 14:40:34 -0000 Author: kib Date: Thu Jun 29 14:40:33 2017 New Revision: 320471 URL: https://svnweb.freebsd.org/changeset/base/320471 Log: Do not cast struct kevent_args or struct freebsd11_kevent_args to struct g_kevent_args. On some architectures, e.g. PowerPC, there is additional padding in uap. Reported and tested by: andreast Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Thu Jun 29 14:00:05 2017 (r320470) +++ head/sys/kern/kern_event.c Thu Jun 29 14:40:33 2017 (r320471) @@ -935,8 +935,16 @@ sys_kevent(struct thread *td, struct kevent_args *uap) .k_copyin = kevent_copyin, .kevent_size = sizeof(struct kevent), }; + struct g_kevent_args gk_args = { + .fd = uap->fd, + .changelist = uap->changelist, + .nchanges = uap->nchanges, + .eventlist = uap->eventlist, + .nevents = uap->nevents, + .timeout = uap->timeout, + }; - return (kern_kevent_generic(td, (struct g_kevent_args *)uap, &k_ops)); + return (kern_kevent_generic(td, &gk_args, &k_ops)); } static int @@ -1107,8 +1115,16 @@ freebsd11_kevent(struct thread *td, struct freebsd11_k .k_copyin = kevent11_copyin, .kevent_size = sizeof(struct kevent_freebsd11), }; + struct g_kevent_args gk_args = { + .fd = uap->fd, + .changelist = uap->changelist, + .nchanges = uap->nchanges, + .eventlist = uap->eventlist, + .nevents = uap->nevents, + .timeout = uap->timeout, + }; - return (kern_kevent_generic(td, (struct g_kevent_args *)uap, &k_ops)); + return (kern_kevent_generic(td, &gk_args, &k_ops)); } #endif