tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: problem with USER_LDT in current 9.99.81
On Monday 26 Apr 2021 19:36:00 Dave Tyson wrote:
> On Tuesday 27 Apr 2021 04:22:22 matthew green wrote:
> > Dave Tyson writes:
> > > I have wine 4.4 working under NetBSD 9.99.23 amd64 (> 1 year ago) and
> > > recently tried against a recent current - 9.99.81.
> > >
> > > Wine now complains:
> > > i386_set_ldt: Operation not permitted
> > > Did you reconfigure the kernel with "options USER_LDT"?
> > >
> > > but GENERIC has the option enabled and strings on the kernel shows:
> > >
> > > _CFG_options \011USER_LDT\011# User-settable LDT, used by Wine
> > > _KERNEL_OPT_USER_LDT
> > >
> > > I am guessing a change between 9.99.23 and 9.99.81 has broken the
> > > functionality, but before I bisect does anyone have any ideas...
> >
> > try this?
> >
> > # sysctl -w machdep.user_ldt=0
> >
> > .mrg.
>
> Thanks for the idea - however machdep.user_ldt was already 0 :-(
>
> I'll pull the older sources and try and find the change which caused the
> problem
>
> Dave
OK, I found the problem:
-------------------------------------------------------------------------
Module Name: src
Committed By: maxv
Date: Fri Apr 24 16:27:28 UTC 2020
Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c
src/sys/arch/amd64/include: gdt.h
src/sys/arch/i386/include: gdt.h
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c svs.c sys_machdep.c
Log Message:
Give the ldt a fixed size of one page (512 slots), and drop the variable-
sized mechanism that was too complex.
This fixes a race between USER_LDT and SVS: during context switches, the
way SVS installs the new ldt relies on the ldt pointer AND the ldt size,
but both cannot be accessed atomically at the same time.
---------------------------------------------------------------------------
This change stops wine 4.4 working. Clearly wine needs more than one page of
space and with the new limit it fails, but the error message is the same as it
you hadn't defined USER_LDT (old way) or set machdep.user_ldt=1 (new way)
which isn't very helpful.
I don't know whether altering the LDT size will have any implications for the
SVS stuff, currently
#define MAX_USERLDT_SIZE PAGE_SIZE
appears in the above include files.
I changed the define to be:
#define MAX_USERLDT_SIZE PAGE_SIZE*2
and a recompiled kernel now allows wine to work correctly.
I don't know how many applications make use of the LDT, but wine is clearly an
important one and maybe if this is an acceptable fix it should be pulled up. I
can file a PR if necessary. Copied to Maxime - though not sure if he is still
involved.
Dave
Home |
Main Index |
Thread Index |
Old Index