diff -Naur -X exclude-files ac_cur/CREDITS ac/CREDITS --- ac_cur/CREDITS Sat Nov 3 16:12:54 2001 +++ ac/CREDITS Sat Nov 3 16:13:22 2001 @@ -434,6 +434,7 @@ E: lars@nocrew.org W: http://lars.nocrew.org/ D: dsp56k device driver +D: ptrace proxy in user mode kernel port S: Kopmansg 2 S: 411 13 Goteborg S: Sweden diff -Naur -X exclude-files ac_cur/arch/um/Makefile ac/arch/um/Makefile --- ac_cur/arch/um/Makefile Sat Nov 3 16:12:55 2001 +++ ac/arch/um/Makefile Sat Nov 3 16:13:22 2001 @@ -2,7 +2,7 @@ include/linux/version.h: arch/$(ARCH)/Makefile -ARCH_DIR = $(TOPDIR)/arch/um +ARCH_DIR = arch/um MAKEBOOT = $(MAKE) -C $(ARCH_DIR)/boot @@ -34,7 +34,7 @@ NESTING = 0 -ARCH_INCLUDE = $(ARCH_DIR)/include +ARCH_INCLUDE = $(TOPDIR)/$(ARCH_DIR)/include CFLAGS += $(DEBUG) $(PROFILE) $(ARCH_CFLAGS) -D__arch_um__ \ -DSUBARCH=\"$(SUBARCH)\" -DNESTING=$(NESTING) -D_LARGEFILE64_SOURCE \ @@ -44,10 +44,9 @@ LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc -$(ARCH_DIR)/link.ld: +$(ARCH_DIR)/link.ld: $(ARCH_DIR)/link.ld.in m4 -DSTART=$(START_ADDR) -DSUBARCH=$(SUBARCH) \ - -DELF_SUBARCH=$(ELF_SUBARCH) \ - $(ARCH_DIR)/link.ld.in > $(ARCH_DIR)/link.ld + -DELF_SUBARCH=$(ELF_SUBARCH) $< > $@ SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \ include/asm-um/sigcontext.h include/asm-um/processor.h @@ -58,18 +57,18 @@ mv vmlinux vmlinux.o $(CC) -Wl,-T,$(ARCH_DIR)/link.ld $(LINK_PROFILE) $(LINK_WRAPS) \ -o linux -static $(ARCH_DIR)/main.o vmlinux.o -L/usr/lib - rm -f $(ARCH_DIR)/link.ld USER_CFLAGS := $(patsubst -I%,,$(CFLAGS)) USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS)) USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) -I$(ARCH_INCLUDE) $(ARCH_DIR)/main.o: $(ARCH_DIR)/main.c - $(CC) -D__KERNEL__ $(USER_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + $(CC) $(USER_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< archmrproper: $(MAKE) -C $(ARCH_DIR)/sys-$(SUBARCH) archmrproper rm -f $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) include/asm \ + $(ARCH_DIR)/link.ld \ $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) archclean: diff -Naur -X exclude-files ac_cur/arch/um/config.in ac/arch/um/config.in --- ac_cur/arch/um/config.in Sat Nov 3 16:12:55 2001 +++ ac/arch/um/config.in Sat Nov 3 16:13:22 2001 @@ -98,6 +98,7 @@ mainmenu_option next_comment comment 'Kernel hacking' +bool 'Debug memory allocations' CONFIG_DEBUG_SLAB bool 'Enable kernel debugging symbols' CONFIG_DEBUGSYM dep_bool 'Enable ptrace proxy' CONFIG_PT_PROXY $CONFIG_DEBUGSYM dep_bool 'Enable gprof support' CONFIG_GPROF $CONFIG_DEBUGSYM diff -Naur -X exclude-files ac_cur/arch/um/defconfig ac/arch/um/defconfig --- ac_cur/arch/um/defconfig Sat Nov 3 16:12:55 2001 +++ ac/arch/um/defconfig Sat Nov 3 16:13:22 2001 @@ -53,7 +53,8 @@ # # Networking options # -# CONFIG_PACKET is not set +CONFIG_PACKET=y +CONFIG_PACKET_MMAP=y CONFIG_NETLINK=y # CONFIG_RTNETLINK is not set # CONFIG_NETLINK_DEV is not set @@ -115,19 +116,12 @@ # # Ethernet (1000 Mbit) # -# CONFIG_ACENIC is not set # CONFIG_ACENIC_OMIT_TIGON_I is not set -# CONFIG_DL2K is not set -# CONFIG_MYRI_SBUS is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_SK98LIN is not set # CONFIG_FDDI is not set # CONFIG_HIPPI is not set # CONFIG_PLIP is not set CONFIG_PPP=y # CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set # CONFIG_PPP_ASYNC is not set # CONFIG_PPP_SYNC_TTY is not set # CONFIG_PPP_DEFLATE is not set @@ -148,7 +142,6 @@ # # CONFIG_TR is not set # CONFIG_NET_FC is not set -# CONFIG_RCPCI is not set # CONFIG_SHAPER is not set # @@ -159,15 +152,12 @@ # # Network device support # -CONFIG_NETDEVICES=y CONFIG_UML_NET=y CONFIG_UML_NET_ETHERTAP=y CONFIG_UML_NET_TUNTAP=y CONFIG_UML_NET_SLIP=y CONFIG_UML_NET_DAEMON=y CONFIG_UML_NET_MCAST=y -CONFIG_ETHERTAP=y -CONFIG_TUN=y # # File systems @@ -178,7 +168,6 @@ CONFIG_REISERFS_FS=m # CONFIG_REISERFS_CHECK is not set # CONFIG_ADFS_FS is not set -# CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set @@ -188,6 +177,7 @@ CONFIG_VFAT_FS=m # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set +# CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set # CONFIG_TMPFS is not set # CONFIG_RAMFS is not set @@ -196,7 +186,6 @@ CONFIG_MINIX_FS=m # CONFIG_VXFS_FS is not set # CONFIG_NTFS_FS is not set -# CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y CONFIG_DEVFS_FS=y @@ -204,36 +193,22 @@ # CONFIG_DEVFS_DEBUG is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set -# CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_UDF_FS is not set -# CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set -# CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set # CONFIG_NFS_FS is not set -# CONFIG_NFS_V3 is not set -# CONFIG_ROOT_NFS is not set # CONFIG_NFSD is not set -# CONFIG_NFSD_V3 is not set # CONFIG_SUNRPC is not set # CONFIG_LOCKD is not set # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set -# CONFIG_NCPFS_PACKET_SIGNING is not set -# CONFIG_NCPFS_IOCTL_LOCKING is not set -# CONFIG_NCPFS_STRONG is not set -# CONFIG_NCPFS_NFS_NS is not set -# CONFIG_NCPFS_OS2_NS is not set -# CONFIG_NCPFS_SMALLDOS is not set -# CONFIG_NCPFS_NLS is not set -# CONFIG_NCPFS_EXTRAS is not set # # Partition Types @@ -287,6 +262,7 @@ # # Kernel hacking # +# CONFIG_DEBUG_SLAB is not set CONFIG_DEBUGSYM=y CONFIG_PT_PROXY=y # CONFIG_GPROF is not set diff -Naur -X exclude-files ac_cur/arch/um/drivers/etap.h ac/arch/um/drivers/etap.h --- ac_cur/arch/um/drivers/etap.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/etap.h Sat Nov 3 16:13:22 2001 @@ -16,6 +16,7 @@ }; extern struct net_user_info ethertap_user_info; + extern int etap_user_write(int fd, void *buf, int len, struct ethertap_data *pri); extern int etap_user_read(int fd, void *buf, int len, diff -Naur -X exclude-files ac_cur/arch/um/drivers/mconsole_kern.c ac/arch/um/drivers/mconsole_kern.c --- ac_cur/arch/um/drivers/mconsole_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/mconsole_kern.c Sat Nov 3 16:13:22 2001 @@ -23,19 +23,18 @@ extern int get_request(int fd, struct mconsole_request *req); extern void handle_request(struct mconsole_request *req); -static int do_unlink_socket(struct notifier_block *, unsigned long, void *); +static int do_unlink_socket(struct notifier_block *notifier, + unsigned long what, void *data) +{ + return(mconsole_unlink_socket()); +} + static struct notifier_block reboot_notifier = { notifier_call: do_unlink_socket, priority: 0, }; -int do_unlink_socket(struct notifier_block *notifier, unsigned long what, - void *data) -{ - return(unlink_socket()); -} - LIST_HEAD(mc_requests); void mc_task_proc(void *unused) @@ -51,7 +50,7 @@ list_del(&req->list); done = list_empty(&mc_requests); restore_flags(flags); - handle_request(&req->request); + mconsole_handle_request(&req->request); kfree(req); } while(!done); } @@ -68,7 +67,7 @@ struct mconsole_request req; fd = (int) dev_id; - while (get_request(fd, &req)) { + while (mconsole_get_request(fd, &req)) { new = kmalloc(sizeof(req), GFP_ATOMIC); if(new == NULL) mconsole_reply(&req, "ERR Out of memory"); @@ -201,7 +200,7 @@ int err; int sock; - sock = create_listening_socket(); + sock = mconsole_create_listening_socket(); if (sock < 0) { printk("Failed to initialize management console\n"); return 1; @@ -217,7 +216,7 @@ return 1; } - printk("mconsole initialized on %s\n", socket_name); + printk("mconsole initialized on %s\n", mconsole_socket_name); return 0; } diff -Naur -X exclude-files ac_cur/arch/um/drivers/mconsole_user.c ac/arch/um/drivers/mconsole_user.c --- ac_cur/arch/um/drivers/mconsole_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/mconsole_user.c Sat Nov 3 16:13:22 2001 @@ -26,7 +26,7 @@ { "help", mconsole_help }, }; -char socket_name[256]; +char mconsole_socket_name[256]; static int has_correct_credentials(struct msghdr *msg) { @@ -48,7 +48,7 @@ return 0; } -int get_request(int fd, struct mconsole_request *req) +int mconsole_get_request(int fd, struct mconsole_request *req) { char anc[64]; struct iovec iov; @@ -98,13 +98,13 @@ return sendmsg(req->originating_fd, &msg, 0); } -int unlink_socket(void) +int mconsole_unlink_socket(void) { - unlink(socket_name); + unlink(mconsole_socket_name); return 0; } -int create_listening_socket(void) +int mconsole_create_listening_socket(void) { struct sockaddr_un addr; char file[256]; @@ -121,7 +121,7 @@ if(umid_file_name("mconsole", file, sizeof(file))) return(-1); - strcpy(socket_name, file); + strcpy(mconsole_socket_name, file); strcpy(addr.sun_path, file); err = bind(sock, (struct sockaddr *) &addr, sizeof(addr)); @@ -138,7 +138,7 @@ return sock; } -void handle_request(struct mconsole_request *req) +void mconsole_handle_request(struct mconsole_request *req) { struct mconsole_command *cmd; int i; diff -Naur -X exclude-files ac_cur/arch/um/drivers/mmapper_kern.c ac/arch/um/drivers/mmapper_kern.c --- ac_cur/arch/um/drivers/mmapper_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/mmapper_kern.c Sat Nov 3 16:13:22 2001 @@ -117,7 +117,7 @@ { printk(KERN_INFO "Mapper v0.1\n"); - p_buf = find_iomem("mmapper", &mmapper_size); + p_buf = (char *) find_iomem("mmapper", &mmapper_size); v_buf = p_buf; diff -Naur -X exclude-files ac_cur/arch/um/drivers/tuntap_kern.c ac/arch/um/drivers/tuntap_kern.c --- ac_cur/arch/um/drivers/tuntap_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/tuntap_kern.c Sat Nov 3 16:13:22 2001 @@ -109,8 +109,6 @@ dev->user = &tuntap_user_info; dev->kern = &tuntap_kern_info; - dev->user = &tuntap_user_info; - dev->kern = &tuntap_kern_info; dev->private_size = sizeof(struct tuntap_data); pri = &tuntap_priv[tuntap_count]; dev->transport_index = tuntap_count++; diff -Naur -X exclude-files ac_cur/arch/um/drivers/ubd_user.c ac/arch/um/drivers/ubd_user.c --- ac_cur/arch/um/drivers/ubd_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/drivers/ubd_user.c Sat Nov 3 16:13:22 2001 @@ -17,6 +17,7 @@ #include #include #include +#include #include "user_util.h" #include "kern_util.h" #include "user.h" diff -Naur -X exclude-files ac_cur/arch/um/include/kern_util.h ac/arch/um/include/kern_util.h --- ac_cur/arch/um/include/kern_util.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/include/kern_util.h Sat Nov 3 16:13:22 2001 @@ -38,7 +38,7 @@ extern void set_tracing(void *t, int tracing); extern int is_tracing(void *task); extern int segv_syscall(void); -extern void ret_from_sys_call(void *t); +extern void ret_from_sys_call(void); extern void kern_finish_exec(void *task, int new_pid, unsigned long stack); extern int page_size(void); extern int page_mask(void); @@ -75,7 +75,7 @@ extern int switching_modes(void *t); extern void idle_timer(void); extern unsigned int do_IRQ(int irq, int user_mode); -extern int external_pid(void *t); +extern int external_pid(void); extern void boot_timer_handler(int sig); extern void interrupt_end(void); extern void tracing_reboot(void); diff -Naur -X exclude-files ac_cur/arch/um/include/mconsole.h ac/arch/um/include/mconsole.h --- ac_cur/arch/um/include/mconsole.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/include/mconsole.h Sat Nov 3 16:13:22 2001 @@ -23,9 +23,9 @@ void (*handler)(struct mconsole_request *req); }; -extern char socket_name[]; +extern char mconsole_socket_name[]; -extern int unlink_socket(void); +extern int mconsole_unlink_socket(void); extern int mconsole_reply(struct mconsole_request *req, char *reply); extern void mconsole_version(struct mconsole_request *req); extern void mconsole_help(struct mconsole_request *req); @@ -34,6 +34,9 @@ extern void mconsole_config(struct mconsole_request *req); extern void mconsole_remove(struct mconsole_request *req); extern void mconsole_sysrq(struct mconsole_request *req); +extern void mconsole_handle_request(struct mconsole_request *req); +extern int mconsole_create_listening_socket(void); +extern int mconsole_get_request(int fd, struct mconsole_request *req); #endif diff -Naur -X exclude-files ac_cur/arch/um/include/sysdep-i386/syscalls.h ac/arch/um/include/sysdep-i386/syscalls.h --- ac_cur/arch/um/include/sysdep-i386/syscalls.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/include/sysdep-i386/syscalls.h Sat Nov 3 16:13:22 2001 @@ -12,6 +12,7 @@ extern syscall_handler_t sys_modify_ldt; extern syscall_handler_t old_mmap_i386; extern syscall_handler_t old_select; +extern syscall_handler_t sys_ni_syscall; #define ARCH_SYSCALLS \ [ __NR_mmap ] = old_mmap_i386, \ @@ -39,9 +40,12 @@ [ __NR_setfsgid32 ] = sys_setfsgid, \ [ __NR_pivot_root ] = sys_pivot_root, \ [ __NR_mincore ] = sys_mincore, \ - [ __NR_madvise ] = sys_madvise, + [ __NR_madvise ] = sys_madvise, \ + [ 222 ] = sys_ni_syscall, + +/* 222 doesn't yet have a name in include/asm-i386/unistd.h */ -#define LAST_SYSCALL __NR_fcntl64 +#define LAST_ARCH_SYSCALL 222 /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -Naur -X exclude-files ac_cur/arch/um/include/sysdep-ppc/syscalls.h ac/arch/um/include/sysdep-ppc/syscalls.h --- ac_cur/arch/um/include/sysdep-ppc/syscalls.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/include/sysdep-ppc/syscalls.h Sat Nov 3 16:13:22 2001 @@ -36,7 +36,7 @@ [ __NR_madvise ] = sys_madvise, \ [ __NR_mincore ] = sys_mincore, -#define LAST_SYSCALL __NR_mincore +#define LAST_ARCH_SYSCALL __NR_mincore /* * Overrides for Emacs so that we follow Linus's tabbing style. diff -Naur -X exclude-files ac_cur/arch/um/include/umid.h ac/arch/um/include/umid.h --- ac_cur/arch/um/include/umid.h Sat Nov 3 16:12:55 2001 +++ ac/arch/um/include/umid.h Sat Nov 3 16:13:22 2001 @@ -3,7 +3,6 @@ * Licensed under the GPL */ -extern int set_umid(char *name); extern int umid_file_name(char *name, char *buf, int len); /* diff -Naur -X exclude-files ac_cur/arch/um/include/user_util.h ac/arch/um/include/user_util.h --- ac_cur/arch/um/include/user_util.h Sat Nov 3 16:13:06 2001 +++ ac/arch/um/include/user_util.h Sat Nov 3 16:13:22 2001 @@ -42,6 +42,8 @@ extern int gdb_pid; +extern char *tempdir; + extern void *open_maps(void); extern int read_map(void *fd, unsigned long *start_out, unsigned long *end_out, char *r_out, char *w_out, @@ -116,10 +118,9 @@ extern void do_exec(int old_pid, int new_pid); extern void tracer_panic(char *msg, ...); extern void close_fd(int); +extern int make_tempfile(const char *template, char **tempname, int do_unlink); extern char *get_umid(void); extern void ptrace_cont_pid(int pid); -extern void create_pid_file(char *name); -extern int load_initrd(char *filename, void *buf, int size); extern int ptrace_getregs(long pid, struct sys_pt_regs *regs_out); extern int ptrace_setregs(long pid, struct sys_pt_regs *regs_in); extern void do_longjmp(void *p); diff -Naur -X exclude-files ac_cur/arch/um/kernel/Makefile ac/arch/um/kernel/Makefile --- ac_cur/arch/um/kernel/Makefile Sat Nov 3 16:13:06 2001 +++ ac/arch/um/kernel/Makefile Sat Nov 3 16:13:22 2001 @@ -19,6 +19,11 @@ DMODVERSIONS = -D__CONFIG_MODVERSIONS__ endif +ifeq ($(CONFIG_GPROF), y) + OBJS += gprof_syms.o + export-objs += gprof_syms.o +endif + CFLAGS_user_syms.o = -D__AUTOCONF_INCLUDED__ $(DMODULES) $(DMODVERSIONS) -I- \ -I../include diff -Naur -X exclude-files ac_cur/arch/um/kernel/gprof_syms.c ac/arch/um/kernel/gprof_syms.c --- ac_cur/arch/um/kernel/gprof_syms.c Wed Dec 31 19:00:00 1969 +++ ac/arch/um/kernel/gprof_syms.c Sat Nov 3 16:13:22 2001 @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2001 Jeff Dike (jdike@karaya.com) + * Licensed under the GPL + */ + +#include "linux/module.h" + +extern void mcount(void); +EXPORT_SYMBOL(mcount); + +extern void __bb_init_func(void *); +EXPORT_SYMBOL(__bb_init_func); + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff -Naur -X exclude-files ac_cur/arch/um/kernel/irq_user.c ac/arch/um/kernel/irq_user.c --- ac_cur/arch/um/kernel/irq_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/irq_user.c Sat Nov 3 16:13:22 2001 @@ -81,7 +81,7 @@ "errno = %d\n", fd, errno); return(-retval); } - pid = external_pid(NULL); + pid = external_pid(); if((retval = fcntl(fd, F_SETOWN, pid)) < 0){ printk("Failed to fcntl F_SETOWN fd %d to pid %d, " "errno = %d\n", pid, errno); @@ -93,7 +93,7 @@ new_fd->id = dev_id; new_fd->irq = irq; new_fd->fd = fd; - new_fd->pid = external_pid(NULL); + new_fd->pid = external_pid(); active_fds = new_fd; if(fd > max_fd) max_fd = fd; FD_SET(fd, &active_fd_mask); diff -Naur -X exclude-files ac_cur/arch/um/kernel/ksyms.c ac/arch/um/kernel/ksyms.c --- ac_cur/arch/um/kernel/ksyms.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/ksyms.c Sat Nov 3 16:13:22 2001 @@ -21,3 +21,5 @@ EXPORT_SYMBOL(__do_strncpy_from_user); EXPORT_SYMBOL(flush_tlb_range); EXPORT_SYMBOL(__do_clear_user); +EXPORT_SYMBOL(honeypot); +EXPORT_SYMBOL(host_task_size); diff -Naur -X exclude-files ac_cur/arch/um/kernel/process_kern.c ac/arch/um/kernel/process_kern.c --- ac_cur/arch/um/kernel/process_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/process_kern.c Sat Nov 3 16:13:22 2001 @@ -49,11 +49,9 @@ return(ret); } -int external_pid(void *t) +int external_pid(void) { - struct task_struct *task = t; - if(task == NULL) task = current; - return(task->thread.extern_pid); + return(current->thread.extern_pid); } void free_stack(unsigned long stack) @@ -71,8 +69,7 @@ struct task_struct *task; int ret; - if(t == NULL) task = current; - else task = t; + task = t ? t : current; if(on == task->thread.tracing) return(on); ret = task->thread.tracing; task->thread.request.op = on ? OP_TRACE_ON : OP_TRACE_OFF; @@ -89,11 +86,7 @@ int is_tracing(void *t) { - struct task_struct *task; - - if(t == NULL) task = current; - else task = t; - return(task->thread.tracing); + return (((struct task_struct *) t)->thread.tracing); } extern void schedule_tail(struct task_struct *prev); @@ -113,7 +106,7 @@ task->thread.extern_pid = pid; stop_pid(pid); set_cmdline("(kernel thread)"); - flush_tlb_all(); + force_flush_all(); if(current->thread.request.u.cswitch.from != NULL) schedule_tail(current->thread.request.u.cswitch.from); (*fn)(arg); @@ -210,22 +203,20 @@ to = next; current->thread.request.op = OP_SWITCH; current->thread.request.u.cswitch.to = next; + forward_interrupts(to->thread.extern_pid); block_signals(); usr1_pid(getpid()); flush_tlb_all(); unblock_signals(); + return(current->thread.request.u.cswitch.from); } -void ret_from_sys_call(void *t) +void ret_from_sys_call(void) { - struct task_struct *task; - - task = t; - if(task == NULL) task = current; - if(task->need_resched) schedule(); - if(task->sigpending != 0) do_signal(NULL, NULL); + if(current->need_resched) schedule(); + if(current->sigpending != 0) do_signal(NULL, NULL); } void release_thread(struct task_struct *task) @@ -545,10 +536,8 @@ int get_repeat_syscall(void *t) { - struct task_struct *task; + struct task_struct *task = t; - if(t == NULL) task = current; - else task = t; return(task->thread.repeat_syscall); } diff -Naur -X exclude-files ac_cur/arch/um/kernel/signal_user.c ac/arch/um/kernel/signal_user.c --- ac_cur/arch/um/kernel/signal_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/signal_user.c Sat Nov 3 16:13:22 2001 @@ -31,6 +31,7 @@ set_sigstack(stack, page_size()); set_handler(SIGUSR1, signal_deliverer, SA_ONSTACK, -1); usr1_pid(getpid()); + return(0); } void setup_signal_stack(void) diff -Naur -X exclude-files ac_cur/arch/um/kernel/sys_call_table.c ac/arch/um/kernel/sys_call_table.c --- ac_cur/arch/um/kernel/sys_call_table.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/sys_call_table.c Sat Nov 3 16:13:22 2001 @@ -218,11 +218,21 @@ extern syscall_handler_t sys_madvise; extern syscall_handler_t sys_fcntl64; extern syscall_handler_t sys_getdents64; +extern syscall_handler_t sys_gettid; +extern syscall_handler_t sys_readahead; extern syscall_handler_t um_mount; extern syscall_handler_t um_time; extern syscall_handler_t um_stime; +#define LAST_GENERIC_SYSCALL __NR_readahead + +#if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL +#define LAST_SYSCALL LAST_GENERIC_SYSCALL +#else +#define LAST_SYSCALL LAST_ARCH_SYSCALL +#endif + syscall_handler_t *sys_call_table[] = { [ 0 ] = sys_ni_syscall, [ __NR_exit ] = sys_exit, @@ -426,6 +436,9 @@ [ __NR_fstat64 ] = sys_fstat64, [ __NR_fcntl64 ] = sys_fcntl64, [ __NR_getdents64 ] = sys_getdents64, + [ __NR_security ] = sys_ni_syscall, + [ __NR_gettid ] = sys_gettid, + [ __NR_readahead ] = sys_readahead, ARCH_SYSCALLS [ LAST_SYSCALL + 1 ... NR_syscalls ] = (syscall_handler_t *) sys_ni_syscall diff -Naur -X exclude-files ac_cur/arch/um/kernel/syscall_kern.c ac/arch/um/kernel/syscall_kern.c --- ac_cur/arch/um/kernel/syscall_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/syscall_kern.c Sat Nov 3 16:13:22 2001 @@ -321,9 +321,11 @@ panic("syscall thread activated without a system call"); if((syscall >= NR_syscalls) || (syscall < 0)) return(-ENOSYS); + set_fs(KERNEL_DS); res = EXECUTE_SYSCALL(syscall, regs); set_fs(USER_DS); + return(res); } diff -Naur -X exclude-files ac_cur/arch/um/kernel/syscall_user.c ac/arch/um/kernel/syscall_user.c --- ac_cur/arch/um/kernel/syscall_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/syscall_user.c Sat Nov 3 16:13:22 2001 @@ -77,7 +77,7 @@ syscall_trace(); syscall_record[index].result = result; gettimeofday(&syscall_record[index].end, NULL); - ret_from_sys_call(NULL); + ret_from_sys_call(); /* XXX * This is a race, set_user_thread has to be called with signals off diff -Naur -X exclude-files ac_cur/arch/um/kernel/trap_kern.c ac/arch/um/kernel/trap_kern.c --- ac_cur/arch/um/kernel/trap_kern.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/trap_kern.c Sat Nov 3 16:13:22 2001 @@ -13,6 +13,7 @@ #include "asm/pgtable.h" #include "asm/pgalloc.h" #include "asm/a.out.h" +#include "asm/current.h" #include "user_util.h" #include "kern_util.h" #include "kern.h" @@ -100,11 +101,6 @@ if(is_write) pte_mkdirty(*pte); } while(is_write && !pte_write(*pte)); if(is_write && !pte_write(*pte)) panic("page not writeable"); - if(!is_write && !pte_present(*pte)){ - printk("Page disappeared while handling fault"); - force_sigbus(); - } - flush_tlb_page(vma, page); up_read(&mm->mmap_sem); return(0); } @@ -215,7 +211,7 @@ if(!strncmp(data->str, "pid,", strlen("pid,"))){ data->str += strlen("pid,"); pid = simple_strtoul(data->str, NULL, 0); - debugger_pid = attach_debugger(current_task->thread.extern_pid, + debugger_pid = attach_debugger(current->thread.extern_pid, pid, 0); if(debugger_pid != -1){ data->err = 0; diff -Naur -X exclude-files ac_cur/arch/um/kernel/trap_user.c ac/arch/um/kernel/trap_user.c --- ac_cur/arch/um/kernel/trap_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/kernel/trap_user.c Sat Nov 3 16:13:22 2001 @@ -131,7 +131,7 @@ if(pid == debugger_pid){ if(WIFEXITED(status) || WIFSIGNALED(status)) debugger_pid = -1; - debugger_signal(status, external_pid(NULL)); + debugger_signal(status, external_pid()); continue; } nsignals++; @@ -244,7 +244,7 @@ sig = 0; break; case SIGHUP: - if(pid != external_pid(NULL)) continue; + if(pid != external_pid()) continue; sig = 0; break; default: @@ -380,7 +380,7 @@ void do_longjmp(void *p) { - jmp_buf *jbuf = (jmp_buf *)p; + jmp_buf *jbuf = (jmp_buf *) p; longjmp(*jbuf, 1); } diff -Naur -X exclude-files ac_cur/arch/um/main.c ac/arch/um/main.c --- ac_cur/arch/um/main.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/main.c Sat Nov 3 16:13:22 2001 @@ -12,6 +12,7 @@ #include #include #include +#include #include "user_util.h" #include "kern_util.h" #include "mem_user.h" @@ -145,7 +146,13 @@ { if(allocating_monbuf){ unsigned long start, end; - int fd = create_mem_file(size); + int fd; + + /* Turn this off now in case create_mem_file tries allocating + * memory + */ + allocating_monbuf = 0; + fd = create_mem_file(size); /* Calculate this here because linux_main hasn't run yet * and host_task_size figures in STACK_TOP, which figures diff -Naur -X exclude-files ac_cur/arch/um/ptproxy/Makefile ac/arch/um/ptproxy/Makefile --- ac_cur/arch/um/ptproxy/Makefile Sat Nov 3 16:12:55 2001 +++ ac/arch/um/ptproxy/Makefile Sat Nov 3 16:13:22 2001 @@ -6,7 +6,7 @@ all: $(LIB) -$(LIB): $(OBJS) $(OX_OBJS) +$(LIB): $(OBJS) rm -f $@ ar cr $@ $^ diff -Naur -X exclude-files ac_cur/arch/um/ptproxy/ptrace.c ac/arch/um/ptproxy/ptrace.c --- ac_cur/arch/um/ptproxy/ptrace.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/ptproxy/ptrace.c Sat Nov 3 16:13:22 2001 @@ -15,6 +15,8 @@ #include #include "ptproxy.h" +#include "debug.h" +#include "user_util.h" struct { int op; diff -Naur -X exclude-files ac_cur/arch/um/sys-i386/sigcontext.c ac/arch/um/sys-i386/sigcontext.c --- ac_cur/arch/um/sys-i386/sigcontext.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/sys-i386/sigcontext.c Sat Nov 3 16:13:22 2001 @@ -6,7 +6,6 @@ #include #include #include "sysdep/ptrace.h" -#include "user_util.h" void fill_in_sigcontext(void *sc_ptr, struct sys_pt_regs *regs, unsigned long cr2, int err) diff -Naur -X exclude-files ac_cur/arch/um/sys-i386/sysrq.c ac/arch/um/sys-i386/sysrq.c --- ac_cur/arch/um/sys-i386/sysrq.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/sys-i386/sysrq.c Sat Nov 3 16:13:22 2001 @@ -10,7 +10,7 @@ smp_processor_id(), print_tainted()); if (regs->xcs & 3) printk(" ESP: %04x:%08lx",0xffff & regs->xss, regs->esp); - printk(" EFLAGS: %08lx\n", regs->eflags); + printk(" EFLAGS: %08lx\n %s\n", regs->eflags, print_tainted()); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->eax, regs->ebx, regs->ecx, regs->edx); printk("ESI: %08lx EDI: %08lx EBP: %08lx", diff -Naur -X exclude-files ac_cur/arch/um/sys-ppc/ptrace_user.c ac/arch/um/sys-ppc/ptrace_user.c --- ac_cur/arch/um/sys-ppc/ptrace_user.c Sat Nov 3 16:12:55 2001 +++ ac/arch/um/sys-ppc/ptrace_user.c Sat Nov 3 16:13:22 2001 @@ -1,6 +1,7 @@ #include #include #include +#include "sysdep/ptrace.h" int ptrace_getregs(long pid, struct sys_pt_regs *regs_out) { diff -Naur -X exclude-files ac_cur/include/asm-um/processor-generic.h ac/include/asm-um/processor-generic.h --- ac_cur/include/asm-um/processor-generic.h Sat Nov 3 16:12:57 2001 +++ ac/include/asm-um/processor-generic.h Sat Nov 3 16:13:22 2001 @@ -19,6 +19,8 @@ #define current_text_addr() ((void *) 0) +#define cpu_relax() do ; while (0) + #define SIGNAL_NONE 0 #define SIGNAL_PENDING 1