In article <20140129153713.gl5...@homeworld.netbsd.org>, Emmanuel Dreyfus <m...@netbsd.org> wrote: >On Wed, Jan 29, 2014 at 01:48:35PM +0100, Martin Husemann wrote: >> My vote for this special case: hard code it #ifdef __x86_64__. >> If we run into other instances, we can add a define (like: DEV_T_ALIGN_32). > >Here is a patch that fixes the problem. > >+ default: >+ panic("unexpected cmd = %d", SCARG(&ua, cmd)); >+ break;
Anyone can panic the kernel now... >+ } >+ >+ *retval = 0; >+ SCARG(&ssa, cmd) = SCARG(&ua, cmd); >+ SCARG(&ssa, misc) = 1; >+ >+ for (i = 0; i < SCARG(&ua, misc); i++) { >+ SCARG(&ssa, arg) = >+ (char *)SCARG(&ua, arg) + (i * swapctl32_len); >+ >+ if ((error = sys_swapctl(l, &ssa, &rv)) != 0) { >+ *retval = rv; >+ break; >+ } I think you probably want to do some struct conversion because if sys_swapctl expects to write to a bigger buffer, you can end up trashing the user's stack. christos