Date: Sun, 11 Jul 2010 08:33:10 -0700 From: mdf@FreeBSD.org To: Gabor Kovesdan <gabor@freebsd.org> Cc: Dimitry Andric <dimitry@andric.com>, FreeBSD Hackers <hackers@freebsd.org> Subject: Re: strange problem with int64_t variables Message-ID: <AANLkTil_AEicC4sWD2M7-FwTl2OO5KKGk3P7TVynh2wP@mail.gmail.com> In-Reply-To: <4C39DBFF.2000307@FreeBSD.org> References: <4C39D92F.4050605@FreeBSD.org> <4C39DB09.6010808@andric.com> <4C39DBFF.2000307@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 11, 2010 at 7:58 AM, Gabor Kovesdan <gabor@freebsd.org> wrote: > Em 2010.07.11. 16:54, Dimitry Andric escreveu: >> >> On 2010-07-11 16:46, Gabor Kovesdan wrote: >> >>> >>> I have two int64_t variables in kernel code, first is stored internally >>> and the second one is passed from a syscall argument. When I print them >>> with printf %lld modifier, the internal one behaves correctly but the >>> other one I pass from a syscall has a corrupted value. If I pass 1, it >>> prints out 3735348794091372545. I'm not doing anything special with it >>> just reading it out from the struct that was generated with make sysent= . >>> >> >> Since 3735348794091372545 is 0x33d69ff000000001, it looks like the upper >> word got corrupted somehow. =A0Maybe some part of it got non-atomically >> assigned? =A0Maybe the wrong word was read? =A0It is hard to tell withou= t >> code... =A0:) >> > > Userland syscall calling: > > killjob(getjid(), SIGINT); =A0//getjid() returns 1 this case, whose type = is > jid_t > > Kernel code: > > int > killjob(struct thread *td, struct killjob_args *uap) > { > =A0 =A0 =A0 =A0struct jobentry *jp, *jtmp; > =A0 =A0 =A0 =A0struct procentry *pp, *ptmp; > > =A0 =A0 =A0 =A0JOBLIST_bWLOCK; > =A0 =A0 =A0 =A0LIST_FOREACH_SAFE(jp,&irix_joblist, entries, jtmp) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (jp->jid =3D=3D uap->jid) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* never reached code, com= parison always fail because > of corrupted value */ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0JOBLIST_WUNLOCK; > > =A0 =A0 =A0 =A0/* not such job */ > =A0 =A0 =A0 =A0td->td_retval[0] =3D -1; > =A0 =A0 =A0 =A0return (ENOJOB); > } What does struct killjob_args look like? Is this syscall defined in a module, or an addition to the kernel's syscalls.master? Is the user-space 32-bit or 64-bit? What about the kernel? Thanks, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTil_AEicC4sWD2M7-FwTl2OO5KKGk3P7TVynh2wP>