Date: Fri, 26 Jun 2009 00:25:31 +0200 (CEST) From: Alexander Best <alexbestms@math.uni-muenster.de> To: <freebsd-hackers@freebsd.org> Subject: linux syscall modify_ldt() returning wrong errno Message-ID: <permail-20090625222531f0889e840000548e-a_best01@message-id.uni-muenster.de>
next in thread | raw e-mail | index | archive | help
hi there, i'm currently playing a bit with the linux test project (ltp). it seems the linux syscall modify_ldt() isn't implemented correctly. the following code should set errno to ENOSYS, but instead EINVAL is being returned: int main(int ac, char **av) { int lc; /* loop counter */ char *msg; /* message returned from parse_opts */ void *ptr; int retval, func; int flag; int seg[4]; /* parse standard options */ if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) { tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); /*NOTREACHED*/} setup(); /* global setup */ /* The following loop checks looping state if -i option given */ for (lc = 0; TEST_LOOPING(lc); lc++) { /* reset Tst_count in case we are looping */ Tst_count = 0; //block1: /* * Check for ENOSYS. */ tst_resm(TINFO, "Enter block 1"); flag = 0; ptr = (void *)malloc(10); func = 100; retval = modify_ldt(func, ptr, sizeof(ptr)); if (retval < 0) { if (errno != ENOSYS) { tst_resm(TFAIL, "modify_ldt() set invalid " "errno, expected ENOSYS, got: %d", errno); flag = FAILED; } here's the way linux does it: http://fxr.watson.org/fxr/source/arch/x86_64/kernel/ldt.c?v=linux-2.6;im=bigexcerpts#L233 and this is how the syscall was implemented in freebsd: http://fxr.watson.org/fxr/source/i386/linux/linux_machdep.c#L861 here's the modify_ldt() manual: http://linux.about.com/library/cmd/blcmdl2_modify_ldt.htm cheers. oh...and we're talking HEAD of course. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-20090625222531f0889e840000548e-a_best01>