add linux_emul base, reorganize docs
[openbsd_emul.git] / linux_emul_base / CHANGES
1 2008-08-16
2 Creation of a CHANGES file
3
4 A entry starts with the date followed by a newline and then
5 the content follows. Usualy, the first line after the date
6 is some short description and then a loger follows.
7 To terminate the entry, intert two newlines at the end.
8
9 So this entry serves as an exampe. Hope this is simple enougth :-)
10
11
12 2008-08-16
13 New debugging implemented
14
15 Debug code removed from mem.c and trap.c and rewrote in
16 acid. See the DEBUGGING section in the HOWTO file for further
17 information.
18
19
20 2008-08-17
21 Fontconfig crash fixed, Debug code fixes
22
23 libfontconfig mapped some config files with len == 0, this
24 was not handled correctly so it crashed.
25
26 the umem() acid function didnt check for zero segment
27 pointers so it showd invalid data for the mostly unused
28 SEGSHARED segment.
29
30
31 2008-08-18
32 Some minjor fixes
33
34 more checking in memory manager
35 sys_[gs]etpgrp implemented for pid != current->pid
36 renamed emu.c to main.c
37 set UID/GID/EUID/EGID in AUXVEC on exec()
38
39
40
41 2008-08-21
42 Making prof(1) work (at least dont let it crash)
43
44 mem.c: convertseg():
45
46 Peplaced read() calls to pread() to prevent profiling related crash.
47 The problem was that convertseg() detaches the DATA segment reattaches
48 a new one and used read() to get the contents back. read() was a
49 profiled function and the profiler finds its structures cleared to
50 zero and crashes. We now use pread() that is a unprofiled assembly
51 syscall stub.
52
53 Still, child processes and kprocs are not currently profiled.
54
55
56 2008-08-22
57 AF_UNIX client sockets implemented
58
59 Its a little bit of a hack. We do the AF_UNIX handling like APE
60 does so we can interact with the ported Xservers Xbr and equis.
61
62
63 2008-08-23
64 Work arround for mozilla GPFAULT bug
65
66 If a process is notified that he has pending signals with the
67 "sig" message and if the note interrupts the execution of a
68 INT 0x80 instruction, a syscall in the handler causes mystic
69 crashes i dont understand.
70
71 The work arround detects the condition and delays the
72 handling of the signals returning back to userspace.
73
74 I could reproduce the condition and this hack seems
75 to work. I should write some testcase to analyze this
76 condition further. Maybe its some kernel bug.
77
78
79 2008-08-23
80 Minjor file related fixes/cleanups
81
82 - Implemented in miscdev.c for writable /dev/zero
83 - sys_umask() now returns the previous umask
84 - default umask set to 022
85 - sys_umask() sys_cwd() moved from proc.c to file.c
86
87
88 2008-08-24
89 linuxemu.rc script updated
90
91 - resolve relative rootpath
92 - generate /etc files for hostname and resolv.conf if not readable
93 - removed enviroment user->USER home->HOME conversion in main.c
94
95
96 2008-09-10
97 Better work arround for mozilla GPFAULT bug
98
99 The problem arises because of the handling of notes in Plan9 kernel.
100
101 It happens if linux code does a syscall while here are usernotes (like
102 the "sig" ones) queued in the process note[] array. Then the trap()
103 function in the kernel will enqueue the trap in the queue and the user
104 note gets handled first.
105
106 Now, after we have done a syscall in the note handler of the user
107 signal, notify() gets called in the kernel that detects the next note
108 to be a trap and thinks the note handler itself caused it and kills
109 the process.
110
111 I suggested a patch that makes sure traps get enqued on the head of
112 the note[] array so that they get handled before a user note but its
113 not decided to be applied yet so here is the work arround.
114
115 The work arround avoids posting notes to a process that could possibly
116 cause a trap in the future before the usernote gets handled. (this
117 excluded all linux code because it can issure a syscall anytime) The
118 only time it is save to post notes is if we are in linuxemu syscall
119 handler.
120
121 This is mostly the case anyway when notes are used to interrupt
122 blocking syscalls (waking a process sleeping in a sigsuspend for
123 example)
124
125 Linuxcode that would spin in a endless loop will not be interrupted by
126 notes/signals anymore.
127
128
129 2008-09-20
130 Minjor stuff
131
132 Masking more fp-errors in trap.c. (To get some dos game running in
133 bochs)
134
135 prboom and zsnes was bumpy sometimes because our select() didnt set
136 the struct timeval *tvp to the time the select call did not slept.
137
138 I stat function pointer was removed from the Ufile struct and all the *dev.c
139 files. I have no need to return custom stats from the devices right now
140 (except for /dev/zero (mode & 0222)) so i move the only case where its
141 needed into the hackish dir2statmode function in p9dev.c. Here is also
142 an fd field added to the generic Ufile scruct because most of all devices
143 use plan9 filedescriptors at some point and we use it in fstat(). Saves some
144 casting and fstat can use the fd (when its available) to make a dirstat() and
145 convert to linux format.
146
147 For the postnote stuff mentiond in the last changes entry, here is a global
148 flag in main.c (notehack = 1) to enable/disable the work arround.
149
150
151 2008-09-21
152 atime/mtime, AT_CLKTCK
153
154 new syscalls
155 - sys_utime
156 - sys_utimes
157 - sys_times
158
159 the AT_CLKTCK entry in exec is set to _tos->cyclefreq
160 now.
161
162
163 2008-10-05
164 faster death proc detection
165
166 Using linuxemu from terminal caused huge network load
167 because we did a lookup of /proc/# on every timer round.
168
169 now we keep open filedescriptors for /proc/#/args and
170 /proc/#/note in the proc structure and only check for
171 dead procs every second.
172
173
174 2008-10-05
175 sound (/dev/dsp)
176
177 OSS sound implemented, its only tested with some SDL
178 apps (zsnes, prboom).
179
180 The output frequency is hardcoded at 44100 Hz and 2
181 channels stereo at the moment.
182
183
184 2008-10-20
185 dsp, stat, mkfile, -d, dns, fs
186
187 dspdev detects output frequency now and implement more
188 ioctls.
189
190 here is an universal Ustat and Udirent structs to separate
191 the linux formats from driver code.
192
193 big chnage in all devices, added indirection layer fs.c that
194 has some kind of mapping from path -> device and forwards
195 filesystem calls to device drivers. now drivers can return
196 correct stat information.
197
198 this is needed for implementing /dev/pts later.
199
200 removed the /etc/(hosts resolve.conf) generation code from
201 linuxemu.rc because they dont work in some cases and
202 cause maintence nightmares.
203
204 use the -d switch for turning on trace to stderr. so we dont
205 need to always change the if(0) from trace.c and recompile.
206
207 force compiler flags in mkfile, the -T from new mkone breaks
208 build on current distribution.
209
210
211 2008-10-27
212 lots of fixes
213
214 - off by one error basepath()
215 - chmod used access which resolves always to link target
216 - runlink
217 - the note hack broke sigprocmask, and sometimes failed
218 to interrupt a sleepproc(). this is now handled in
219 interruptproc(). (this makes drawterm work on linuxemu)
220 - write() to pty was not synchronized/not blocking that
221 caused some apps to spin in write() or others to drop
222 characters (curses).
223
224
225 2008-10-28
226 grow filedescriptor table in dup2
227
228 - if the new fd supplied is out if range, dont return error but
229 grow the fdtab so it fits in. (this make configure work)
230
231 2008-11-15
232 lots of changes
233
234 - Updated HOWTO
235
236 - included <ureg.h> in some modules. this fixed the type
237 signature errors of 8l when compiling with -T flag.
238
239 - fixed bug in exec()
240 exec needs to run outside the the note context, because it
241 is deleting memory segments and that can cause the removal
242 of the stack segment as well. we have to set current->syscall
243 to nil to avoid getting a note posted that could interrupt us in
244 the middle of some malloc() or something.
245
246 - sys_pipe() FD_CLOEXEC
247 sys_pipe() create the filedescriptors with FD_CLOEXEC bit
248 set as open() does. this is wrong and caused gimp plugins
249 to fail.
250
251 - new signal handling code
252 signal.c has changed a bit. now CLONE_THREAD procs
253 share a signal queue and proc() uses wantsignal() to
254 figure out what process to interrupt.
255
256 - restartable syscalls
257 re process SA_RESTART flag now and are able to restart syscalls
258 that got interrupted by such signals. sleepproc() returns -ERESTART
259 by default now. sys_poll() and sys_sleep() will return -EINTR in
260 any case.
261
262 - fs reorganized, [sg]etxattr added, p9cwd added as an optimization
263 to avoid walks().
264
265 - ptydev emits SIGINTR to process group, added tty to Uproc.
266
267 - added fddev (/dev/fd)
268
269 - exitproc() now emits SIGCHLD.
270
271 - mem.c: addrok() now takes a prot flags parameter so we can test
272 for expected memory protection too.
273
274 - profme(): profiling support for child processes added
275
276 - initialization completly moved in main()
277
278 - fchmod, fchown, ftruncate moved to file.c
279
280
281 2008-10-19
282 just code dressing...
283
284 renamed some files, added typedef for Ureg, abstracted syscall specific
285 code in linuxcall.c, more tracing...
286
287
288 2009-02-06
289 Fixed the opera fork() no more threads bug
290
291 There was a problem of dns resolver zombie processes created by
292 operseemed that used up all the process table due to incomplete
293 implementation of clone(). Linux specified a exit signal in the lower
294 byte of the clone- flags parameter to tell if the process should hang
295 arround as zombie so that the parent can wait for it. If no signal is
296 specified here, then the process should exit without becoming a
297 zombie. Here is also the case that the parent ignores the SIGCHLD
298 signal or has SA_NOCHLDWAIT flags on the SIGCHLD set. In that case
299 the child should also purge itself. I implemented reparenting,
300 because i suspected the bug there but this was not the case.
301
302 Here is a new uprocs() acid function that dumps the proctab.
303
304
305 2009-02-18
306 Minjor changes
307
308 Added anonymous area merging to reduce the area count and removed
309 redundant clearmem calls. Changed Uwaitq lock from QLock to normal
310 spinlock. Removed some trace() calls.
311
312 The biggest change is that linuxemu.rc now is able to start equis. This
313 simplyfies writing wrapper scripts to start a browser or other X11 apps.
314
315
316 2009-03-25
317 Simplyfied area merging in memory manager
318
319 Areas are doubly linked now so its easier to get the previous area for
320 mergearea().
321
322
323 2009-03-30
324 Fixed man-bug. (Restarting syscalls)
325
326 Restarting syscalls failed if the singal that was send to the interrupted
327 process was blocked. This is fixed now.
328
329
330 2009-04-01
331 fixed awd-bug (use builtin cd), make errors more verbose in exec.c
332
333 bla
334
335 2009-05-11
336 fix pipeseek, added pread64, pwrite64 syscalls.
337
338 forgot to return -ESPIPE on seekpipe.
339 implemented pread64/pwrite64 (needed by git).
340
341
342 2009-07-25
343 random stuff
344
345 - incred bufproc read and queuesize to 4K/64K (fixes links2 -g hang)
346 - reuse buffers in bufproc
347 - cleanup timer stuff, introduce 5ms min sleep time, avoid interrupt note
348 - fix sys_select() to always modify tv
349 - fix format mismatch in nextsignal
350 - dont combine in sys_readv/sys_writev
351 - fix open in devdsp.c
352 - s/memcpy/memmove/g
353 - dont reset segment registers for signal handlers
354 - possibly more that i forgot... use history(1)
355
356
357 2009-07-27
358 fixed audio delay
359
360 keeping track of how many samples (time) has been submitted
361 to /dev/audio already and wait when the buffer grows over some
362 treshold. this removes the audio delay from games :)
363
364
365 2009-07-29
366 doc
367
368 put documentation in doc subdirectory.
369
370
371 2009-07-31
372 mremap, segbrk shrinking, pagesize, doc
373
374 rewrote mremap implementation to correctly clear area for shrinking.
375 handles more error cases and checks for overlap. this fixes the gimp
376 invalid pointer bug.
377
378 removed segment shrinking with segbrk as this feature may be removed
379 in newer kernel versions as it introduced a bug where it is possible to
380 unmap pages while the kernel touches them and cause a panic.
381
382 removed the ROUNDPAGE() macro from dat.h. heres a pagealign()
383 function in mem.c now and the global variable pagesize that is initialized
384 in main.
385
386 some documentation cleanups.
387
388
389 2009-08-24
390 dspdev improvements.
391
392 do some linear interpolation in audio resampling to get better sound quality.
393 avoid copy when no resampling is required. reflect queue full in
394 GETOSPACE ioctl. cleanup code to avoid vlong calculations.
395
396
397 2009-08-26
398 bugs
399
400 fixed uninitialized values in stat wich caused -EOVERFLOW on linux
401 kernel build. removed wakeableproc() (changes in signal.c, ptydev.c,
402 bufproc.c, poll.c). fixed sigsuspend race. simpler waitq code (uses
403 lesser memory too). fixed waitpid race. added /dev/dsp0 to dspdev
404 (makes mikmod work). fixed rfork/notify crash.
405
406
407 2009-08-30
408 mplayer, bb, audacity play cursor, bugs
409
410 refactored timers, alarm and deadproccheck into one timerproc and
411 removed timer.c. every Uproc has a timeout field now that is the
412 time in nanoseconds when the timeout expires. on expiration, the
413 timerproc sets the value to zero and does a wakeup on the
414 timed out process. a process sets/resets its timeout with
415 settimeout(delta). the remaining time in ms can be queried with
416 timeoutremain().
417
418 fixed missing protection flags in setupstack.
419
420 more acurate GETOSPACE (mplayer, bb) and new GETOPTR
421 ioctl (needed for audacity play cursor) in dspdev.c.
422
423 handle kill note as SIGKILL in trap.c.
424
425 handle illegal instruction as SIGILL as pass/restore sigcontext
426 (needed for mplayer runtime SSE check).
427
428 sys_sigreturn now uses current->ureg->sp to find the restore
429 information.
430
431 preallocate all Uprocs.
432
433
434 2009-09-06
435 cleanup
436
437 removed dev argument from fdgetfile()
438
439 return correct -ENOSOCK in socketcall()
440
441 fixed pread/pwrite, dev->read/dev-write now take a offset
442 argument.
443
444 fixed time diff overflow in dspdev
445
446
447 2009-09-08
448 fuckup, O_TRUNC, restaring syscalls, rc, getdents
449
450 fucked up:
451 - seek didnt work for whence == 1 as the plan9 seek pointer was
452 never moved in read due to change to pread. this caused cp to
453 corrupt the output file when it skipped null blocks.
454 - basepath in fs.c was broken
455 - readv/writev didnt increment the file offset
456
457 what we have now is that file.c does all the offset tracking, and
458 devices provide a size() function that returns the actual file size.
459
460 added O_TRUNC for open.
461
462 signal restarting sometimes resulted in returning -ERESTART to
463 userspace. this could happen when another thread had stolen
464 our signal. we now restart the syscall in nextsignal() even if
465 here was no signal pending for us.
466
467 removed the exitsig function from linuxemu.rc as we can use
468 the -terminate option of the xserver to get it shutdown.
469
470 read the whole directory, then calculate file offset for directory
471 entries.
472
473
474 2009-09-12
475 signal handling changes, acid, rc
476
477
478 2009-09-20
479 sockets, basepath, alarm
480
481 fixed error in basepath (*ps vs ps) and implemented nonblocking connect,
482 server sockets, socketpair, sys_alarm
483
484
485 2009-10-13
486 lots of changes
487
488 simplified locking by making process wakeup non blocking.
489 to not miss wakeups, the to be suspended proc should call wakeme(1)
490 before it goes to sleep.
491
492 timers for alarm/itimer have been moved to the per "process" signal
493 data. current->timeout is still local to the current "thread".
494
495 sys_kill() now makes sure we only send one signal per "process".
496
497 syscall restarting now can use the Urestart (current->restart)
498 structure to remember state. (implemented for nanosleep, poll and
499 select)
500
501 changed default to non tracing.
502
503 pty now handles winsize changes. fixing current tty changing. (ssh bug,
504 rxvt bug)
505
506 added /dev/random and /dev/urandom to miscdev.
507
508 more ioctls for dspdev.
509
510 enforce non reentancy for traps.
511
512
513 2009-10-15
514 fixed sys_brk()
515
516 we now use a separate segment for the BSS and dont intermix mmap and brk.
517 thanks jibanes for reporting!
518
519
520 2010-02-27
521 futex, TLS, mprotect
522
523 implemented sys_futex() finally
524
525 changed tls to use the new /dev/gdt interface to change its
526 process segment descriptors
527
528 fixed mprotect
529
530
531 20010-04-30
532 linuxemu.rc gone, documentation
533
534 removed linuxemu.rc and replaced it with linux.
535
536 usage: linux [-h] [-d...] [-u uid] [-g gid] [-startx] [-display :n] [-e emubin] [-r linuxroot] command [args ...]
537
538 linuxroot is now an optional parameter (-r). it will default to /sys/lib/linux.
539
540 dont hide /lib/tls anymore and bind devarch. if you dont want to
541 patch your kernel with the segdescr patch and use mroot[-linuxemu].tbz
542 you can rename /lib/tls to /lib/_tls_disabled_.
543
544
545 2010-05-02
546 exit_group, exec, futex, waitpid, quoted arguments
547
548 properly implement exit_group and zap all threads. notify
549 all parent threads.
550
551 zap threads in exec.
552
553 implement FUTEX_REQUEUE and FUTEX_CMP_REQUEUE.
554
555 handle WALL, WCLONE and WNOHANG in waitpid.
556
557 preserve quoted arguments to linux.
558
559
560 2010-05-11
561 select/poll and EBADF, execve malloc, set_thread_area, initproc, SIGSTOP/SIGCONT,
562 tty, getsid, getpeeraddr, /proc
563
564 select and poll never return -EBADF but ignore the offending
565 filedescriptor. this is wrong in the manpage! (this was needed
566 to survive the python configure script)
567
568 handle malloc errors in execve and dont panic when elf
569 loading fails but kill the process.
570
571 detect empty descriptors in set_thread_area so descriptors
572 can be freed.
573
574 move some of the initialization from main to initproc.
575
576 SIGSTOP/SIGCONT handling now works for thread groups. for this
577 we now have stopproc() and contproc() that are called from the
578 signal code when SIGSTOP or SIGCONT signal is received. each Uproc
579 now has a traceproc callback that is called when we enter or
580 exit the kernel. zapthreads() and stopproc() use this to get all threads
581 in the wanted state. for stopped procs, waiting happens in
582 the signal code so calling handlesignals() of a stopped proc will
583 block until it gets killed or continued.
584
585 new fields in Uproc:
586 traceproc, tracearg - called when entering or exiting the kernel
587 wstate - current wait state of this process. WEXITED, WSTOPPED, WCONTINUED.
588 wevent - like wstate, but reset by waitpid
589 comm - double null terminated string array. first entry is the full exe name
590 followd by the exeve arguments.
591
592 heres a new format %S for signal numbers.
593
594 the per thread tty is gone. the tty is now in the per process signal queue.
595 gettty() and settty() can be used to modify it. ptydev now allows opening
596 the slave tty multiple times. (fixes midnight commander error)
597
598 implemented sys_getsid().
599
600 fix AF_INET padding and byte order for getpeername socketcall.
601
602 implemented /proc (procdev). fddev is gone. /dev/tty handled by
603 ptydev now. this makes pkill, ps, top and inkscape work!
604
605
606 2010-05-28
607 fixed pipe filedescriptor leak in AF_UNIX
608
609 we leaked the sock->other descriptor when failing to connect
610 a AF_UNIX socket. thanks yarikos for reporting!
611
612
613 2011-08-05
614 rename to existing symlink target bug, profine -> profile
615
616 renaming a symlink to a existing symlink would cause the
617 file file to be renamed to .udir.L.udir.L....
618
619 fix profine/profile typo
620
621 2014-11-20
622 change uname release to 3.2.1 to make debian 7.0 not complain
623 (thanks henesy)