From c942f9cc31e46a7e266bf972c454f76fa370a6d3 Mon Sep 17 00:00:00 2001 From: Pierre Beyssac Date: Fri, 3 Aug 2001 18:13:00 +0000 Subject: [PATCH] Force DPL 3 when setting entries on BSD. --- library/ldt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/ldt.c b/library/ldt.c index ca4e062f634..45f155eb863 100644 --- a/library/ldt.c +++ b/library/ldt.c @@ -133,7 +133,12 @@ int wine_ldt_set_entry( unsigned short sel, const LDT_ENTRY *entry ) #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) { - ret = i386_set_ldt(index, (union descriptor *)entry, 1); + LDT_ENTRY entry_copy = *entry; + /* The kernel will only let us set LDTs with user priority level */ + if (entry_copy.HighWord.Bits.Pres + && entry_copy.HighWord.Bits.Dpl != 3) + entry_copy.HighWord.Bits.Dpl = 3; + ret = i386_set_ldt(index, (union descriptor *)&entry_copy, 1); if (ret < 0) { perror("i386_set_ldt");