summaryrefslogtreecommitdiff
path: root/exec
AgeCommit message (Collapse)Author
2020-03-31Fix build with -fno-commonSamuel Thibault
which will be the default in gcc-10. * acpi/acpifs.h (fs, acpifs_maptime): Add extern qualifier. * boot/private.h (verbose): Likewise. * eth-multiplexer/netfs_impl.h (multiplexer_maptime): Likewise. * eth-multiplexer/vdev.h (port_bucket, vdev_portclass): Likewise. * exec/priv.h (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.h (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, zeroblock, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, node_to_page_lock, generation_lock, next_generation, group_desc_image, global_pokel, modified_global_blocks, use_xattr_translator_records): Likewise. * hostmux/hostmux.h (hostmux_maptime): Likewise. * isofs/isofs.h (host_name, mounted_on, disk_image, disk_image_len, logical_block_size, sblock): Likewise. * libdiskfs/diskfs.h (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Likewise. * libnetfs/callbacks.h (_netfs_translator_callback1, _netfs_translator_callback2): Likewise. * libnetfs/priv.h (netfs_mtime): Likewise. * libpager/priv.h (_pager_class): Likewise. * libtrivfs/trivfs.h (trivfs_check_access_hook, trivfs_check_open_hook, trivfs_open_hook, trivfs_protid_create_hook, trivfs_peropen_create_hook, trivfs_protid_destroy_hook, trivfs_peropen_destroy_hook, trivfs_getroot_hook): Likewise. * lwip/lwip-hurd.h (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_protid_portclasses, lwip_cntl_portclasses, lwip_bootstrap_portclass, fsys_identity, lwipcntl, lwip_owner, lwip_group): Likewise. * lwip/port/include/netif/hurdtunif.h (tunnel_cntlclass, tunnel_class): Likewise. * nfs/nfs.h (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/nfsd.h (mapped_time, authserver): Likewise. * pci-arbiter/pcifs.h (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.h (pci_shutdown_notify_class, arrange_shutdown_notification): Likewise. * pfinet/pfinet.h (pfinet_bucket, addrport_class, socketport_class, fsys_identity, pfinetctl, pfinet_owner, pfinet_group): Likewise. * pflocal/sserver.h (sock_port_bucket): Likewise. * proc/proc.h (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/term.h (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, inputq, rawq, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.h (usermux_maptime): Likewise. * utils/msgids.h (msgid_argp): Likewise. * libdiskfs/priv.h (_diskfs_mtime): Remove definition. * lwip/options.h (lwip_argp): Add prototype. * mach-defpager/priv.h (partitions): Name structure. (all_partitions): Add extern qualifier. * acpi/main.c (acpifs_maptime, fs): New variables. * exec/main.c (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.c (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, next_generation, group_desc_image, global_pokel, use_xattr_translator_records): Likewise. * isofs/main.c (host_name, mounted_on, logical_block_size, sblock): Likewise. * libpager/pager-create.c (_pager_class): Likewise. * lwip/port/netif/hurdtunif.c (tunnel_cntlclass, tunnel_class): Likewise. * mach-defpager/default_pager.c (all_partitions): Likewise. * nfs/main.c (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/main.c (mapped_time, authserver): Likewise. * pci-arbiter/main.c (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.c (*pci_shutdown_notify_class): Likewise. * pfinet/main.c (pfinetctl, pfinet_owner, pfinet_group, pfinet_bucket, addrport_class, socketport_class, fsys_identity): Likewise. * proc/main.c (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/main.c (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.c (usermux_mapped_time): Rename to usermux_maptime. * lwip/main.c: Include "options.h". (lwip_argp, netif_list): Remove declarations. (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_cntl_portclasses, lwip_bootstrap_portclass, lwip_owner, lwip_group, fsys_identity, lwipcntl): New variables. * eth-multiplexer/multiplexer.c (multiplexer_maptime): Add variable. * hostmux/hostmux.c (hostmux_mapped_time): Rename variable to hostmux_maptime * libdiskfs/extra-version.c: Rename file to... * libdiskfs/priv.c: ... new file. (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Add weak variables. * libdiskfs/Makefile (OTHERSRCS): Replace extra-version.c with priv.c. * libtrivfs/priv.c: New file. * libtrivfs/Makefile (OTHERSRCS): Add priv.c * libcons/extra-version.c: Rename file to... * libcons/priv.c: ... new file. * libcons/Makefile (SRCS): Replace extra-version.c with priv.c. Fix build with #
2019-09-01Use the data_t type defined in hurd_types.h.Flavio Cruz
* boot/boot.c: Replace char* with data_t. * console-client/trans.c: Likewise. * exec/exec.c: Likewise. * ext2fs/storeinfo.c: Likewise. * fatfs/inode.c: Likewise. * fatfs/main.c: Likewise. * isofs/inode.c: Likewise. * libdiskfs/boot-start.c: Likewise. * libdiskfs/dir-readdir.c: Likewise. * libdiskfs/file-exec.c: Likewise. * libdiskfs/file-get-fs-opts.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/fsys-forward.c: Likewise. * libdiskfs/fsys-getfile.c: Likewise. * libdiskfs/fsys-options.c: Likewise. * libdiskfs/io-read.c: Likewise. * libdiskfs/io-write.c: Likewise. * libnetfs/dir-readdir.c: Likewise. * libnetfs/file-exec.c: Likewise. * libnetfs/file-get-fs-options.c: Likewise. * libnetfs/file-get-storage-info.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * libnetfs/fsstubs.c: Likewise. * libnetfs/fsys-get-options.c: Likewise. * libnetfs/fsys-set-options.c: Likewise. * libnetfs/fsysstubs.c: Likewise. * libnetfs/io-read.c: Likewise. * libnetfs/io-write.c: Likewise. * libtrivfs/dir-readdir.c: Likewise. * libtrivfs/file-get-fs-options.c: Likewise. * libtrivfs/file-get-storage-info.c: Likewise. * libtrivfs/file-get-trans.c: Likewise. * libtrivfs/file-getfh.c: Likewise. * libtrivfs/file-set-trans.c: Likewise. * libtrivfs/fsys-forward.c: Likewise. * libtrivfs/fsys-get-options.c: Likewise. * libtrivfs/fsys-set-options.c: Likewise. * libtrivfs/fsys-stubs.c: Likewise. * libtrivfs/io-read.c: Likewise. * libtrivfs/io-write.c: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/pfinet-ops.c: Likewise. * pfinet/socket-ops.c: Likewise. * pfinet/tunnel.c: Likewise. * pflocal/io.c: Likewise. * pflocal/pf.c: Likewise. * pflocal/socket.c: Likewise. * proc/info.c: Likewise. * startup/startup.c: Likewise. * storeio/io.c: Likewise. * term/users.c: Likewise. * tmpfs/node.c: Likewise. * trans/crash.c: Likewise. * trans/fakeroot.c: Likewise. * trans/fifo.c: Likewise. * trans/firmlink.c: Likewise. * trans/hello-mt.c: Likewise. * trans/hello.c: Likewise. * trans/mtab.c: Likewise. * trans/new-fifo.c: Likewise. * trans/null.c: Likewise. * trans/proxy-defpager.c: Likewise. * trans/streamio.c: Likewise.
2018-04-22exec: Leave room for mmaps etc. before PIE binariesSamuel Thibault
otherwise there might not even be enough room to run RPCs during rtld bootstrap. * exec/exec.c (do_exec): Add 128MiB to anywhere_start before loading program.
2018-04-22exec: Fix else branchSamuel Thibault
which happened to have no nefarious consequences by luck. * exec/exec.c (load_section): Add braces around commented code to fix else branch.
2018-04-22exec: document why mask code is currently commentedSamuel Thibault
2018-03-05Fix warningsSamuel Thibault
* libdiskfs/boot-start.c (diskfs_start_bootstrap): Fix printf format. * libfshelp/delegate.c: Include <alloca.h> and <stdlib.h>. * libfshelp/start-translator-long.c: Include <stdlib.h>. * libshouldbeinlibc/ugids-verify-auth.c (server_verify_make_auth): Fix prototypes for password_check_group and password_check_user. * libstore/argp.c: Include <stdlib.h>. * libstore/task.c: Include <stdlib.h>. * exec/exec.c: Include <mach/vm_param.h>. * libbpf/bpf_impl.c: Include <stdlib.h>. * proc/info.c (S_proc_getloginpids): Remove local variables leader_task and leader_sub. * proc/main.c (main): Remove local variable original_argv. * boot/boot.c (task_died, S_mach_notify_new_task): Fix printf format. * exec/elfcore.c: Include <alloca.h> and <mach/vm_param.h>. * trans/crash.c: Include <hurd/msg.h>. * trans/random.c: Include <signal.h>. * utils/login.c: Include <signal.h>. * utils/id.c: Include <hurd/msg.h>. * utils/devprobe.c: Include <stdlib.h>. * utils/addauth.c: Include <hurd/msg.h>. * utils/frobauth-mod.c: Include <hurd/msg.h>. * utils/storeread.c: Include <stdlib.h>. * utils/msgport.c: Include <hurd/msg.h>. * sutils/clookup.c (file_name_lookup_carefully): Fix lookup function prototype, make head and tail const. * utils/rpcscan.c: Include <stdlib.h>. * sutils/bless.c: Include <stdlib.h>. * fstests/fstests.c: Include <stdlib.h>. * startup/startup.c (argz_task_insert_right): Fix printf format. * init/init.c: Include <stdlib.h>.
2018-01-08Implement /proc/<pid>/exeSamuel Thibault
by adding proc_set/get_exe to the proc server, making exec call proc_set_exe, and libps call proc_get_exe. procfs can then just retrieve the information to make the "exe" symlink. * hurd/process.defs (proc_set_exe, proc_get_exe): New RPCs. * hurd/process_request.defs: Likewise. * hurd/process_reply.defs: Add skips for proc_set_exe and proc_get_exe RPCs. * proc/proc.h (struct proc): Add `exe' field. * proc/info.c (S_proc_set_exe, S_proc_get_exe): New functions. * proc/mgt.c (process_has_exited): Free p->exe. (S_proc_child): Duplicate parent `exe' into child's `exe'. * exec/exec.c (do_exec): Call proc_set_exe when a filename is available. * libps/ps.h (struct proc_stat): Add `exe_vm_alloced', `exe', and `exe_len' field. (PSTAT_EXE): New macro. (PSTAT_USER_BASE): Change value to make room. (proc_stat_exe, proc_stat_exe_len): New macros. * libps/procstat.c (proc_stat_set_flags): Handle PSTAT_EXE case by calling proc_get_exe. * libps/spec.c (ps_get_exe): New function. (ps_exe_getter): New structure. (ps_fmt_spec): Add "Exe" specification. * procfs/process.c (process_file_symlink_make_node, process_file_gc_exe): New functions. (procfs_dir_entry): Add "exe" entry. * startup/startup.c (launch_core_servers): Set exe paths for startup, auth, proc, and fs servers. (frob_kernel_process): Set exe path for kernel task. (S_startup_essential_task): Set exe path for exec server.
2018-01-08Add support for $ORIGIN rpath expansionSamuel Thibault
* exec/exec.c (do_exec): When abspath is absolute, record its dirname into the LD_ORIGIN_PATH environment variable.
2018-01-08Fix exec_paths through fakeroot or chrootJustus Winter
If file_name_exec is not given, check_hashbang will try to locate the file. If argv[0] contains a '/', the file path is assumed to be absolute and it will try to open the file. Otherwise, the file is searched in the PATH. In either case, the resulting file identity port is compared to the identity port of the original file handle passed to check_hashbang. exec_paths_exec.patch explicitly provides the script files path in file_name_exec. According to the comment, if this path is provided, it is assumed to be the path to the script file and no attempt at locating the script file is done. However, the identity ports are still compared. This cannot succeed if fakeroot or chroot is used, because the process doing the exec and thus the initial file lookup is running in the chrooted environment, while the exec server is not. Fix this by skipping the identity test if file_name_exec is provided. * exec/hashexec.c (check_hashbang): Skip the file identity test if the file_name_exec is provided.
2018-01-08Add a file_exec_file_name RPCEmilio Pozuelo Monfort
* hurd/fs.defs (file_exec): Deprecate in favor of... (file_exec_paths): ...this new RPC. * TODO: Update. * doc/hurd.texi: Update RPC name. * hurd/hurd_types.h: Update RPC name. * libdiskfs/boot-start.c: Update RPC name. * configure.ac: Check for presence of RPC stubs file_exec_paths exec_exec_paths. * exec/hashexec.c (check_hashbang): When file_exec_paths is available, use it instead of file_exec. * startup/startup.c (run, run_for_real, start_child): Likewise. * utils/login.c (main): Likewise. * libfshelp/start-translator-long.c (fshelp_start_translator_long): Likewise. * libdiskfs/file-exec.c (diskfs_S_file_exec): Move code to new function diskfs_S_file_exec_paths and call it. (diskfs_S_file_exec_paths): New function, use exec_exec_paths when available instead of exec_exec * libnetfs/file-exec.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * trans/fakeroot.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * libtrivfs/file-exec.c (trivfs_S_file_exec_paths): New function.
2018-01-08Add a new exec_exec_paths RPCEmilio Pozuelo Monfort
* hurd/exec.defs (exec_exec): Label as deprecated. (exec_exec_paths): New RPC. * doc/hurd.texi: Update accordingly. * exec/hashexec.c (check_hashbang): Add file_name_exec argument. Don't guess the file name if file_name_exec is set. * exec/priv.h (check_hashbang): Add path argument. * exec/exec.c (S_exec_exec): Label as deprecated. (S_exec_exec_paths): New function. (do_exec): Add path and abspath arguments, pass path to check_hashbang.
2017-12-11Record executable entry for PIE core dumpsSamuel Thibault
* hurd/process.defs (proc_set_entry, proc_get_entry): New RPCs. * hurd/process_reply.defs: Add skips for proc_set_entry, proc_get_entry. * hurd/process_request.defs: Likewise. * exec/exec.c (do_exec): Call proc_set_entry. * proc/proc.h (proc): Add p_entry field. * proc/mgt.c (S_proc_set_entry, S_proc_get_entry): New RPC implementations. * exec/elfcore.c (dump_core): Add at_entry note, call proc_get_entry to get it, and write it with WRITE_NOTE.
2017-09-10exec: Avoid calling mmap with zero sizeSamuel Thibault
mmap is supposed to return an error on passing a zero size. * exec/exec.c (servercopy): Immediately return NULL if argsize is 0.
2017-08-05Replace bcopy with memcpy or memmove as appropriate.Justus Winter
* boot/boot.c: Replace bcopy with memcpy or memmove as appropriate. * exec/hashexec.c: Likewise. * libps/proclist.c: Likewise, but also fix the amount of data copied. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/timefmt.c: Likewise.
2017-08-05Use our own variant of 'assert' and 'assert_perror'.Justus Winter
Our variants print stack traces on failures. This will make locating errors much easier.
2016-08-31exec: Fix loading binaries without a memory manager objectBrent W. Baccala
Falling back from the io_map method needs to handle the "anywhere" flag too by updating MAPSTART. * exec/exec.c (write_to_task): Turn MAPSTART parameter into a reference to the address. Fix usage accordingly. (load_section): Pass address of MAPSTART to write_to_task so it can update it.
2016-08-28Fix exec crash when setexecdata has never been calledSamuel Thibault
or called with a small array. This notably happens when using a sub-exec, see BZ #48919. * exec/hashexec.c (check_hashbang): Check std_nports before accessing std_ports.
2016-08-26Fix loading small pic programsSamuel Thibault
It happens that the link script for ld.so contains a hole, which might thus leave an empty page between the text and the data. When loading a small pic program, its text would then fit in there, and loading the data right after it would fail. We here rather force all pic loads to be mapped contiguously, starting from the place that was allocated for the first pic load. * exec/exec.c (load_section): Return the address of the end of the section. (load): Take the address to be used for loading pic objects as parameter, force pic objects there if it is not zero, and compute and return the address to be used for the next pic object. (do_exec): Pass addresses for pic loads between calls to load().
2016-05-23Revert part of "fix compiler warnings in hurd/exec"Thomas Schwinge
This reverts part of commit 05c3ffac543052c8d0b171a5f77bb977d5316a61. These type casts are no longer needed after the commit e914bfc3d6e5ddf6f8c5e93a4334873a48a24ddf changes. * exec/elfcore.c: Revert type casts added in commit 05c3ffac543052c8d0b171a5f77bb977d5316a61.
2016-02-04exec: remove duplicate function callEsa Peuha
* exec/main.c (main) Remove second call to trivfs_startup from commit a5d384c.
2016-01-19Fix typoSamuel Thibault
* exec/Makefile (targets): Rename to target.
2016-01-17Also build exec.staticSamuel Thibault
Which can be more convenient than using ld.so to boot the Hurd * exec/Makefile (targets): Add exec.static
2015-12-31Drop OTHERLIBS and use LDLIBS exclusivelyFlavio Cruz
When cross-compiling, OTHERLIBS magically turns -lpthread into the path to the host libpthread.so file, resulting in build issues. LDLIBS does not suffer from this problem and it seems that is already being used in other Makefiles. This patch removes OTHERLIBS entirely from the build system. * Makeconf: Remove references to OTHERLIBS * auth/Makefile: Replace OTHERLIBS with LDLIBS. * boot/Makefile: Likewise. * console/Makefile: Likewise. * exec/Makefile: Likewise. * ext2fs/Makefile: Likewise. * fatfs/Makefile: Likewise. * ftpfs/Makefile: Likewise. * hostmux/Makefile: Likewise. * isofs/Makefile: Likewise. * libhurd-slab/Makefile: Likewise. * nfs/Makefile: Likewise. * nfsd/Makefile: Likewise. * pfinet/Makefile: Likewise. * proc/Makefile: Likewise. * procfs/Makefile: Likewise. * random/Makefile: Likewise. * storeio/Makefile: Likewise. * term/Makefile: Likewise. * tmpfs/Makefile: Likewise. * usermux/Makefile: Likewise.
2015-12-29fix compiler warnings in hurd/execFlavio Cruz
exec: Fix compiler warnings. * exec/elfcore.c: Cast arguments to vm_address_t. * exec/main.c: Use %lu in asprintf.
2015-09-27exec: convert to trivfs dynamic classes and bucketsJustus Winter
libtrivfs contains two ways of managing more than one port class and bucket. There is the old way of using a statically allocated array with explicit length, and the new way with dynamically allocated vectors. Converting all users to the new way of handling multiple classes and/or buckets, we can simplify the code in libtrivfs. In many cases, the code will be simpler and more expressive for the user. This also fixes a mild bug. The classes and buckets given to `trivfs_startup' end up in the dynamic vectors too, making the object lookup code use the more complicated code path. * exec/main.c: Convert to dynamic classes and buckets.
2015-09-23exec: add missing includeJustus Winter
* exec/main.c: Include `argz.h'.
2015-09-19Define TIME_VALUE_TO_TIMESPEC only when not defined alreadySamuel Thibault
* exec/elfcore.c (TIME_VALUE_TO_TIMESPEC) [TIME_VALUE_TO_TIMESPEC]: Do not redefine macro.
2015-07-14exec: fix setting the name of early serversJustus Winter
Previously, the exec server did not set the name of the servers started before the proc server. Instead this was done by the startup server, but this was merely a workaround, missing notably the startup server itself. * exec/exec.c (set_name): New function. (do_exec): Move the code setting the name to a new function, and also call it if the proc server is not started yet. * startup/startup.c (run): Drop hack.
2015-03-05Fix space styleSamuel Thibault
2014-12-10Replace `bzero' with `memset'Justus Winter
For reference, this patch was created using the following semantic patch, and then manually applying the change in all functions containing nested functions, as those are not supported by Coccinelle. @@ expression A, B; @@ - bzero (A, B) + memset (A, 0, B) * auth/auth.c: Replace `bzero' with `memset'. * boot/boot.c: Likewise. * defpager/defpager.c: Likewise. * exec/exec.c: Likewise. Also, drop `safe_bzero' and just use `hurd_safe_memset' directly. * ext2fs/ext2fs.c: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/pager.c: Likewise. * fatfs/pager.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/netfs.c: Likewise. * isofs/inode.c: Likewise. * isofs/pager.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-statfs.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/start-translator.c: Likewise. * libftpconn/create.c: Likewise. * libftpconn/open.c: Likewise. * libftpconn/unix.c: Likewise. * libpipe/pipe.c: Likewise. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/ugids.c: Likewise. * libstore/argp.c: Likewise. * libstore/enc.c: Likewise. * libstore/kids.c: Likewise. * libthreads/alpha/thread.c: Likewise. * libtreefs/fsys.c: Likewise. * libtrivfs/file-statfs.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/glue-include/asm/uaccess.h: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/options.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pflocal/io.c: Likewise. * startup/startup.c: Likewise. * storeio/storeio.c: Likewise. * sutils/fstab.c: Likewise. * usermux/usermux.c: Likewise. * utils/fakeauth.c: Likewise. * utils/frobauth.c: Likewise. * utils/login.c: Likewise. * utils/x.c: Likewise.
2014-12-07exec: add payload-aware intrans functionsJustus Winter
* exec/execmutations.h: Add mutators. * exec/mig-decls.h (begin_using_bootinfo_payload): New function.
2014-11-21startup: bind the startup server to /servers/startupJustus Winter
Previously, the Hurd (ab)used the fact that the startup server speaks all protocols on its message port. Any server that wished to register for shutdown notifications would use proc_getmsgport to get a port to the startup server. This hardcodes the PID of /hurd/startup, and does not allow one to point a server to ones own startup server (e.g. using remap). Bind the startup server to /servers/startup instead. Use this to contact the startup server. * exec/main.c (S_exec_init): Use /servers/startup. Fall back to the old method so that the system still boots when the node /servers/startup is missing. * hurd/paths.h (_SERVERS_STARTUP): New macro. * libdiskfs/boot-start.c (diskfs_S_fsys_init): Use /servers/startup. * libdiskfs/init-startup.c (_diskfs_init_completed): Likewise. * pfinet/main.c (arrange_shutdown_notification): Likewise. * startup/Makefile (OBJS): Add fsysServer.o. * startup/startup.c (demuxer): Handle the fsys protocol. (main): Bind to /servers/startup. (S_fsys_getroot): Implement fsys_getroot. Stub out the rest.
2014-11-02Fix actual procinfo_t typeSamuel Thibault
* exec/elfcore.c (dump_core): Use procinfo_t, which is already a pointer, instead of procinfo_t*.
2014-11-02Fix proc_getprocinfo callsSamuel Thibault
The deallocation also needs to be fixed. Also, fetch_procinfo already took care of the conversion. * exec/elfcore.c (dump_core): Fix procinfoCnt taken from proc_getprocinfo. * utils/login.c (check_owned): Likewise. * libps/procstat.c (merge_procinfo): Remove conversion between bytes and int, already handled by fetch_procinfo.
2014-11-02Fix proc_getprocinfo callsSamuel Thibault
The procinfoCnt argument is the number of elements of the procinfo_t array, not its size in bytes. * exec/elfcore.c (dump_core): Fix procinfoCnt given to proc_getprocinfo. * libps/procstat.c (merge_procinfo): Likewise. * utils/login.c (check_owned): Likewise.
2014-09-29exec: redzone page zero before loading anythingJustus Winter
This prevents load_section from mapping any sections to page zero. * exec/exec.c (do_exec): Redzone page zero before loading anything.
2014-09-29exec: add proper argument parsing, add --device-master-portJustus Winter
If the device master port is given, a boot-time exec server can print diagnostic messages earlier. * exec/main.c (opt_device_master): New variable. (OPT_DEVICE_MASTER_PORT): New macro. (options): New set of options. (parse_opt): New function. (trivfs_append_args): Likewise. (argp): Pull the argp definition out of main. (trivfs_runtime_argp): Set, so that we respond properly to fsysopts. (open_console): Pull the code out of S_exec_init and generalize it. (main): Call open_console if a device master port is given. (S_exec_init): Call open_console.
2014-05-26exec: add missing includesJustus Winter
* exec/exec.c: Include mach/gnumach.h. * exec/main.c: Include device/device.h.
2014-04-29exec: abbreviate the task name if necessaryJustus Winter
* exec/exec.c (do_exec): If the formatted task name exceeds TASK_NAME_SIZE, abbreviate it.
2014-04-05exec: fix receiver lookupJustus Winter
* exec/Makefile (exec_startup-MIGSFLAGS): New variable. * exec/execmutations.h: Add mutators for exec_startup_t. * exec/mig-decls.h: New file. * exec/priv.h (bootinfo_t): New type declaration to appease mig. * exec/exec.c (S_exec_startup_get_info): Fix receiver lookup.
2014-02-25libtrivfs: improve the mig mutator functionsJustus Winter
Previously, the mig mutator functions were in migsupport.c, preventing them from being inlined into the mig-generated server functions. Put them in mig-decls.h instead. Rename mutations.h to mig-mutate.h. This is the naming convention used for pflocal. * libtrivfs/fsmutations.h: Rename to mig-mutate.h, adopt imports. * libtrivfs/Makefile: Adopt accordingly. * libtrivfs/migsupport.c: Rename to mig-decls.h. * libtrivfs/trivfs.h: Move dynamic classes/buckets declarations to mig-decls.h, remove superfluous imports. * exec/execmutations.h: Fix import. * pfinet/mig-mutate.h: Likewise. * trans/Makefile: Likewise.
2014-02-23exec: provide a meaningful name for new tasksJustus Winter
The name will be used in error messages printed by the kernel. This makes attributing the errors to processes possible. * exec/exec.c (do_exec): Set the name of the new task.
2014-02-02exec: connect std{in,out,err} to the mach consoleJustus Winter
* exec/main.c (S_exec_init): Get the device master port and connect std{in,out,err} to the mach console.
2014-01-20exec: include the mig-generated server headers in main.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * exec/main.c: Include the mig-generated server headers.
2013-12-02exec: improve the exec_demuxer functionJustus Winter
Handle multiple request types as recommended by the Mach Server Writer's Guide section 4, subsection "Handling Multiple Request Types". This avoids initializing the reply message in every X_server function. The reply message has already been properly initialized in libports, so there is no need to call mig_reply_setup. Furthermore, move the exec_startup_server_routine to the end of the chain, as the startup related functions are only needed at system bootstrap time. * exec/main.c (exec_demuxer): Improve the demuxer function.
2013-11-01exec: Remove the remaining BFD related bitsJustus Winter
* exec/Makefile: Remove commented out lines related to BFD. * exec/hostarch.c: Remove all BFD related code. * exec/main.c: Likewise.
2013-10-08Fix memory leak in execRichard Braun
* exec/hashexec.c (check_hashbang): Unmap command arguments.
2013-09-21Fix gcc warningSamuel Thibault
* exec/hostarch.c (elf_machine_matches_host): Cast `&hostinfo` into host_info_t instead of natural_t *.
2013-09-15exec: remove support for transparently ungziping executablesJustus Winter
Remove support for transparently ungziping executables from the exec server. The code in question makes the exec server unnecessarily complex and since the exec server is an essential process, crashing it makes /hurd/init crash the whole system. Since the gzip code is not thread-safe, all access to it is serialized, so there is a trivial way for one user to delay another users gzipped executables for some unspecified time. This can be accomplished by padding any program with easily compressed data, zipping it and executing it. Using such a program as an passive translator and then triggering its execution by the filesystem translator also stalls any requests to that filesystem (observed using the libdiskfs-based ext2fs). Since compressed executables cannot be mapped into the memory, they have to be uncompressed into allocated memory first. This is slower and any user with access to the exec server can make it allocate arbitrary amounts of memory. If the Hurd had proper memory accounting, this would probably be a way around it. So the compression support in exec seemingly creates various issues for little value, at least with the abundance of nonvolatile memory available today. * exec/Makefile: Remove gzip related files. * exec/exec.c: Remove anything #ifdef GZIPped. * exec/unzip.c: Move to libstore. * exec/crypt.h: Likewise. * exec/gzip.h: Likewise. * exec/inflate.c: Likewise. * exec/tailor.h: Likewise. * exec/util.c: Likewise. * libstore/Makefile: Remove the vpath magic for looking up the zip stuff.
2013-09-15exec: remove support for transparently unbzip2ing executablesJustus Winter
Remove support for transparently unbzip2ing executables from the exec server. The code in question makes the exec server unnecessarily complex and since the exec server is an essential process, crashing it makes /hurd/init crash the whole system. Since the bzip2 code is not thread-safe, all access to it is serialized, so there is a trivial way for one user to delay another users bzip2ed executables for some unspecified time. This can be accomplished by padding any program with easily compressed data, zipping it and executing it. Using such a program as an passive translator and then triggering its execution by the filesystem translator also stalls any requests to that filesystem (observed using the libdiskfs-based ext2fs). Since compressed executables cannot be mapped into the memory, they have to be uncompressed into allocated memory first. This is slower and any user with access to the exec server can make it allocate arbitrary amounts of memory. If the Hurd had proper memory accounting, this would probably be a way around it. So the compression support in exec seemingly creates various issues for little value, at least with the abundance of nonvolatile memory available today. * exec/Makefile: Remove bzip2 related files. * exec/exec.c: Remove anything #ifdef BZIP2ed. * exec/do-bunzip2.c: Move to libstore.