Introduce task_pid api
Subsystems (69)
cover Introduce task_pid api
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
This patchset introduces functions to access task->pid and ->tgid, and updates ->pid accessors to use the functions. This is in preparation for a subsequent patchset which will separate the kernel and virtualized pidspaces. This will allow us to virtualize pids from users' pov, so that, for instance, a checkpointed set of processes could be restarted with particular pids. Even though their kernel pids may already be in use by new processes, the checkpointed processes can be started in a new user pidspace with their old virtual pid. This also gives vserver a simpler way to fake vserver init processes as pid 1. Note that this does not change the kernel's internal idea of pids, only what users see.
The first 12 patches change all locations which access ->pid and ->tgid to use the inlined functions. The last patch actually introduces task_pid() and task_tgid(), and renames ->pid and ->tgid to __pid and __tgid to make sure any uncaught users error out.
Does something like this, presumably after much working over, seem mergeable?
thanks
-serge
RFC PATCH 1/13 Change pid accesses: drivers
Replace-Subject: Change pid accesses: drivers
From: Serge Hallyn <[email protected]>
Instead of letting all parts of the kernel have direct access to tsk->pid and tgid, make them use a accessor functions: task_{p,tg}id(). This will need to be done for a few other fields, but I decided to start with those two. Note that pid has been renamed __pid to make sure that any uncaught users will error out.
Note that this is very similar to what the vserver vx_map_pid() does, and doing something like this should shrink their patch.
Our next patchset can find all the places where a pid crosses the user<->kernel boundary, and do the correct conversions. Perhaps some sparse annotations will allow us to do this more automatically, instead of auditing everything. We could have a concept of __user for pids, not just pointers.
This first patch changes the pid accesses under drivers/.
--- drivers/acorn/block/fd1772.c | 2 +- drivers/acpi/osl.c | 2 +- drivers/block/ataflop.c | 2 +- drivers/block/nbd.c | 2 +- drivers/cdrom/cdrom.c | 2 +- drivers/cdrom/mcdx.c | 2 +- drivers/cdrom/sbpcd.c | 4 ++-- drivers/char/agp/frontend.c | 6 +++--- drivers/char/cyclades.c | 10 +++++----- drivers/char/drm/drm_bufs.c | 2 +- drivers/char/drm/drm_drv.c | 2 +- drivers/char/drm/drm_fops.c | 8 ++++---- drivers/char/drm/drm_lock.c | 6 +++--- drivers/char/drm/drm_os_linux.h | 2 +- drivers/char/drm/drm_vm.c | 2 +- drivers/char/drm/i810_dma.c | 2 +- drivers/char/drm/i830_dma.c | 2 +- drivers/char/n_r3964.c | 12 ++++++------ drivers/char/random.c | 2 +- drivers/char/rio/linux_compat.h | 2 +- drivers/char/snsc_event.c | 2 +- drivers/char/sx.c | 2 +- drivers/char/sysrq.c | 2 +- drivers/char/tty_io.c | 6 +++--- drivers/char/vt_ioctl.c | 4 ++-- drivers/input/joystick/iforce/iforce-main.c | 8 ++++---- drivers/input/joystick/iforce/iforce.h | 4 ++-- drivers/macintosh/adb.c | 8 ++++---- drivers/md/bitmap.c | 4 ++-- drivers/md/md.c | 6 +++--- drivers/media/video/zoran_driver.c | 4 ++-- drivers/net/slip.c | 6 +++--- drivers/net/tun.c | 2 +- drivers/net/wireless/hostap/hostap_ioctl.c | 2 +- drivers/oprofile/buffer_sync.c | 4 ++-- drivers/s390/char/fs3270.c | 2 +- drivers/s390/crypto/z90main.c | 4 ++-- drivers/s390/s390mach.c | 2 +- drivers/scsi/53c7xx.c | 2 +- drivers/scsi/dc395x.c | 4 ++-- drivers/scsi/eata_pio.c | 2 +- drivers/serial/crisv10.c | 4 ++-- drivers/usb/core/devio.c | 6 +++--- drivers/usb/input/hid-lgff.c | 8 ++++---- drivers/usb/input/hid-tmff.c | 8 ++++---- drivers/usb/input/pid.c | 8 ++++---- 46 files changed, 94 insertions(+), 94 deletions(-)
drivers/acorn/block/fd1772.c +1 -1
@@ -1275,7 +1275,7 @@ static void do_fd_request(request_queue_ {unsigned long flags; -DPRINT (("do_fd_request for pid %d\n" , current->pid)); +DPRINT (("do_fd_request for pid %d\n" ,task_pid (current)));if (fdc_busy)return ;save_flags (flags);cli ();
drivers/acpi/osl.c +1 -1
@@ -931,7 +931,7 @@ u8 acpi_os_writable(void *ptr, acpi_sizeu32 acpi_os_get_thread_id (void ) {if (!in_atomic ()) -return current->pid; +return task_pid (current);return 0 ; }
drivers/block/ataflop.c +1 -1
@@ -1470,7 +1470,7 @@ void do_fd_request(request_queue_t * q) {unsigned long flags; -DPRINT (("do_fd_request for pid %d\n" ,current->pid)); +DPRINT (("do_fd_request for pid %d\n" ,task_pid (current)));while ( fdc_busy )sleep_on ( &fdc_wait ); fdc_busy =1 ;stdma_lock (floppy_irq,NULL );
drivers/block/nbd.c +1 -1
@@ -182,7 +182,7 @@ static int sock_xmit(struct socket *socksiginfo_t info;spin_lock_irqsave (¤t->sighand->siglock, flags);printk (KERN_WARNING "nbd (pid %d: %s) got signal %d\n" , - current->pid, current->comm, +task_pid (current), current->comm,dequeue_signal (current, ¤t->blocked, &info));spin_unlock_irqrestore (¤t->sighand->siglock, flags); result = -EINTR ;
drivers/cdrom/cdrom.c +1 -1
@@ -1097,7 +1097,7 @@ int open_for_data(struct cdrom_device_inis the default case! */ cdinfo (CD_OPEN ,"bummer. wrong media type.\n" );cdinfo (CD_WARNING ,"pid %d must open device O_NONBLOCK!\n" , - (unsigned int )current->pid); + (unsigned int )task_pid (current)); ret=-EMEDIUMTYPE ; goto clean_up_and_return; }
drivers/cdrom/mcdx.c +1 -1
@@ -1351,7 +1351,7 @@ static int mcdx_xfer(struct s_drive_stuf sector + nr_sectors) ? stuffp->high_border : border; - stuffp->lock = current->pid; + stuffp->lock =task_pid (current); do {
drivers/cdrom/sbpcd.c +2 -2
@@ -4854,14 +4854,14 @@ static void do_sbpcd_request(request_queif (!req) {printk ("do_sbpcd_request[%di](NULL), Pid:%d, Time:%li\n" , - xnr, current->pid, jiffies); + xnr,task_pid (current), jiffies);printk ("do_sbpcd_request[%do](NULL) end 0 (null), Time:%li\n" , xnr, jiffies);return ; }printk (" do_sbpcd_request[%di](%p:%ld+%ld), Pid:%d, Time:%li\n" , - xnr, req, req->sector, req->nr_sectors, current->pid, jiffies); + xnr, req, req->sector, req->nr_sectors,task_pid (current), jiffies);#endif req =elv_next_request (q);/* take out our request so no other */
drivers/char/agp/frontend.c +3 -3
@@ -611,7 +611,7 @@ static int agp_mmap(struct file *file, sif ((size + offset) > current_size) goto out_inval; - client =agp_find_client_by_pid (current->pid); + client =agp_find_client_by_pid (task_pid (current));if (client ==NULL ) goto out_eperm;
@@ -708,13 +708,13 @@ static int agp_open(struct inode *inode, goto err_out_nomem;set_bit (AGP_FF_ALLOW_CLIENT , &priv->access_flags); - priv->my_pid = current->pid; + priv->my_pid =task_pid (current);if ((current->uid ==0 ) || (current->suid ==0 )) {/* Root priv, can be controller */ set_bit (AGP_FF_ALLOW_CONTROLLER , &priv->access_flags); } - client =agp_find_client_by_pid (current->pid); + client =agp_find_client_by_pid (task_pid (current));if (client !=NULL ) {set_bit (AGP_FF_IS_CLIENT , &priv->access_flags);
drivers/char/cyclades.c +5 -5
@@ -2361,7 +2361,7 @@ block_til_ready(struct tty_struct *tty,CY_UNLOCK (info, flags);#ifdef CY_DEBUG_COUNT printk ("cyc block_til_ready: (%d): decrementing count to %d\n" , - current->pid, info->count); +task_pid (current), info->count);#endif info->blocked_open++;
@@ -2478,7 +2478,7 @@ block_til_ready(struct tty_struct *tty, info->count++;#ifdef CY_DEBUG_COUNT printk ("cyc:block_til_ready (%d): incrementing count to %d\n" , - current->pid, info->count); +task_pid (current), info->count);#endif } info->blocked_open--;
@@ -2579,7 +2579,7 @@ cy_open(struct tty_struct *tty, struct f info->count++;#ifdef CY_DEBUG_COUNT printk ("cyc:cy_open (%d): incrementing count to %d\n" , - current->pid, info->count); +task_pid (current), info->count);#endif if (!tmp_buf) { page =get_zeroed_page (GFP_KERNEL );
@@ -2745,7 +2745,7 @@ cy_close(struct tty_struct *tty, struct }#ifdef CY_DEBUG_COUNT printk ("cyc:cy_close at (%d): decrementing count to %d\n" , - current->pid, info->count -1 ); +task_pid (current), info->count -1 );#endif if (--info->count <0 ) {#ifdef CY_DEBUG_COUNT
@@ -4472,7 +4472,7 @@ cy_hangup(struct tty_struct *tty) info->event =0 ; info->count =0 ;#ifdef CY_DEBUG_COUNT -printk ("cyc:cy_hangup (%d): setting count to 0\n" , current->pid); +printk ("cyc:cy_hangup (%d): setting count to 0\n" ,task_pid (current));#endif info->tty =NULL ; info->flags &= ~ASYNC_NORMAL_ACTIVE ;
drivers/char/drm/drm_bufs.c +1 -1
@@ -1434,7 +1434,7 @@ int drm_freebufs(struct inode *inode, st buf = dma->buflist[idx];if (buf->filp != filp) {DRM_ERROR ("Process %d freeing buffer not owned\n" , - current->pid); +task_pid (current));return -EINVAL ; }drm_free_buffer (dev, buf);
drivers/char/drm/drm_drv.c +1 -1
@@ -473,7 +473,7 @@ int drm_ioctl(struct inode *inode, struc ++priv->ioctl_count;DRM_DEBUG ("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n" , - current->pid, cmd, nr, +task_pid (current), cmd, nr, (long )old_encode_dev (priv->head->device), priv->authenticated);
drivers/char/drm/drm_fops.c +4 -4
@@ -188,7 +188,7 @@ int drm_release(struct inode *inode, str*/ DRM_DEBUG ("pid = %d, device = 0x%lx, open_count = %d\n" , - current->pid, (long )old_encode_dev (priv->head->device), +task_pid (current), (long )old_encode_dev (priv->head->device), dev->open_count); if (priv->lock_count && dev->lock.hw_lock &&
@@ -347,7 +347,7 @@ static int drm_open_helper(struct inodeif (!drm_cpu_valid ())return -EINVAL ; -DRM_DEBUG ("pid = %d, minor = %d\n" , current->pid, minor); +DRM_DEBUG ("pid = %d, minor = %d\n" ,task_pid (current), minor); priv =drm_alloc (sizeof (*priv),DRM_MEM_FILES );if (!priv)
@@ -356,7 +356,7 @@ static int drm_open_helper(struct inodememset (priv,0 ,sizeof (*priv)); filp->private_data = priv; priv->uid = current->euid; - priv->pid = current->pid; + priv->pid =task_pid (current); priv->minor = minor; priv->head = drm_heads[minor]; priv->ioctl_count =0 ;
@@ -416,7 +416,7 @@ int drm_flush(struct file *filp)drm_device_t *dev = priv->head->dev;DRM_DEBUG ("pid = %d, device = 0x%lx, open_count = %d\n" , - current->pid, (long )old_encode_dev (priv->head->device), +task_pid (current), (long )old_encode_dev (priv->head->device), dev->open_count);return 0 ; }
drivers/char/drm/drm_lock.c +3 -3
@@ -67,12 +67,12 @@ int drm_lock(struct inode *inode, structif (lock.context ==DRM_KERNEL_CONTEXT ) {DRM_ERROR ("Process %d using kernel context %d\n" , - current->pid, lock.context); +task_pid (current), lock.context);return -EINVAL ; }DRM_DEBUG ("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n" , - lock.context, current->pid, + lock.context,task_pid (current), dev->lock.hw_lock->lock, lock.flags);if (drm_core_check_feature (dev,DRIVER_DMA_QUEUE ))
@@ -156,7 +156,7 @@ int drm_unlock(struct inode *inode, struif (lock.context ==DRM_KERNEL_CONTEXT ) {DRM_ERROR ("Process %d using kernel context %d\n" , - current->pid, lock.context); +task_pid (current), lock.context);return -EINVAL ; }
drivers/char/drm/drm_os_linux.h +1 -1
@@ -12,7 +12,7 @@#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data#define DRM_ERR (d) -(d)/** Current process ID */ -#define DRM_CURRENTPID current->pid +#define DRM_CURRENTPID task_pid(current)#define DRM_UDELAY (d) udelay(d)/** Read a byte from a MMIO region */ #define DRM_READ8 (map, offset) readb(((void __iomem *)(map)->handle) + (offset))
drivers/char/drm/drm_vm.c +1 -1
@@ -407,7 +407,7 @@ static void drm_vm_open(struct vm_area_sdown (&dev->struct_sem); vma_entry->vma = vma; vma_entry->next = dev->vmalist; - vma_entry->pid = current->pid; + vma_entry->pid =task_pid (current); dev->vmalist = vma_entry;up (&dev->struct_sem); }
drivers/char/drm/i810_dma.c +1 -1
@@ -1110,7 +1110,7 @@ static int i810_getbuf(struct inode *ino retcode =i810_dma_get_buffer (dev, &d, filp);DRM_DEBUG ("i810_dma: %d returning %d, granted = %d\n" , - current->pid, retcode, d.granted); +task_pid (current), retcode, d.granted);if (copy_to_user ((drm_dma_t __user *) arg, &d,sizeof (d)))return -EFAULT ;
drivers/char/drm/i830_dma.c +1 -1
@@ -1433,7 +1433,7 @@ static int i830_getbuf(struct inode *ino retcode =i830_dma_get_buffer (dev, &d, filp);DRM_DEBUG ("i830_dma: %d returning %d, granted = %d\n" , - current->pid, retcode, d.granted); +task_pid (current), retcode, d.granted);if (copy_to_user ((drm_dma_t __user *) arg, &d,sizeof (d)))return -EFAULT ;
drivers/char/n_r3964.c +6 -6
@@ -1068,7 +1068,7 @@ static int r3964_open(struct tty_structTRACE_L ("open" );TRACE_L ("tty=%p, PID=%d, disc_data=%p" , - tty, current->pid, tty->disc_data); + tty,task_pid (current), tty->disc_data); pInfo=kmalloc (sizeof (struct r3964_info ),GFP_KERNEL );TRACE_M ("r3964_open - info kmalloc %p" ,pInfo);
@@ -1193,7 +1193,7 @@ static ssize_t r3964_read(struct tty_strstruct r3964_client_message theMsg;DECLARE_WAITQUEUE (wait, current); -int pid = current->pid; +int pid =task_pid (current);int count;TRACE_L ("read()" );
@@ -1295,7 +1295,7 @@ static ssize_t r3964_write(struct tty_st pHeader->locks =0 ; pHeader->owner =NULL ; - pid=current->pid; + pid=task_pid (current); pClient=findClient (pInfo, pid);if (pClient)
@@ -1328,7 +1328,7 @@ static int r3964_ioctl(struct tty_structswitch (cmd) {case R3964_ENABLE_SIGNALS : -return enable_signals (pInfo, current->pid, arg); +return enable_signals (pInfo,task_pid (current), arg);case R3964_SETPRIORITY :if (arg<R3964_MASTER || arg>R3964_SLAVE )return -EINVAL ;
@@ -1341,7 +1341,7 @@ static int r3964_ioctl(struct tty_struct pInfo->flags &= ~R3964_BCC ;return 0 ;case R3964_READ_TELEGRAM : -return read_telegram (pInfo, current->pid, (unsigned char __user *)arg); +return read_telegram (pInfo,task_pid (current), (unsigned char __user *)arg);default :return -ENOIOCTLCMD ; }
@@ -1357,7 +1357,7 @@ static unsigned int r3964_poll(struct tt struct poll_table_struct *wait) {struct r3964_info *pInfo=(struct r3964_info *)tty->disc_data; -int pid=current->pid; +int pid=task_pid (current);struct r3964_client_info *pClient;struct r3964_message *pMsg=NULL ;unsigned long flags;
drivers/char/random.c +1 -1
@@ -1640,7 +1640,7 @@ unsigned int get_random_int(void)* drain on it), and uses halfMD4Transform within the second. We * also mix it with jiffies and the PID: */ -return secure_ip_id (current->pid + jiffies); +return secure_ip_id (task_pid (current) + jiffies); }/*
drivers/char/rio/linux_compat.h +1 -1
@@ -58,7 +58,7 @@ struct ttystatics {#endif -#define getpid () (current->pid) +#define getpid () (task_pid(current))#define QSIZE SERIAL_XMIT_SIZE
drivers/char/snsc_event.c +1 -1
@@ -207,7 +207,7 @@ scdrv_dispatch_event(char *event, int le/* first find init's task */ read_lock (&tasklist_lock);for_each_process (p) { -if (p->pid ==1 ) +if (task_pid (p) ==1 )break ; }if (p) {/* we found init's task */
drivers/char/sx.c +1 -1
@@ -1437,7 +1437,7 @@ static int sx_open (struct tty_struct * line = tty->index;sx_dprintk (SX_DEBUG_OPEN ,"%d: opening line %d. tty=%p ctty=%p, np=%d)\n" , - current->pid, line, tty, current->signal->tty, sx_nports); +task_pid (current), line, tty, current->signal->tty, sx_nports);if ((line <0 ) || (line >=SX_NPORTS ) || (line >= sx_nports))return -ENODEV ;
drivers/char/sysrq.c +1 -1
@@ -207,7 +207,7 @@ static void send_sig_all(int sig)struct task_struct *p;for_each_process (p) { -if (p->mm && p->pid !=1 ) +if (p->mm &&task_pid (p) !=1 )/* Not swapper, init nor kernel thread */ force_sig (sig, p); }
drivers/char/tty_io.c +3 -3
@@ -2009,7 +2009,7 @@ static int tty_fasync(int fd, struct filif (on) {if (!waitqueue_active (&tty->read_wait)) tty->minimum_to_wake =1 ; - retval =f_setown (filp, (-tty->pgrp) ? : current->pid,0 ); + retval =f_setown (filp, (-tty->pgrp) ? :task_pid (current),0 );if (retval)return retval; }else {
@@ -2471,7 +2471,7 @@ static void __do_SAK(void *arg)if (p->signal->tty == tty || session >0 ) {printk (KERN_NOTICE "SAK: killed process %d" " (%s): p->signal->session==tty->session\n" , - p->pid, p->comm); +task_pid (p), p->comm);send_sig (SIGKILL , p,1 );continue ; }
@@ -2487,7 +2487,7 @@ static void __do_SAK(void *arg) filp->private_data == tty) {printk (KERN_NOTICE "SAK: killed process %d" " (%s): fd#%d opened to the tty\n" , - p->pid, p->comm, i); +task_pid (p), p->comm, i);send_sig (SIGKILL , p,1 );break ; }
drivers/char/vt_ioctl.c +2 -2
@@ -651,7 +651,7 @@ int vt_ioctl(struct tty_struct *tty, strreturn -EPERM ;if (!valid_signal (arg) || arg <1 || arg ==SIGKILL )return -EINVAL ; - spawnpid = current->pid; + spawnpid =task_pid (current); spawnsig = arg;return 0 ; }
@@ -670,7 +670,7 @@ int vt_ioctl(struct tty_struct *tty, str vc->vt_mode = tmp;/* the frsig is ignored, so we set it to 0 */ vc->vt_mode.frsig =0 ; - vc->vt_pid = current->pid; + vc->vt_pid =task_pid (current);/* no switch is required -- [email protected] */ vc->vt_newvt =-1 ;release_console_sem ();
drivers/input/joystick/iforce/iforce-main.c +4 -4
@@ -160,7 +160,7 @@ static int iforce_upload_effect(struct ireturn -ENOMEM ; effect->id = id; - iforce->core_effects[id].owner = current->pid; + iforce->core_effects[id].owner =task_pid (current); iforce->core_effects[id].flags[0 ] = (1 <<FF_CORE_IS_USED );/* Only IS_USED bit must be set */ is_update = FALSE;
@@ -223,8 +223,8 @@ static int iforce_erase_effect(struct instruct iforce_core_effect * core_effect;/* Check who is trying to erase this effect */ -if (iforce->core_effects[effect_id].owner != current->pid) { -printk (KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n" , current->pid, iforce->core_effects[effect_id].owner); +if (iforce->core_effects[effect_id].owner !=task_pid (current)) { +printk (KERN_WARNING "iforce-main.c: %d tried to erase an effect belonging to %d\n" ,task_pid (current), iforce->core_effects[effect_id].owner);return -EACCES ; }
@@ -274,7 +274,7 @@ static int iforce_flush(struct input_devfor (i=0 ; i<dev->ff_effects_max; ++i) {if (test_bit (FF_CORE_IS_USED , iforce->core_effects[i].flags) && - current->pid == iforce->core_effects[i].owner) { +task_pid (current) == iforce->core_effects[i].owner) {/* Stop effect */ input_report_ff (dev, i,0 );
drivers/input/joystick/iforce/iforce.h +2 -2
@@ -70,8 +70,8 @@#define CHECK_OWNERSHIP (i, iforce) \ ((i) < FF_EFFECTS_MAX && i >= 0 && \ test_bit(FF_CORE_IS_USED, (iforce)->core_effects[(i)].flags) && \ - (current->pid == 0 || \ - (iforce)->core_effects[(i)].owner == current->pid)) + (task_pid(current) == 0 || \ + (iforce)->core_effects[(i)].owner == task_pid(current)))struct iforce_core_effect {/* Information about where modifiers are stored in the device's memory */
drivers/macintosh/adb.c +4 -4
@@ -138,8 +138,8 @@ static void printADBreply(struct adb_reqstatic __inline__void adb_wait_ms (unsigned int ms) { -if (current->pid && adb_probe_task_pid && - adb_probe_task_pid == current->pid) +if (task_pid (current) && adb_probe_task_pid && + adb_probe_task_pid ==task_pid (current))msleep (ms);else mdelay (ms);
@@ -492,8 +492,8 @@ adb_request(struct adb_request *req, voi* block. Beware that the "done" callback will be overriden ! */ if ((flags &ADBREQ_SYNC ) && - (current->pid && adb_probe_task_pid && - adb_probe_task_pid == current->pid)) { + (task_pid (current) && adb_probe_task_pid && + adb_probe_task_pid ==task_pid (current))) { req->done = adb_probe_wakeup; rc = adb_controller->send_request (req,0 );if (rc || req->complete)
drivers/md/bitmap.c +2 -2
@@ -1223,7 +1223,7 @@ static mdk_thread_t *bitmap_start_daemonmd_wakeup_thread (daemon);/* start it running */ PRINTK ("%s: %s daemon (pid %d) started...\n" , -bmname (bitmap), name, daemon->tsk->pid); +bmname (bitmap), name, daemon->task_pid (tsk));return daemon; }
@@ -1232,7 +1232,7 @@ static void bitmap_stop_daemon(struct bi {/* the daemon can't stop itself... it'll just exit instead... */ if (bitmap->writeback_daemon && !IS_ERR (bitmap->writeback_daemon) && - current->pid != bitmap->writeback_daemon->tsk->pid) { +task_pid (current) !=task_pid (bitmap->writeback_daemon->tsk)) {mdk_thread_t *daemon;unsigned long flags;
drivers/md/md.c +3 -3
@@ -3157,7 +3157,7 @@ static int md_ioctl(struct inode *inode,printk (KERN_WARNING "md: %s(pid %d) used deprecated START_ARRAY ioctl. " "This will not be supported beyond 2.6\n" , - current->comm, current->pid); + current->comm,task_pid (current)); cnt--; } err =autostart_array (new_decode_dev (arg));
@@ -3345,7 +3345,7 @@ static int md_ioctl(struct inode *inode,printk (KERN_WARNING "md: %s(pid %d) used" " obsolete MD ioctl, upgrade your" " software to use new ictls.\n" , - current->comm, current->pid); + current->comm,task_pid (current)); err = -EINVAL ; goto abort_unlock; }
@@ -3485,7 +3485,7 @@ mdk_thread_t *md_register_thread(void (*void md_unregister_thread (mdk_thread_t *thread) { -dprintk ("interrupting MD-thread pid %d\n" , thread->tsk->pid); +dprintk ("interrupting MD-thread pid %d\n" ,task_pid (thread->tsk));kthread_stop (thread->tsk);kfree (thread);
drivers/media/video/zoran_driver.c +2 -2
@@ -1342,7 +1342,7 @@ zoran_open (struct inode *inode, }dprintk (1 ,KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n" , -ZR_DEVNAME (zr), current->comm, current->pid, zr->user); +ZR_DEVNAME (zr), current->comm,task_pid (current), zr->user);/* now, create the open()-specific file_ops struct */ fh =kmalloc (sizeof (struct zoran_fh ),GFP_KERNEL );
@@ -1416,7 +1416,7 @@ zoran_close (struct inode *inode,struct zoran *zr = fh->zr;dprintk (1 ,KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n" , -ZR_DEVNAME (zr), current->comm, current->pid, zr->user); +ZR_DEVNAME (zr), current->comm,task_pid (current), zr->user);/* kernel locks (fs/device.c), so don't do that ourselves * (prevents deadlocks) */
drivers/net/slip.c +3 -3
@@ -749,7 +749,7 @@ sl_alloc(dev_t line)if (sl->tty)continue ; -if (current->pid == sl->pid) { +if (task_pid (current) == sl->pid) {if (sl->line == line && score <3 ) { sel = i; score =3 ;
@@ -867,7 +867,7 @@ static int slip_open(struct tty_struct * sl->tty = tty; tty->disc_data = sl; sl->line =tty_devnum (tty); - sl->pid = current->pid; + sl->pid =task_pid (current);/* FIXME: already done before we were called - seems this can go */ if (tty->driver->flush_buffer)
@@ -1303,7 +1303,7 @@ static int sl_ioctl(struct net_device *d/* Resolve race condition, when ioctl'ing hanged up and opened by another process device. */ -if (sl->tty != current->signal->tty && sl->pid != current->pid) { +if (sl->tty != current->signal->tty && sl->pid !=task_pid (current)) {spin_unlock_bh (&sl->lock);return -EPERM ; }
drivers/net/tun.c +1 -1
@@ -709,7 +709,7 @@ static int tun_chr_fasync(int fd, structreturn ret;if (on) { - ret =f_setown (file, current->pid,0 ); + ret =f_setown (file,task_pid (current),0 );if (ret)return ret; tun->flags |=TUN_FASYNC ;
drivers/net/wireless/hostap/hostap_ioctl.c +1 -1
@@ -2923,7 +2923,7 @@ static int prism2_ioctl_priv_monitor(strprintk (KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " "- update software to use iwconfig mode monitor\n" , - dev->name, current->pid, current->comm); + dev->name,task_pid (current), current->comm);/* Backward compatibility code - this can be removed at some point */
drivers/oprofile/buffer_sync.c +2 -2
@@ -286,12 +286,12 @@ add_user_ctx_switch(struct task_struct c {add_event_entry (ESCAPE_CODE );add_event_entry (CTX_SWITCH_CODE ); -add_event_entry (task->pid); +add_event_entry (task_pid (task));add_event_entry (cookie);/* Another code for daemon back-compat */ add_event_entry (ESCAPE_CODE );add_event_entry (CTX_TGID_CODE ); -add_event_entry (task->tgid); +add_event_entry (task_tgid (task)); }
drivers/s390/char/fs3270.c +1 -1
@@ -444,7 +444,7 @@ fs3270_open(struct inode *inode, structreturn PTR_ERR (fp);init_waitqueue_head (&fp->wait); - fp->fs_pid = current->pid; + fp->fs_pid =task_pid (current); rc =raw3270_add_view (&fp->view, &fs3270_fn, minor);if (rc) {fs3270_free_view (&fp->view);
drivers/s390/crypto/z90main.c +2 -2
@@ -185,7 +185,7 @@ extern char z90hardware_version[];/** * PID() expands to the process ID of the current process */ -#define PID () (current->pid) +#define PID () (task_pid(current))/** * Selected Constants. The number of APs and the number of devices
@@ -942,7 +942,7 @@ init_work_element(struct work_element *w step =atomic_inc_return (&z90crypt_step);memcpy (we_p->caller_id+0 , (void *) &pid,sizeof (pid));memcpy (we_p->caller_id+4 , (void *) &step,sizeof (step)); - we_p->pid = pid; +we_task_pid (p) = pid; we_p->priv_data = priv_data; we_p->status[0 ] =STAT_DEFAULT ; we_p->audit[0 ] =0x00 ;
drivers/s390/s390mach.c +1 -1
@@ -183,7 +183,7 @@ s390_handle_mcck(void)printk (KERN_EMERG "mcck: Terminating task because of machine " "malfunction (code 0x%016llx).\n" , mcck.mcck_code);printk (KERN_EMERG "mcck: task: %s, pid: %d.\n" , - current->comm, current->pid); + current->comm,task_pid (current));do_exit (SIGSEGV ); } }
drivers/scsi/53c7xx.c +1 -1
@@ -4208,7 +4208,7 @@ restart:if (hostdata->options &OPTION_DEBUG_INTR ) {printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x " , - host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result); + host->host_no,tmtask_pid (p), tmp->device->id, tmp->device->lun, tmp->result);__scsi_print_command (tmp->cmnd); }
drivers/scsi/dc395x.c +2 -2
@@ -3554,7 +3554,7 @@ static void doing_srb_done(struct Adapte p = srb->cmd; dir = p->sc_data_direction; result =MK_RES (0 , did_flag,0 ,0 ); -printk ("G:%li(%02i-%i) " , p->pid, +printk ("G:%li(%02i-%i) " ,task_pid (p), p->device->id, p->device->lun);srb_going_remove (dcb, srb);free_tag (dcb, srb);
@@ -3584,7 +3584,7 @@ static void doing_srb_done(struct Adapte p = srb->cmd; result =MK_RES (0 , did_flag,0 ,0 ); -printk ("W:%li<%02i-%i>" , p->pid, p->device->id, +printk ("W:%li<%02i-%i>" ,task_pid (p), p->device->id, p->device->lun);srb_waiting_remove (dcb, srb);srb_free_insert (acb, srb);
drivers/scsi/eata_pio.c +1 -1
@@ -512,7 +512,7 @@ static int eata_pio_host_reset(struct sc sp =HD (cmd)->ccb[x].cmd;HD (cmd)->ccb[x].status =RESET ; -printk (KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n" , x, sp->pid); +printk (KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n" , x,stask_pid (p));if (sp ==NULL )panic ("eata_pio_reset: slot %d, sp==NULL.\n" , x);
drivers/serial/crisv10.c +2 -2
@@ -4346,7 +4346,7 @@ rs_close(struct tty_struct *tty, struct }#ifdef SERIAL_DEBUG_OPEN -printk ("[%d] rs_close ttyS%d, count = %d\n" , current->pid, +printk ("[%d] rs_close ttyS%d, count = %d\n" ,task_pid (current), info->line, info->count);#endif if ((tty->count ==1 ) && (info->count !=1 )) {
@@ -4639,7 +4639,7 @@ rs_open(struct tty_struct *tty, struct freturn -ENODEV ;#ifdef SERIAL_DEBUG_OPEN -printk ("[%d] rs_open %s, count = %d\n" , current->pid, tty->name, +printk ("[%d] rs_open %s, count = %d\n" ,task_pid (current), tty->name, info->count);#endif
drivers/usb/input/hid-lgff.c +4 -4
@@ -55,8 +55,8 @@#define DEVICE_CLOSING 0/* The driver is being unitialised */ /* Check that the current process can access an effect */ -#define CHECK_OWNERSHIP (effect) (current->pid == 0 \ - || effect.owner == current->pid) +#define CHECK_OWNERSHIP (effect) (task_pid(current) == 0 \ + || effect.owner == task_pid(current))#define LGFF_CHECK_OWNERSHIP (i, l) \ (i>=0 && i<LGFF_EFFECTS \
@@ -340,7 +340,7 @@ static int hid_lgff_flush(struct input_dmodified is when effects are uploaded or when an effect is erased. But a process cannot close its dev/input/eventX fd and perform ioctls on the same fd all at the same time */ -if ( current->pid == lgff->effects[i].owner +if (task_pid (current) == lgff->effects[i].owner &&test_bit (EFFECT_USED , lgff->effects[i].flags)) {if (hid_lgff_erase (dev, i))
@@ -392,7 +392,7 @@ static int hid_lgff_upload_effect(struct } effect->id = i; - lgff->effects[i].owner = current->pid; + lgff->effects[i].owner =task_pid (current); lgff->effects[i].flags[0 ] =0 ;set_bit (EFFECT_USED , lgff->effects[i].flags); }
drivers/usb/input/hid-tmff.c +4 -4
@@ -51,8 +51,8 @@#define DEVICE_CLOSING 0/* The driver is being unitialised */ /* Check that the current process can access an effect */ -#define CHECK_OWNERSHIP (effect) (current->pid == 0 \ - || effect.owner == current->pid) +#define CHECK_OWNERSHIP (effect) (task_pid(current) == 0 \ + || effect.owner == task_pid(current))#define TMFF_CHECK_ID (id) ((id) >= 0 && (id) < TMFF_EFFECTS)
@@ -255,7 +255,7 @@ static int hid_tmff_flush(struct input_derased. But a process cannot close its dev/input/eventX fd and perform ioctls on the same fd all at the same time */ -if (current->pid == tmff->effects[i].owner +if (task_pid (current) == tmff->effects[i].owner &&test_bit (EFFECT_USED , tmff->effects[i].flags))if (hid_tmff_erase (dev, i))warn ("erase effect %d failed" , i);
@@ -310,7 +310,7 @@ static int hid_tmff_upload_effect(struct } effect->id = id; - tmff->effects[id].owner = current->pid; + tmff->effects[id].owner =task_pid (current); tmff->effects[id].flags[0 ] =0 ;set_bit (EFFECT_USED , tmff->effects[id].flags);
drivers/usb/input/pid.c +4 -4
@@ -42,8 +42,8 @@#define CHECK_OWNERSHIP (i, hid_pid) \ ((i) < FF_EFFECTS_MAX && i >= 0 && \ test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \ - (current->pid == 0 || \ - (hid_pid)->effects[(i)].owner == current->pid)) + (task_pid(current) == 0 || \ + (hid_pid)->effects[(i)].owner == task_pid(current)))/* Called when a transfer is completed */ static void hid_pid_ctrl_out (struct urb *u,struct pt_regs *regs)
@@ -153,7 +153,7 @@ static int hid_pid_flush(struct input_deand perform ioctls on the same fd all at the same time */ /*FIXME: multiple threads, anyone? */ for (i =0 ; i < dev->ff_effects_max; ++i) -if (current->pid == pid->effects[i].owner +if (task_pid (current) == pid->effects[i].owner &&test_bit (FF_PID_FLAGS_USED , &pid->effects[i].flags))if (hid_pid_erase (dev, i))dev_warn (&hid->dev->dev,"erase effect %d failed" , i);
@@ -199,7 +199,7 @@ static int hid_pid_upload_effect(struct effect->id = id;dev_dbg (&pid_private->hid->dev->dev,"effect ID is %d.\n" , id); - pid_private->effects[id].owner = current->pid; + pid_private->effects[id].owner =task_pid (current); pid_private->effects[id].flags = (1 <<FF_PID_FLAGS_USED );spin_unlock_irqrestore (&pid_private->lock, flags);
drivers/usb/core/devio.c +3 -3
@@ -466,7 +466,7 @@ static int checkintf(struct dev_state *preturn 0 ;/* if not yet claimed, claim it for the driver */ dev_warn (&ps->dev->dev,"usbfs: process %d (%s) did not claim interface %u before use\n" , - current->pid, current->comm, ifnum); +task_pid (current), current->comm, ifnum);return claimintf (ps, ifnum); }
@@ -572,7 +572,7 @@ static int usbdev_open(struct inode *inoINIT_LIST_HEAD (&ps->async_completed);init_waitqueue_head (&ps->wait); ps->discsignr =0 ; - ps->disc_pid = current->pid; + ps->disc_pid =task_pid (current); ps->disc_uid = current->uid; ps->disc_euid = current->euid; ps->disccontext =NULL ;
@@ -1055,7 +1055,7 @@ static int proc_do_submiturb(struct dev_ as->userbuffer =NULL ; as->signr = uurb->signr; as->ifnum = ifnum; - as->pid = current->pid; + as->pid =task_pid (current); as->uid = current->uid; as->euid = current->euid;if (!(uurb->endpoint &USB_DIR_IN )) {
--
RFC PATCH 2/13 Change pid accesses: most archs
In reply to Serge E. HallynReplace-Subject: Change pid accesses: most archs
From: Serge Hallyn <[email protected]>
Change pid accesses for most architectures.
--- arch/alpha/kernel/semaphore.c | 16 ++++++++-------- arch/alpha/kernel/signal.c | 4 ++-- arch/alpha/kernel/traps.c | 6 +++--- arch/alpha/mm/fault.c | 4 ++-- arch/arm/kernel/process.c | 2 +- arch/arm/kernel/ptrace.c | 4 ++-- arch/arm/kernel/traps.c | 10 +++++----- arch/arm/mm/alignment.c | 2 +- arch/arm/mm/fault.c | 2 +- arch/arm/nwfpe/fpmodule.c | 2 +- arch/arm26/kernel/ptrace.c | 2 +- arch/arm26/kernel/traps.c | 12 ++++++------ arch/arm26/mm/fault.c | 2 +- arch/arm26/nwfpe/fpmodule.c | 2 +- arch/cris/arch-v10/kernel/traps.c | 2 +- arch/cris/arch-v32/kernel/process.c | 2 +- arch/cris/arch-v32/kernel/ptrace.c | 4 ++-- arch/cris/arch-v32/kernel/signal.c | 2 +- arch/cris/arch-v32/kernel/traps.c | 2 +- arch/cris/kernel/profile.c | 2 +- arch/frv/kernel/gdb-stub.c | 2 +- arch/frv/kernel/ptrace.c | 10 +++++----- arch/frv/kernel/semaphore.c | 2 +- arch/frv/kernel/signal.c | 4 ++-- arch/frv/kernel/traps.c | 4 ++-- arch/frv/mm/fault.c | 4 ++-- arch/h8300/kernel/traps.c | 2 +- arch/i386/kernel/crash.c | 2 +- arch/i386/kernel/process.c | 2 +- arch/i386/kernel/signal.c | 4 ++-- arch/i386/kernel/traps.c | 2 +- arch/i386/lib/usercopy.c | 2 +- arch/i386/mm/fault.c | 2 +- arch/m32r/kernel/process.c | 8 ++++---- arch/m32r/kernel/signal.c | 2 +- arch/m32r/kernel/traps.c | 2 +- arch/m32r/mm/fault.c | 2 +- arch/m68k/kernel/traps.c | 6 +++--- arch/m68k/mac/macints.c | 2 +- arch/m68k/mm/fault.c | 2 +- arch/m68knommu/kernel/process.c | 2 +- arch/m68knommu/kernel/time.c | 2 +- arch/m68knommu/kernel/traps.c | 4 ++-- arch/m68knommu/platform/5307/timers.c | 2 +- arch/parisc/kernel/signal.c | 4 ++-- arch/parisc/kernel/smp.c | 5 +++-- arch/parisc/kernel/sys_parisc32.c | 2 +- arch/parisc/kernel/traps.c | 12 ++++++------ arch/parisc/kernel/unaligned.c | 2 +- arch/parisc/mm/fault.c | 2 +- arch/powerpc/kernel/process.c | 2 +- arch/powerpc/kernel/traps.c | 4 ++-- arch/powerpc/mm/fault.c | 2 +- arch/powerpc/platforms/pseries/ras.c | 4 ++-- arch/powerpc/xmon/xmon.c | 2 +- arch/ppc/kernel/process.c | 6 +++--- arch/ppc/kernel/softemu8xx.c | 2 +- arch/ppc/kernel/traps.c | 4 ++-- arch/ppc/lib/locks.c | 6 +++--- arch/ppc/mm/fault.c | 2 +- arch/ppc/xmon/xmon.c | 2 +- arch/s390/kernel/asm-offsets.c | 2 +- arch/s390/kernel/process.c | 2 +- arch/s390/math-emu/math.c | 2 +- arch/s390/mm/fault.c | 2 +- arch/sh/kernel/process.c | 2 +- arch/sh/kernel/signal.c | 4 ++-- arch/sh/kernel/traps.c | 2 +- arch/sh/mm/fault.c | 2 +- arch/sh64/kernel/process.c | 2 +- arch/sh64/kernel/signal.c | 4 ++-- arch/sh64/kernel/traps.c | 4 ++-- arch/sh64/lib/dbg.c | 12 ++++++------ arch/sh64/mm/fault.c | 10 +++++----- arch/sparc/kernel/process.c | 2 +- arch/sparc/kernel/ptrace.c | 8 ++++---- arch/sparc/kernel/setup.c | 2 +- arch/sparc/kernel/sys_sparc.c | 2 +- arch/sparc/kernel/sys_sunos.c | 2 +- arch/sparc/kernel/traps.c | 4 ++-- arch/sparc/mm/fault.c | 6 +++--- arch/sparc64/kernel/process.c | 2 +- arch/sparc64/kernel/setup.c | 2 +- arch/sparc64/kernel/sys_sunos32.c | 2 +- arch/sparc64/kernel/traps.c | 2 +- arch/sparc64/solaris/ioctl.c | 4 ++-- arch/um/kernel/process_kern.c | 4 ++-- arch/um/kernel/skas/process_kern.c | 4 ++-- arch/um/kernel/trap_kern.c | 2 +- arch/um/sys-x86_64/sysrq.c | 2 +- arch/v850/kernel/bug.c | 4 ++-- arch/v850/kernel/signal.c | 4 ++-- arch/x86_64/ia32/ia32_signal.c | 4 ++-- arch/x86_64/ia32/ptrace32.c | 2 +- arch/x86_64/kernel/asm-offsets.c | 2 +- arch/x86_64/kernel/mce.c | 2 +- arch/x86_64/kernel/process.c | 2 +- arch/x86_64/kernel/signal.c | 10 +++++----- arch/x86_64/kernel/traps.c | 6 +++--- arch/x86_64/mm/fault.c | 8 ++++---- arch/xtensa/kernel/signal.c | 4 ++-- arch/xtensa/kernel/syscalls.c | 4 ++-- arch/xtensa/kernel/traps.c | 6 +++--- arch/xtensa/mm/fault.c | 4 ++-- drivers/s390/crypto/z90main.c | 2 +- 105 files changed, 194 insertions(+), 193 deletions(-)
arch/i386/kernel/crash.c +1 -1
@@ -73,7 +73,7 @@ static void crash_save_this_cpu(struct p*/ buf = &crash_notes[cpu][0 ];memset (&prstatus,0 ,sizeof (prstatus)); - prstatus.pr_pid = current->pid; + prstatus.pr_pid =task_pid (current);elf_core_copy_regs (&prstatus.pr_reg, regs); buf =append_elf_note (buf,"CORE" ,NT_PRSTATUS , &prstatus,sizeof (prstatus));
arch/i386/kernel/process.c +1 -1
@@ -290,7 +290,7 @@ void show_regs(struct pt_regs * regs)unsigned long cr0 =0L , cr2 =0L , cr3 =0L , cr4 =0L ;printk ("\n" ); -printk ("Pid: %d, comm: %20s\n" , current->pid, current->comm); +printk ("Pid: %d, comm: %20s\n" ,task_pid (current), current->comm);printk ("EIP: %04x:[<%08lx>] CPU: %d\n" ,0xffff & regs->xcs,regs->eip,smp_processor_id ());print_symbol ("EIP is at %s\n" , regs->eip);
arch/i386/kernel/signal.c +2 -2
@@ -430,7 +430,7 @@ static int setup_frame(int sig, struct k#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->eip, frame->pretcode); + current->comm,task_pid (current), frame, regs->eip, frame->pretcode);#endif return 1 ;
@@ -524,7 +524,7 @@ static int setup_rt_frame(int sig, struc#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->eip, frame->pretcode); + current->comm,task_pid (current), frame, regs->eip, frame->pretcode);#endif return 1 ;
arch/i386/kernel/traps.c +1 -1
@@ -228,7 +228,7 @@ void show_registers(struct pt_regs *regsprintk ("ds: %04x es: %04x ss: %04x\n" , regs->xds &0xffff , regs->xes &0xffff , ss);printk ("Process %s (pid: %d, threadinfo=%p task=%p)" , - current->comm, current->pid,current_thread_info (), current); + current->comm,task_pid (current),current_thread_info (), current);/* * When in-kernel, we also print out the stack and code at the * time of the fault..
arch/i386/lib/usercopy.c +1 -1
@@ -543,7 +543,7 @@ survive: retval =get_user_pages (current, current->mm, (unsigned long )to,1 ,1 ,0 , &pg,NULL ); -if (retval == -ENOMEM && current->pid ==1 ) { +if (retval == -ENOMEM &&task_pid (current) ==1 ) {up_read (¤t->mm->mmap_sem);blk_congestion_wait (WRITE ,HZ /50 ); goto survive;
arch/i386/mm/fault.c +1 -1
@@ -485,7 +485,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (tsk->pid ==1 ) { +if (task_pid (tsk) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/alpha/kernel/semaphore.c +8 -8
@@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem)#ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down failed(%p)\n" , - tsk->comm, tsk->pid, sem); + tsk->comm,task_pid (tsk), sem);#endif tsk->state =TASK_UNINTERRUPTIBLE ;
@@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem)#ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down acquired(%p)\n" , - tsk->comm, tsk->pid, sem); + tsk->comm,task_pid (tsk), sem);#endif }
@@ -111,7 +111,7 @@ __down_failed_interruptible(struct semap#ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down failed(%p)\n" , - tsk->comm, tsk->pid, sem); + tsk->comm,task_pid (tsk), sem);#endif tsk->state =TASK_INTERRUPTIBLE ;
@@ -139,7 +139,7 @@ __down_failed_interruptible(struct semap#ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down %s(%p)\n" , - current->comm, current->pid, + current->comm,task_pid (current), (ret <0 ?"interrupted" :"acquired" ), sem);#endif return ret;
@@ -168,7 +168,7 @@ down(struct semaphore *sem)#endif #ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down(%p) <count=%d> from %p\n" , - current->comm, current->pid, sem, + current->comm,task_pid (current), sem,atomic_read (&sem->count),__builtin_return_address (0 ));#endif __down (sem);
@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem#endif #ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down(%p) <count=%d> from %p\n" , - current->comm, current->pid, sem, + current->comm,task_pid (current), sem,atomic_read (&sem->count),__builtin_return_address (0 ));#endif return __down_interruptible (sem);
@@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem)#ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): down_trylock %s from %p\n" , - current->comm, current->pid, + current->comm,task_pid (current), ret ?"failed" :"acquired" ,__builtin_return_address (0 ));#endif
@@ -217,7 +217,7 @@ up(struct semaphore *sem)#endif #ifdef CONFIG_DEBUG_SEMAPHORE printk ("%s(%d): up(%p) <count=%d> from %p\n" , - current->comm, current->pid, sem, + current->comm,task_pid (current), sem,atomic_read (&sem->count),__builtin_return_address (0 ));#endif __up (sem);
arch/alpha/kernel/signal.c +2 -2
@@ -479,7 +479,7 @@ setup_frame(int sig, struct k_sigaction#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->pc, regs->r26); + current->comm,task_pid (current), frame, regs->pc, regs->r26);#endif return ;
@@ -541,7 +541,7 @@ setup_rt_frame(int sig, struct k_sigacti#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->pc, regs->r26); + current->comm,task_pid (current), frame, regs->pc, regs->r26);#endif return ;
arch/alpha/kernel/traps.c +3 -3
@@ -183,7 +183,7 @@ die_if_kernel(char * str, struct pt_regs#ifdef CONFIG_SMP printk ("CPU %d " ,hard_smp_processor_id ());#endif -printk ("%s(%d): %s %ld\n" , current->comm, current->pid, str, err); +printk ("%s(%d): %s %ld\n" , current->comm,task_pid (current), str, err);dik_show_regs (regs, r9_15);dik_show_trace ((unsigned long *)(regs+1 ));dik_show_code ((unsigned int *)regs->pc);
@@ -646,7 +646,7 @@ got_exception:lock_kernel ();printk ("%s(%d): unhandled unaligned exception\n" , - current->comm, current->pid); + current->comm,task_pid (current));printk ("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n" , pc,una_reg (26 ), regs->ps);
@@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned }if (++cnt <5 ) {printk ("%s(%d): unaligned trap at %016lx: %p %lx %ld\n" , - current->comm, current->pid, + current->comm,task_pid (current), regs->pc -4 , va, opcode, reg); } last_time = jiffies;
arch/alpha/mm/fault.c +2 -2
@@ -194,13 +194,13 @@ do_page_fault(unsigned long address, uns/* We ran out of memory, or some other thing happened to us that made us unable to handle the page fault gracefully. */ out_of_memory: -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive; }printk (KERN_ALERT "VM: killing process %s(%d)\n" , - current->comm, current->pid); + current->comm,task_pid (current));if (!user_mode (regs)) goto no_context;do_exit (SIGKILL );
arch/arm/kernel/process.c +1 -1
@@ -227,7 +227,7 @@ void __show_regs(struct pt_regs *regs)void show_regs (struct pt_regs * regs) {printk ("\n" ); -printk ("Pid: %d, comm: %20s\n" , current->pid, current->comm); +printk ("Pid: %d, comm: %20s\n" ,task_pid (current), current->comm);__show_regs (regs);__backtrace (); }
arch/arm/kernel/ptrace.c +2 -2
@@ -392,7 +392,7 @@ static void clear_breakpoint(struct taskif (ret !=2 || old_insn.thumb !=BREAKINST_THUMB )printk (KERN_ERR "%s:%d: corrupted Thumb breakpoint at " -"0x%08lx (0x%04x)\n" , task->comm, task->pid, +"0x%08lx (0x%04x)\n" , task->comm,task_pid (task), addr, old_insn.thumb); }else { ret = swap_insn(task, addr & ~3, &old_insn.arm,
@@ -400,7 +400,7 @@ static void clear_breakpoint(struct taskif (ret !=4 || old_insn.arm !=BREAKINST_ARM )printk (KERN_ERR "%s:%d: corrupted ARM breakpoint at " -"0x%08lx (0x%08x)\n" , task->comm, task->pid, +"0x%08lx (0x%08x)\n" , task->comm,task_pid (task), addr, old_insn.arm); } }
arch/arm/kernel/traps.c +5 -5
@@ -207,7 +207,7 @@ static void __die(const char *str, int eprint_modules ();__show_regs (regs);printk ("Process %s (pid: %d, stack limit = 0x%p)\n" , - tsk->comm, tsk->pid, thread +1 ); + tsk->comm,task_pid (tsk), thread +1 );if (!user_mode (regs) ||in_interrupt ()) { dump_mem("Stack: ", regs->ARM_sp,
@@ -306,7 +306,7 @@ asmlinkage void do_undefinstr(struct pt_#ifdef CONFIG_DEBUG_USER if (user_debug &UDBG_UNDEFINED ) {printk (KERN_INFO "%s (%d): undefined instruction: pc=%p\n" , - current->comm, current->pid, pc); + current->comm,task_pid (current), pc);dump_instr (regs); }#endif
@@ -360,7 +360,7 @@ static int bad_syscall(int n, struct pt_#ifdef CONFIG_DEBUG_USER if (user_debug &UDBG_SYSCALL ) {printk (KERN_ERR "[%d] %s: obsolete system call %08x.\n" , - current->pid, current->comm, n); +task_pid (current), current->comm, n);dump_instr (regs); }#endif
@@ -537,7 +537,7 @@ asmlinkage int arm_syscall(int no, struc*/ if (user_debug &UDBG_SYSCALL ) {printk ("[%d] %s: arm syscall %d\n" , - current->pid, current->comm, no); +task_pid (current), current->comm, no);dump_instr (regs);if (user_mode (regs)) {__show_regs (regs);
@@ -614,7 +614,7 @@ baddataabort(int code, unsigned long ins#ifdef CONFIG_DEBUG_USER if (user_debug &UDBG_BADABORT ) {printk (KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n" , - current->pid, current->comm, code, instr); +task_pid (current), current->comm, code, instr);dump_instr (regs);show_pte (current->mm, addr); }
arch/arm/mm/alignment.c +1 -1
@@ -759,7 +759,7 @@ do_alignment(unsigned long addr, unsigneif (ai_usermode &1 )printk ("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx " "Address=0x%08lx FSR 0x%03x\n" , current->comm, - current->pid, instrptr, +task_pid (current), instrptr,thumb_mode (regs) ?4 :8 ,thumb_mode (regs) ? tinstr : instr, addr, fsr);
arch/arm/mm/fault.c +1 -1
@@ -198,7 +198,7 @@ survive:return fault; } -if (tsk->pid !=1 ) +if (task_pid (tsk) !=1 ) goto out;/*
arch/arm/nwfpe/fpmodule.c +1 -1
@@ -131,7 +131,7 @@ void float_raise(signed char flags)if (flags & ~BIT_IXC )printk (KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n" , - current->comm, current->pid, flags, + current->comm,task_pid (current), flags,__builtin_return_address (0 ),GET_USERREG ()->ARM_pc);#endif
arch/arm26/kernel/ptrace.c +1 -1
@@ -366,7 +366,7 @@ static void clear_breakpoint(struct taskif (ret !=4 || old_insn !=BREAKINST_ARM )printk (KERN_ERR "%s:%d: corrupted ARM breakpoint at " -"0x%08lx (0x%08x)\n" , task->comm, task->pid, +"0x%08lx (0x%08x)\n" , task->comm,task_pid (task), addr, old_insn); }
arch/arm26/kernel/traps.c +6 -6
@@ -187,7 +187,7 @@ NORET_TYPE void die(const char *str, strprintk ("CPU: %d\n" ,smp_processor_id ());show_regs (regs);printk ("Process %s (pid: %d, stack limit = 0x%p)\n" , - current->comm, current->pid, tsk->thread_info +1 ); + current->comm,task_pid (current), tsk->thread_info +1 );if (!user_mode (regs) ||in_interrupt ()) {__dump_stack (tsk, (unsigned long )(regs +1 ));
@@ -276,7 +276,7 @@ asmlinkage void do_undefinstr(struct pt_#ifdef CONFIG_DEBUG_USER printk (KERN_INFO "%s (%d): undefined instruction: pc=%p\n" , - current->comm, current->pid, pc); + current->comm,task_pid (current), pc);dump_instr (regs);#endif
@@ -299,7 +299,7 @@ asmlinkage void do_excpt(unsigned long a#ifdef CONFIG_DEBUG_USER printk (KERN_INFO "%s (%d): address exception: pc=%08lx\n" , - current->comm, current->pid,instruction_pointer (regs)); + current->comm,task_pid (current),instruction_pointer (regs));dump_instr (regs);#endif
@@ -363,7 +363,7 @@ static int bad_syscall(int n, struct pt_#ifdef CONFIG_DEBUG_USER printk (KERN_ERR "[%d] %s: obsolete system call %08x.\n" , - current->pid, current->comm, n); +task_pid (current), current->comm, n);dump_instr (regs);#endif
@@ -442,7 +442,7 @@ asmlinkage int arm_syscall(int no, struc* experience shows that these seem to indicate that * something catastrophic has happened */ -printk ("[%d] %s: arm syscall %d\n" , current->pid, current->comm, no); +printk ("[%d] %s: arm syscall %d\n" ,task_pid (current), current->comm, no);dump_instr (regs);if (user_mode (regs)) {show_regs (regs);
@@ -478,7 +478,7 @@ baddataabort(int code, unsigned long ins#ifdef CONFIG_DEBUG_USER printk (KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n" , - current->pid, current->comm, code, instr); +task_pid (current), current->comm, code, instr);dump_instr (regs);show_pte (current->mm, addr);#endif
arch/arm26/mm/fault.c +1 -1
@@ -186,7 +186,7 @@ survive: } fault =-3 ;/* out of memory */ -if (tsk->pid !=1 ) +if (task_pid (tsk) !=1 ) goto out;/*
arch/arm26/nwfpe/fpmodule.c +1 -1
@@ -145,7 +145,7 @@ void float_raise(signed char flags)#ifdef CONFIG_DEBUG_USER printk (KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %p from %08x\n" , - current->comm, current->pid, flags, + current->comm,task_pid (current), flags,__builtin_return_address (0 ),GET_USERREG ()[15 ]);#endif
arch/cris/arch-v10/kernel/traps.c +1 -1
@@ -40,7 +40,7 @@ show_registers(struct pt_regs * regs) regs->r12, regs->r13, regs->orig_r10, regs);raw_printk ("R_MMU_CAUSE: %08lx\n" , (unsigned long )*R_MMU_CAUSE );raw_printk ("Process %s (pid: %d, stackpage=%08lx)\n" , - current->comm, current->pid, (unsigned long )current); + current->comm,task_pid (current), (unsigned long )current);/* * When in-kernel, we also print out the stack and code at the
arch/cris/arch-v32/kernel/process.c +1 -1
@@ -45,7 +45,7 @@ void default_idle(void)extern void deconfigure_bp (long pid);void exit_thread (void ) { -deconfigure_bp (current->pid); +deconfigure_bp (task_pid (current)); }/*
arch/cris/arch-v32/kernel/ptrace.c +2 -2
@@ -52,7 +52,7 @@ long get_reg(struct task_struct *task, uelse if (regno ==PT_PPC ) ret =get_pseudo_pc (task);else if (regno <=PT_MAX ) - ret =get_debugreg (task->pid, regno); + ret =get_debugreg (task_pid (task), regno);else ret =0 ;
@@ -73,7 +73,7 @@ int put_reg(struct task_struct *task, unif (data !=get_pseudo_pc (task)) ((unsigned long *)user_regs (task->thread_info))[PT_ERP ] = data; }else if (regno <=PT_MAX ) -return put_debugreg (task->pid, regno, data); +return put_debugreg (task_pid (task), regno, data);else return -1 ;return 0 ;
arch/cris/arch-v32/kernel/signal.c +1 -1
@@ -648,7 +648,7 @@ ugdb_trap_user(struct thread_info *ti, iif (!(user_regs (ti)->erp &0x1 ))user_regs (ti)->erp -=2 ; } -sys_kill (ti->task->pid, sig); +sys_kill (ti->task_pid (task), sig); }void
arch/cris/arch-v32/kernel/traps.c +1 -1
@@ -57,7 +57,7 @@ show_registers(struct pt_regs *regs)raw_printk ("Instruction MMU Cause: %08lx\n" , i_mmu_cause);raw_printk ("Process %s (pid: %d, stackpage: %08lx)\n" , - current->comm, current->pid, (unsigned long ) current); + current->comm,task_pid (current), (unsigned long ) current);/* Show additional info if in kernel-mode. */ if (!user_mode (regs)) {
arch/cris/kernel/profile.c +1 -1
@@ -18,7 +18,7 @@ cris_profile_sample(struct pt_regs* regsif (!prof_running)return ;if (user_mode (regs)) - *(unsigned int *)sample_buffer_pos = current->pid; + *(unsigned int *)sample_buffer_pos =task_pid (current);else *(unsigned int *)sample_buffer_pos =0 ; *(unsigned int *)(sample_buffer_pos +4 ) =instruction_pointer (regs);
arch/frv/kernel/gdb-stub.c +1 -1
@@ -1182,7 +1182,7 @@ static void __attribute__((unused)) gdbsprintk (" | " ); } -gdbstub_printk ("Process %s (pid: %d)\n" , current->comm, current->pid); +gdbstub_printk ("Process %s (pid: %d)\n" , current->comm,task_pid (current)); }/* end gdbstub_show_regs() */ /*****************************************************************************/
arch/frv/kernel/ptrace.c +5 -5
@@ -639,7 +639,7 @@ asmlinkage void do_syscall_trace(int leaif (!leaving) {if (!argmask) { printk(KERN_CRIT "[%d] %s(%lx,%lx,%lx,%lx,%lx,%lx)\n", - current->pid, + task_pid(current), name, __frame->gr8, __frame->gr9,
@@ -650,12 +650,12 @@ asmlinkage void do_syscall_trace(int lea }else if (argmask ==0xffffff ) {printk (KERN_CRIT "[%d] %s()\n" , - current->pid, +task_pid (current), name); }else {printk (KERN_CRIT "[%d] %s(" , - current->pid, +task_pid (current), name); argp = &__frame->gr8;
@@ -691,9 +691,9 @@ asmlinkage void do_syscall_trace(int lea }else {if ((int )__frame->gr8 >-4096 && (int )__frame->gr8 <4096 ) -printk (KERN_CRIT "[%d] %s() = %ld\n" , current->pid, name, __frame->gr8); +printk (KERN_CRIT "[%d] %s() = %ld\n" ,task_pid (current), name, __frame->gr8);else -printk (KERN_CRIT "[%d] %s() = %lx\n" , current->pid, name, __frame->gr8); +printk (KERN_CRIT "[%d] %s() = %lx\n" ,task_pid (current), name, __frame->gr8); }return ;#endif
arch/frv/kernel/semaphore.c +1 -1
@@ -25,7 +25,7 @@ void semtrace(struct semaphore *sem, con {if (sem->debug)printk ("[%d] %s({%d,%d})\n" , - current->pid, +task_pid (current), str, sem->counter,list_empty (&sem->wait_list) ?0 :1 );
arch/frv/kernel/signal.c +2 -2
@@ -364,7 +364,7 @@ static void setup_frame(int sig, struct#if DEBUG_SIG printk ("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n" , - sig, current->comm, current->pid, frame, regs->pc, frame->pretcode); + sig, current->comm,task_pid (current), frame, regs->pc, frame->pretcode);#endif return ;
@@ -459,7 +459,7 @@ static void setup_rt_frame(int sig, stru#if DEBUG_SIG printk ("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n" , - sig, current->comm, current->pid, frame, regs->pc, frame->pretcode); + sig, current->comm,task_pid (current), frame, regs->pc, frame->pretcode);#endif return ;
arch/frv/kernel/traps.c +2 -2
@@ -296,7 +296,7 @@ void show_regs(struct pt_regs *regs)printk (" | " ); } -printk ("Process %s (pid: %d)\n" , current->comm, current->pid); +printk ("Process %s (pid: %d)\n" , current->comm,task_pid (current)); }void die_if_kernel (const char *str, ...)
@@ -365,7 +365,7 @@ void show_backtrace(struct pt_regs *fram stop = (unsigned long ) frame; } -printk ("\nProcess %s (pid: %d)\n\n" , current->comm, current->pid); +printk ("\nProcess %s (pid: %d)\n\n" , current->comm,task_pid (current));for (;;) {/* dump stack segment between frames */
arch/frv/mm/fault.c +2 -2
@@ -101,10 +101,10 @@ asmlinkage void do_page_fault(int datammif ((ear0 &PAGE_MASK ) +2 *PAGE_SIZE < __frame->sp) {#if 0 printk ("[%d] ### Access below stack @%lx (sp=%lx)\n" , - current->pid, ear0, __frame->sp); +task_pid (current), ear0, __frame->sp);show_registers (__frame); printk("[%d] ### Code: [%08lx] %02x %02x %02x %02x %02x %02x %02x %02x\n", - current->pid, + task_pid(current), __frame->pc, ((u8*)__frame->pc)[0], ((u8*)__frame->pc)[1],
arch/h8300/kernel/traps.c +1 -1
@@ -56,7 +56,7 @@ static void dump(struct pt_regs *fp)int i;printk ("\nCURRENT PROCESS:\n\n" ); -printk ("COMM=%s PID=%d\n" , current->comm, current->pid); +printk ("COMM=%s PID=%d\n" , current->comm,task_pid (current));if (current->mm) { printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n", (int) current->mm->start_code,
arch/m32r/kernel/process.c +4 -4
@@ -214,19 +214,19 @@ int kernel_thread(int (*fn)(void *), voivoid exit_thread (void ) {/* Nothing to do. */ -DPRINTK ("pid = %d\n" , current->pid); +DPRINTK ("pid = %d\n" ,task_pid (current)); }void flush_thread (void ) { -DPRINTK ("pid = %d\n" , current->pid); +DPRINTK ("pid = %d\n" ,task_pid (current));memset (¤t->thread.debug_trap,0 ,sizeof (struct debug_trap )); }void release_thread (struct task_struct *dead_task) {/* do nothing */ -DPRINTK ("pid = %d\n" , dead_task->pid); +DPRINTK ("pid = %d\n" ,dead_task_pid (task)); }/* Fill in the fpu structure for a core dump.. */
@@ -249,7 +249,7 @@ int copy_thread(int nr, unsigned long cl childregs->spu = spu; childregs->r0 =0 ;/* Child gets zero as return value */ - regs->r0 = tsk->pid; + regs->r0 =task_pid (tsk); tsk->thread.sp = (unsigned long )childregs; tsk->thread.lr = (unsigned long )ret_from_fork;
arch/m32r/kernel/signal.c +1 -1
@@ -294,7 +294,7 @@ static void setup_rt_frame(int sig, stru#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p\n" , - current->comm, current->pid, frame, regs->pc); + current->comm,task_pid (current), frame, regs->pc);#endif return ;
arch/m32r/kernel/traps.c +1 -1
@@ -197,7 +197,7 @@ static void show_registers(struct pt_regprintk ("SPI: %08lx\n" , sp); }printk ("Process %s (pid: %d, process nr: %d, stackpage=%08lx)" , - current->comm, current->pid,0xffff & i,4096 +(unsigned long )current); + current->comm,task_pid (current),0xffff & i,4096 +(unsigned long )current);/* * When in-kernel, we also print out the stack and code at the
arch/m32r/mm/fault.c +1 -1
@@ -300,7 +300,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (tsk->pid ==1 ) { +if (task_pid (tsk) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/m68k/kernel/traps.c +3 -3
@@ -673,7 +673,7 @@ static inline void bus_error030 (struct#ifdef DEBUG unsigned long desc; -printk ("pid = %x " , current->pid); +printk ("pid = %x " ,task_pid (current));printk ("SSW=%#06x " , ssw);if (ssw & (FC |FB ))
@@ -1057,7 +1057,7 @@ void bad_super_trap (struct frame *fp) fp->un.fmtb.daddr, space_names[ssw &DFC ], fp->ptregs.pc); } -printk ("Current process id is %d\n" , current->pid); +printk ("Current process id is %d\n" ,task_pid (current));die_if_kernel ("BAD KERNEL TRAP" , &fp->ptregs,0 ); }
@@ -1199,7 +1199,7 @@ void die_if_kernel (char *str, struct pt fp->d4, fp->d5, fp->a0, fp->a1);printk ("Process %s (pid: %d, stackpage=%08lx)\n" , - current->comm, current->pid,PAGE_SIZE +(unsigned long )current); + current->comm,task_pid (current),PAGE_SIZE +(unsigned long )current);show_stack (NULL , (unsigned long *)fp);do_exit (SIGSEGV ); }
arch/m68k/mac/macints.c +1 -1
@@ -696,7 +696,7 @@ irqreturn_t mac_nmi_handler(int irq, voiif (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)printk ("Corrupted stack page\n" );printk ("Process %s (pid: %d, stackpage=%08lx)\n" , - current->comm, current->pid, current->kernel_stack_page); + current->comm,task_pid (current), current->kernel_stack_page);if (intr_count ==1 )dump_stack ((struct frame *)fp);#else
arch/m68k/mm/fault.c +1 -1
@@ -181,7 +181,7 @@ good_area:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/m68knommu/kernel/process.c +1 -1
@@ -331,7 +331,7 @@ void dump(struct pt_regs *fp)int i;printk (KERN_EMERG "\nCURRENT PROCESS:\n\n" ); -printk (KERN_EMERG "COMM=%s PID=%d\n" , current->comm, current->pid); +printk (KERN_EMERG "COMM=%s PID=%d\n" , current->comm,task_pid (current));if (current->mm) { printk(KERN_EMERG "TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
arch/m68knommu/kernel/time.c +1 -1
@@ -56,7 +56,7 @@ static irqreturn_t timer_interrupt(int i#ifndef CONFIG_SMP update_process_times (user_mode (regs));#endif -if (current->pid) +if (task_pid (current))profile_tick (CPU_PROFILING , regs);/*
arch/m68knommu/kernel/traps.c +2 -2
@@ -82,7 +82,7 @@ void die_if_kernel(char *str, struct pt_ fp->d4, fp->d5, fp->a0, fp->a1);printk (KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n" , - current->comm, current->pid,PAGE_SIZE +(unsigned long )current); + current->comm,task_pid (current),PAGE_SIZE +(unsigned long )current);show_stack (NULL , (unsigned long *)fp);do_exit (SIGSEGV ); }
@@ -166,7 +166,7 @@ void bad_super_trap(struct frame *fp)printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n" , (fp->ptregs.vector) >>2 , fp->ptregs.format); -printk (KERN_WARNING "Current process id is %d\n" , current->pid); +printk (KERN_WARNING "Current process id is %d\n" ,task_pid (current));die_if_kernel ("BAD KERNEL TRAP" , &fp->ptregs,0 ); }
arch/m68knommu/platform/5307/timers.c +1 -1
@@ -110,7 +110,7 @@ void coldfire_profile_tick(int irq, void {/* Reset ColdFire timer2 */ mcf_proftp->ter =MCFTIMER_TER_CAP |MCFTIMER_TER_REF ; -if (current->pid) +if (task_pid (current))profile_tick (CPU_PROFILING , regs); }
arch/parisc/kernel/signal.c +2 -2
@@ -228,7 +228,7 @@ give_sigsegv: si.si_signo =SIGSEGV ; si.si_errno =0 ; si.si_code =SI_KERNEL ; - si.si_pid = current->pid; + si.si_pid =task_pid (current); si.si_uid = current->uid; si.si_addr = &frame->uc;force_sig_info (SIGSEGV , &si, current);
@@ -483,7 +483,7 @@ setup_rt_frame(int sig, struct k_sigactiDBG (1 ,"setup_rt_frame: sig deliver (%s,%d) frame=0x%p sp=%#lx iaoq=%#lx/%#lx rp=%#lx\n" , - current->comm, current->pid, frame, regs->gr[30 ], + current->comm,task_pid (current), frame, regs->gr[30 ], regs->iaoq[0 ], regs->iaoq[1 ], rp);return 1 ;
arch/parisc/kernel/smp.c +3 -2
@@ -680,7 +680,8 @@ int sys_cpus(int argc, char **argv) }#else printk ("\n%s %4d 0 0 --------" , - (current->pid)?"RUNNING " :"IDLING " ,current->pid); + (task_pid (current))?"RUNNING " :"IDLING " , +task_pid (current));#endif }else if ((argc==2 ) && !(strcmp (argv[1 ],"-s" ))) {#ifdef DUMP_MORE_STATE
@@ -705,7 +706,7 @@ int sys_cpus(int argc, char **argv) } }#else -printk ("\n%s CPU0" ,(current->pid==0 )?"RUNNING " :"IDLING " ); +printk ("\n%s CPU0" ,(task_pid (current)==0 )?"RUNNING " :"IDLING " );#endif }else {printk ("sys_cpus:Unknown request\n" );
arch/parisc/kernel/sys_parisc32.c +1 -1
@@ -95,7 +95,7 @@ asmlinkage long sys32_unimplemented(int int r22, int r21, int r20) { printk(KERN_ERR "%s(%d): Unimplemented 32 on 64 syscall #%d!\n", - current->comm, current->pid, r20); + current->comm, task_pid(current), r20);return -ENOSYS ; }
arch/parisc/kernel/traps.c +6 -6
@@ -216,7 +216,7 @@ void die_if_kernel(char *str, struct pt_return ;/* STFU */ printk (KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n" , - current->comm, current->pid, str, err, regs->iaoq[0 ]); + current->comm,task_pid (current), str, err, regs->iaoq[0 ]);#ifdef PRINT_USER_FAULTS /* XXX for debugging only */ show_regs (regs);
@@ -248,7 +248,7 @@ void die_if_kernel(char *str, struct pt_pdc_console_restart ();printk (KERN_CRIT "%s (pid %d): %s (code %ld)\n" , - current->comm, current->pid, str, err); + current->comm,task_pid (current), str, err);show_regs (regs);/* Wot's wrong wif bein' racy? */
@@ -288,7 +288,7 @@ void handle_break(unsigned iir, struct pcase 0x00 :#ifdef PRINT_USER_FAULTS printk (KERN_DEBUG "break 0,0: pid=%d command='%s'\n" , - current->pid, current->comm); +task_pid (current), current->comm);#endif die_if_kernel ("Breakpoint" , regs,0 );#ifdef PRINT_USER_FAULTS
@@ -308,7 +308,7 @@ void handle_break(unsigned iir, struct pdefault :#ifdef PRINT_USER_FAULTS printk (KERN_DEBUG "break %#08x: pid=%d command='%s'\n" , - iir, current->pid, current->comm); + iir,task_pid (current), current->comm);show_regs (regs);#endif si.si_signo =SIGTRAP ;
@@ -746,7 +746,7 @@ void handle_interruption(int code, strucif (user_mode (regs)) {#ifdef PRINT_USER_FAULTS printk (KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n" , - current->pid, current->comm); +task_pid (current), current->comm);show_regs (regs);#endif /* SIGBUS, for lack of a better one. */
@@ -771,7 +771,7 @@ void handle_interruption(int code, struc else printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", code); -printk ("pid=%d command='%s'\n" , current->pid, current->comm); +printk ("pid=%d command='%s'\n" ,task_pid (current), current->comm);show_regs (regs);#endif si.si_signo =SIGSEGV ;
arch/parisc/kernel/unaligned.c +1 -1
@@ -527,7 +527,7 @@ void handle_unaligned(struct pt_regs *re && ++unaligned_count < 5) {char buf[256 ];sprintf (buf,"%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n" , - current->comm, current->pid, regs->ior, regs->iaoq[0 ]); + current->comm,task_pid (current), regs->ior, regs->iaoq[0 ]);printk (KERN_WARNING "%s" , buf);#ifdef DEBUG_UNALIGNED show_regs (regs);
arch/parisc/mm/fault.c +1 -1
@@ -214,7 +214,7 @@ bad_area:#ifdef PRINT_USER_FAULTS printk (KERN_DEBUG "\n" );printk (KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n" , - tsk->pid, tsk->comm, code, address); +task_pid (tsk), tsk->comm, code, address);if (vma) {printk (KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n" , vma->vm_start, vma->vm_end);
arch/ppc/kernel/process.c +3 -3
@@ -112,7 +112,7 @@ int check_stack(struct task_struct *tsk) {printk ("stack out of bounds: %s/%d\n" " tsk_top %08lx ksp %08lx stack_top %08lx\n" , - tsk->comm,tsk->pid, + tsk->comm,task_pid (tsk), tsk_top, tsk->thread.ksp, stack_top); ret |=2 ; }
@@ -122,7 +122,7 @@ int check_stack(struct task_struct *tsk) {printk ("current stack ptr out of bounds: %s/%d\n" " tsk_top %08lx sp %08lx stack_top %08lx\n" , - current->comm,current->pid, + current->comm,task_pid (current), tsk_top,_get_SP (), stack_top); ret |=4 ; }
@@ -384,7 +384,7 @@ void show_regs(struct pt_regs * regs)if (trap ==0x300 || trap ==0x600 )printk ("DAR: %08lX, DSISR: %08lX\n" , regs->dar, regs->dsisr);printk ("TASK = %p[%d] '%s' THREAD: %p\n" , - current, current->pid, current->comm, current->thread_info); + current,task_pid (current), current->comm, current->thread_info);printk ("Last syscall: %ld " , current->thread.last_syscall);#ifdef CONFIG_SMP
arch/ppc/kernel/softemu8xx.c +1 -1
@@ -120,7 +120,7 @@ Soft_emulate_8xx(struct pt_regs *regs) printk("Bad emulation %s/%d\n" " NIP: %08lx instruction: %08x opcode: %x " "A: %x B: %x C: %x code: %x rc: %x\n", - current->comm,current->pid, + current->comm,task_pid(current), regs->nip, instword,inst, (instword>>16)&0x1f,
arch/ppc/kernel/traps.c +2 -2
@@ -131,7 +131,7 @@ void _exception(int signr, struct pt_reg* generate the same exception over and over again and we get * nowhere. Better to kill it and let the kernel panic. */ -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {__sighandler_t handler;spin_lock_irq (¤t->sighand->siglock);
@@ -759,7 +759,7 @@ void nonrecoverable_exception(struct pt_void trace_syscall (struct pt_regs *regs) {printk ("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n" , - current, current->pid, regs->nip, regs->link, regs->gpr[0 ], + current,task_pid (current), regs->nip, regs->link, regs->gpr[0 ], regs->ccr&0x10000000 ?"Error=" :"" , regs->gpr[3 ],print_tainted ()); }
arch/ppc/lib/locks.c +3 -3
@@ -80,7 +80,7 @@ void _raw_spin_unlock(spinlock_t *lp)if ( !lp->lock )printk ("_spin_unlock(%p): no lock cpu %d curr PC %p %s/%d\n" , lp,smp_processor_id (),__builtin_return_address (0 ), - current->comm, current->pid); + current->comm,task_pid (current));if ( lp->owner_cpu !=smp_processor_id () ) printk("_spin_unlock(%p): cpu %d trying clear of cpu %d pc %lx val %lx\n", lp, smp_processor_id(), (int)lp->owner_cpu,
@@ -142,7 +142,7 @@ void _raw_read_unlock(rwlock_t *rw) {if ( rw->lock ==0 )printk ("_read_unlock(): %s/%d (nip %08lX) lock %d\n" , - current->comm,current->pid,current->thread.regs->nip, + current->comm,task_pid (current),current->thread.regs->nip, rw->lock);wmb ();atomic_dec ((atomic_t *) &(rw)->lock);
@@ -180,7 +180,7 @@ void _raw_write_unlock(rwlock_t *rw) {if (rw->lock >=0 )printk ("_write_lock(): %s/%d (nip %08lX) lock %d\n" , - current->comm,current->pid,current->thread.regs->nip, + current->comm,task_pid (current),current->thread.regs->nip, rw->lock);wmb (); rw->lock =0 ;
arch/ppc/mm/fault.c +1 -1
@@ -290,7 +290,7 @@ bad_area:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/ppc/xmon/xmon.c +1 -1
@@ -895,7 +895,7 @@ excprint(struct pt_regs *fp)printf ("dar = %x, dsisr = %x\n" , fp->dar, fp->dsisr);if (current)printf ("current = %x, pid = %d, comm = %s\n" , - current, current->pid, current->comm); + current,task_pid (current), current->comm); }void
arch/s390/kernel/process.c +1 -1
@@ -155,7 +155,7 @@ void show_regs(struct pt_regs *regs)printk ("CPU: %d %s\n" , tsk->thread_info->cpu,print_tainted ());printk ("Process %s (pid: %d, task: %p, ksp: %p)\n" , - current->comm, current->pid, (void *) tsk, + current->comm,task_pid (current), (void *) tsk, (void *) tsk->thread.ksp);show_registers (regs);
arch/s390/math-emu/math.c +1 -1
@@ -108,7 +108,7 @@ static void display_emulation_not_implem location = (__u16 *)(regs->psw.addr-S390_lowcore.pgm_ilc);printk ("%s ieee fpu instruction not emulated " "process name: %s pid: %d \n" , - instr, current->comm, current->pid); + instr, current->comm,task_pid (current));printk ("%s's PSW: %08lx %08lx\n" , instr, (unsigned long ) regs->psw.mask, (unsigned long ) location);
arch/s390/mm/fault.c +1 -1
@@ -316,7 +316,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (tsk->pid ==1 ) { +if (task_pid (tsk) ==1 ) {yield (); goto survive; }
arch/sh/kernel/process.c +1 -1
@@ -105,7 +105,7 @@ void machine_power_off(void)void show_regs (struct pt_regs * regs) {printk ("\n" ); -printk ("Pid : %d, Comm: %20s\n" , current->pid, current->comm); +printk ("Pid : %d, Comm: %20s\n" ,task_pid (current), current->comm);print_symbol ("PC is at %s\n" , regs->pc);printk ("PC : %08lx SP : %08lx SR : %08lx " , regs->pc, regs->regs[15 ], regs->sr);
arch/sh/kernel/signal.c +2 -2
@@ -404,7 +404,7 @@ static void setup_frame(int sig, struct#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n" , - current->comm, current->pid, frame, regs->pc, regs->pr); + current->comm,task_pid (current), frame, regs->pc, regs->pr);#endif flush_cache_sigtramp (regs->pr);
@@ -479,7 +479,7 @@ static void setup_rt_frame(int sig, stru#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n" , - current->comm, current->pid, frame, regs->pc, regs->pr); + current->comm,task_pid (current), frame, regs->pc, regs->pr);#endif flush_cache_sigtramp (regs->pr);
arch/sh/kernel/traps.c +1 -1
@@ -362,7 +362,7 @@ static int handle_unaligned_access(u16 i handle_unaligned_notify_count--;printk ("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n" , - current->comm,current->pid,(u16 *)regs->pc,instruction); + current->comm,task_pid (current),(u16 *)regs->pc,instruction); } ret = -EFAULT ;
arch/sh/mm/fault.c +1 -1
@@ -160,7 +160,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/sh64/kernel/process.c +1 -1
@@ -927,7 +927,7 @@ asids_proc_info(char *buf, char **start,struct task_struct *p;read_lock (&tasklist_lock);for_each_process (p) { -int pid = p->pid; +int pid =task_pid (p);struct mm_struct *mm;if (!pid)continue ; mm = p->mm;
arch/sh64/kernel/signal.c +2 -2
@@ -512,7 +512,7 @@ static void setup_frame(int sig, struct/* Broken %016Lx */ printk ("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n" , signal, - current->comm, current->pid, frame, + current->comm,task_pid (current), frame, regs->pc >>32 , regs->pc &0xffffffff ,DEREF_REG_PR >>32 ,DEREF_REG_PR &0xffffffff );#endif
@@ -618,7 +618,7 @@ static void setup_rt_frame(int sig, stru/* Broken %016Lx */ printk ("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n" , signal, - current->comm, current->pid, frame, + current->comm,task_pid (current), frame, regs->pc >>32 , regs->pc &0xffffffff ,DEREF_REG_PR >>32 ,DEREF_REG_PR &0xffffffff );#endif
arch/sh64/kernel/traps.c +2 -2
@@ -765,7 +765,7 @@ static int misaligned_fixup(struct pt_re --user_mode_unaligned_fixup_count;/* Only do 'count' worth of these reports, to remove a potential DoS against syslog */ printk ("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n" , - current->comm, current->pid, (__u32 )regs->pc, opcode); + current->comm,task_pid (current), (__u32 )regs->pc, opcode); } else#endif if (!user_mode (regs) && (kernel_mode_unaligned_fixup_count >0 )) {
@@ -775,7 +775,7 @@ static int misaligned_fixup(struct pt_re (__u32)regs->pc, opcode); }else {printk ("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n" , - current->comm, current->pid, (__u32 )regs->pc, opcode); + current->comm,task_pid (current), (__u32 )regs->pc, opcode); } }
arch/sh64/lib/dbg.c +6 -6
@@ -173,7 +173,7 @@ void evt_debug(int evt, int ret_addr, inint pid;struct ring_node *rr; - pid = current->pid; + pid =task_pid (current); stack_bottom = (unsigned long ) current->thread_info; asmvolatile ("ori r15, 0, %0" :"=r" (sp)); rr = event_ring + event_ptr;
@@ -209,7 +209,7 @@ void evt_debug(int evt, int ret_addr, in* * Just overwrite old entries on ring overflow - this * is only for last-hope debugging. */ - stored_syscalls[syscall_next].pid = current->pid; + stored_syscalls[syscall_next].pid =task_pid (current); stored_syscalls[syscall_next].syscall_number = syscallno; syscall_next++; syscall_next &= (N_STORED_SYSCALLS -1 );
@@ -230,7 +230,7 @@ static void drain_syscalls(void) {void evt_debug2 (unsigned int ret) {drain_syscalls (); -printk ("Task %d: syscall returns %08x\n" , current->pid, ret); +printk ("Task %d: syscall returns %08x\n" ,task_pid (current), ret); }void evt_debug_ret_from_irq (struct pt_regs *regs)
@@ -238,7 +238,7 @@ void evt_debug_ret_from_irq(struct pt_reint pid;struct ring_node *rr; - pid = current->pid; + pid =task_pid (current); rr = event_ring + event_ptr; rr->evt =0xffff ; rr->ret_addr =0 ;
@@ -254,7 +254,7 @@ void evt_debug_ret_from_exc(struct pt_reint pid;struct ring_node *rr; - pid = current->pid; + pid =task_pid (current); rr = event_ring + event_ptr; rr->evt =0xfffe ; rr->ret_addr =0 ;
@@ -276,7 +276,7 @@ void show_excp_regs(char *from, int trapprintk ("\n" );printk ("EXCEPTION - %s: task %d; Linux trap # %d; signal = %d\n" , - ((from) ? from :"???" ), current->pid, trapnr, signr); + ((from) ? from :"???" ),task_pid (current), trapnr, signr); asmvolatile ("getcon " __EXPEVT", %0" :"=r" (ah)); asmvolatile ("getcon " __EXPEVT", %0" :"=r" (al));
arch/sh64/mm/fault.c +5 -5
@@ -82,7 +82,7 @@ static inline void print_vma(struct vm_astatic inline void print_task (struct task_struct *tsk) { -printk ("Task pid %d\n" , tsk->pid); +printk ("Task pid %d\n" ,task_pid (tsk)); }static pte_t *lookup_pte (struct mm_struct *mm,unsigned long address)
@@ -271,13 +271,13 @@ bad_area:* usermode, so only need a few */ count++;printk ("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n" , - address, current->pid, current->comm, + address,task_pid (current), current->comm, (unsigned long ) regs->pc);#if 0 show_regs (regs);#endif } -if (tsk->pid ==1 ) { +if (task_pid (tsk) ==1 ) {panic ("INIT had user mode bad_area\n" ); } tsk->thread.address = address;
@@ -319,14 +319,14 @@ no_context:* us unable to handle the page fault gracefully. */ out_of_memory: -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {panic ("INIT out of memory\n" );yield (); goto survive; }printk ("fault:Out of memory\n" );up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/sparc/kernel/process.c +1 -1
@@ -554,7 +554,7 @@ int copy_thread(int nr, unsigned long cl#endif /* Set the return value for the child. */ - childregs->u_regs[UREG_I0 ] = current->pid; + childregs->u_regs[UREG_I0 ] =task_pid (current); childregs->u_regs[UREG_I1 ] =1 ;/* Set the return value for the parent. */
arch/sparc/kernel/ptrace.c +4 -4
@@ -155,7 +155,7 @@ static inline void read_sunos_user(struc/* Rest of them are completely unsupported. */ default :printk ("%s [%d]: Wants to read user offset %ld\n" , - current->comm, current->pid, offset); + current->comm,task_pid (current), offset);pt_error_return (regs,EIO );return ; }
@@ -222,7 +222,7 @@ static inline void write_sunos_user(stru/* Rest of them are completely unsupported or "no-touch". */ default :printk ("%s [%d]: Wants to write user offset %ld\n" , - current->comm, current->pid, offset); + current->comm,task_pid (current), offset); goto failure; } success:
@@ -596,7 +596,7 @@ out: asmlinkage void syscall_trace(void) {#ifdef DEBUG_PTRACE -printk ("%s [%d]: syscall_trace\n" , current->comm, current->pid); +printk ("%s [%d]: syscall_trace\n" , current->comm,task_pid (current));#endif if (!test_thread_flag (TIF_SYSCALL_TRACE ))return ;
@@ -612,7 +612,7 @@ asmlinkage void syscall_trace(void)*/ #ifdef DEBUG_PTRACE printk ("%s [%d]: syscall_trace exit= %x\n" , current->comm, - current->pid, current->exit_code); +task_pid (current), current->exit_code);#endif if (current->exit_code) {send_sig (current->exit_code, current,1 );
arch/sparc/kernel/setup.c +1 -1
@@ -85,7 +85,7 @@ void prom_sync_me(void)prom_palette (1 );prom_printf ("PROM SYNC COMMAND...\n" );show_free_areas (); -if (current->pid !=0 ) { +if (task_pid (current) !=0 ) {local_irq_enable ();sys_sync ();local_irq_disable ();
arch/sparc/kernel/sys_sparc.c +1 -1
@@ -353,7 +353,7 @@ c_sys_nis_syscall (struct pt_regs *regs)if (count++ >5 )return -ENOSYS ;printk ("%s[%d]: Unimplemented SPARC system call %d\n" , - current->comm, current->pid, (int )regs->u_regs[1 ]); + current->comm,task_pid (current), (int )regs->u_regs[1 ]);#ifdef DEBUG_UNIMP_SYSCALL show_regs (regs);#endif
arch/sparc/kernel/sys_sunos.c +1 -1
@@ -825,7 +825,7 @@ asmlinkage int sunos_setpgrp(pid_t pid,int ret;/* So stupid... */ -if ((!pid || pid == current->pid) && +if ((!pid || pid ==task_pid (current)) && !pgid) {sys_setsid (); ret =0 ;
arch/sparc/kernel/traps.c +2 -2
@@ -39,7 +39,7 @@ struct trap_trace_entry trapbuf[1024];void syscall_trace_entry (struct pt_regs *regs) { -printk ("%s[%d]: " , current->comm, current->pid); +printk ("%s[%d]: " , current->comm,task_pid (current));printk ("scall<%d> (could be %d)\n" , (int ) regs->u_regs[UREG_G1 ], (int ) regs->u_regs[UREG_I0 ]); }
@@ -100,7 +100,7 @@ void die_if_kernel(char *str, struct pt_" /_| \\__/ |_\\\n" " \\__U_/\n"); -printk ("%s(%d): %s [#%d]\n" , current->comm, current->pid, str, ++die_counter); +printk ("%s(%d): %s [#%d]\n" , current->comm,task_pid (current), str, ++die_counter);show_regs (regs); __SAVE; __SAVE; __SAVE; __SAVE;
arch/sparc/mm/fault.c +3 -3
@@ -318,7 +318,7 @@ bad_area_nosemaphore:if (from_user) {#if 0 printk ("Fault whee %s [%d]: segfaults at %08lx pc=%08lx\n" , - tsk->comm, tsk->pid, address, regs->pc); + tsk->comm,task_pid (tsk), address, regs->pc);#endif info.si_signo =SIGSEGV ; info.si_errno =0 ;
@@ -512,7 +512,7 @@ inline void force_user_fault(unsigned lo#if 0 printk ("wf<pid=%d,wr=%d,addr=%08lx>\n" , - tsk->pid, write, address); +task_pid (tsk), write, address);#endif down_read (&mm->mmap_sem); vma =find_vma (mm, address);
@@ -544,7 +544,7 @@ bad_area:up_read (&mm->mmap_sem);#if 0 printk ("Window whee %s [%d]: segfaults at %08lx\n" , - tsk->comm, tsk->pid, address); + tsk->comm,task_pid (tsk), address);#endif info.si_signo =SIGSEGV ; info.si_errno =0 ;
arch/sparc64/kernel/process.c +1 -1
@@ -669,7 +669,7 @@ int copy_thread(int nr, unsigned long cl }/* Set the return value for the child. */ - t->kregs->u_regs[UREG_I0 ] = current->pid; + t->kregs->u_regs[UREG_I0 ] =task_pid (current); t->kregs->u_regs[UREG_I1 ] =1 ;/* Set the second return value for the parent. */
arch/sparc64/kernel/setup.c +1 -1
@@ -129,7 +129,7 @@ int prom_callback(long *args)if (!strcmp (cmd,"sync" )) {prom_printf ("PROM `%s' command...\n" , cmd);show_free_areas (); -if (current->pid !=0 ) { +if (task_pid (current) !=0 ) {local_irq_enable ();sys_sync ();local_irq_disable ();
arch/sparc64/kernel/sys_sunos32.c +1 -1
@@ -791,7 +791,7 @@ asmlinkage int sunos_setpgrp(pid_t pid,int ret;/* So stupid... */ -if ((!pid || pid == current->pid) && +if ((!pid || pid ==task_pid (current)) && !pgid) {sys_setsid (); ret =0 ;
arch/sparc64/kernel/traps.c +1 -1
@@ -1896,7 +1896,7 @@ void die_if_kernel(char *str, struct pt_" /_| \\__/ |_\\\n" " \\__U_/\n"); -printk ("%s(%d): %s [#%d]\n" , current->comm, current->pid, str, ++die_counter); +printk ("%s(%d): %s [#%d]\n" , current->comm,task_pid (current), str, ++die_counter);notify_die (DIE_OOPS , str, regs,0 ,255 ,SIGSEGV ); __asm__ __volatile__("flushw" );__show_regs (regs);
arch/sparc64/solaris/ioctl.c +2 -2
@@ -548,13 +548,13 @@ static inline int solaris_S(struct filereturn solaris_ioctl (fd, si.cmd, si.data); }case 9 :/* I_SETSIG */ -return sys_ioctl (fd,FIOSETOWN , current->pid); +return sys_ioctl (fd,FIOSETOWN ,task_pid (current));case 10 :/* I_GETSIG */ old_fs =get_fs ();set_fs (KERNEL_DS );sys_ioctl (fd,FIOGETOWN , (unsigned long )&ret);set_fs (old_fs); -if (ret == current->pid)return 0x3ff ; +if (ret ==task_pid (current))return 0x3ff ;else return -EINVAL ;case 11 :/* I_FIND */ {
arch/um/kernel/process_kern.c +2 -2
@@ -180,7 +180,7 @@ unsigned long stack_sp(unsigned long pagint current_pid (void ) { -return (current->pid); +return (task_pid (current)); }void default_idle (void )
@@ -261,7 +261,7 @@ char *current_cmd(void)void force_sigbus (void ) {printk (KERN_ERR "Killing pid %d because of a lack of memory\n" , - current->pid); +task_pid (current));lock_kernel ();sigaddset (¤t->pending.signal,SIGBUS );recalc_sigpending ();
arch/um/kernel/skas/process_kern.c +2 -2
@@ -32,13 +32,13 @@ void switch_to_skas(void *prev, void *ne to = next;/* XXX need to check runqueues[cpu].idle */ -if (current->pid ==0 ) +if (task_pid (current) ==0 )switch_timers (0 );switch_threads (&from->thread.mode.skas.switch_buf, to->thread.mode.skas.switch_buf); -if (current->pid ==0 ) +if (task_pid (current) ==0 )switch_timers (1 ); }
arch/um/kernel/trap_kern.c +1 -1
@@ -107,7 +107,7 @@ out_nosemaphore:* us unable to handle the page fault gracefully. */ out_of_memory: -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {up_read (&mm->mmap_sem);yield ();down_read (&mm->mmap_sem);
arch/um/sys-x86_64/sysrq.c +1 -1
@@ -16,7 +16,7 @@ void __show_regs(struct pt_regs * regs)printk ("\n" );print_modules ();printk ("Pid: %d, comm: %.20s %s %s\n" , - current->pid, current->comm,print_tainted (), system_utsname.release); +task_pid (current), current->comm,print_tainted (), system_utsname.release);printk ("RIP: %04lx:[<%016lx>] " ,PT_REGS_CS (regs) &0xffff ,PT_REGS_RIP (regs)); printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
arch/v850/kernel/bug.c +2 -2
@@ -38,7 +38,7 @@ int bad_trap (int trap_num, struct pt_re {printk (KERN_CRIT "unimplemented trap %d called at 0x%08lx, pid %d!\n" , - trap_num, regs->pc, current->pid); + trap_num, regs->pc,task_pid (current));return -ENOSYS ; }
@@ -50,7 +50,7 @@ void unexpected_reset (unsigned long ret"unexpected reset in %s mode, pid %d" " (ret_addr = 0x%lx, sp = 0x%lx)\n" , kmode ?"kernel" :"user" , - task ? task->pid :-1 , + task ?task_pid (task) :-1 , ret_addr, sp);machine_halt ();
arch/v850/kernel/signal.c +2 -2
@@ -338,7 +338,7 @@ static void setup_frame(int sig, struct#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%08lx ra=%08lx\n" , - current->comm, current->pid, frame, regs->pc, ); + current->comm, task_pid(current), frame, regs->pc, );#endif return ;
@@ -413,7 +413,7 @@ static void setup_rt_frame(int sig, stru#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n" , - current->comm, current->pid, frame, regs->pc, regs->pr); + current->comm,task_pid (current), frame, regs->pc, regs->pr);#endif return ;
arch/x86_64/ia32/ia32_signal.c +2 -2
@@ -515,7 +515,7 @@ int ia32_setup_frame(int sig, struct k_s#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->rip, frame->pretcode); + current->comm,task_pid (current), frame, regs->rip, frame->pretcode);#endif return 1 ;
@@ -615,7 +615,7 @@ int ia32_setup_rt_frame(int sig, struct#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->rip, frame->pretcode); + current->comm,task_pid (current), frame, regs->rip, frame->pretcode);#endif return 1 ;
arch/x86_64/kernel/mce.c +1 -1
@@ -248,7 +248,7 @@ void do_machine_check(struct pt_regs * rbut most likely they occur at boot anyways, where it is best to just halt the machine. */ if ((!user_space && (panic_on_oops || tolerant <2 )) || - (unsigned )current->pid <=1 ) + (unsigned )task_pid (current) <=1 )mce_panic ("Uncorrected machine check" , &panicm, mcestart);/* do_exit takes an awful lot of locks and has as
arch/x86_64/kernel/process.c +1 -1
@@ -269,7 +269,7 @@ void __show_regs(struct pt_regs * regs)printk ("\n" );print_modules ();printk ("Pid: %d, comm: %.20s %s %s %.*s\n" , - current->pid, current->comm,print_tainted (), +task_pid (current), current->comm,print_tainted (), system_utsname.release, (int )strcspn (system_utsname.version," " ), system_utsname.version);
arch/x86_64/kernel/signal.c +5 -5
@@ -165,7 +165,7 @@ asmlinkage long sys_rt_sigreturn(struct goto badframe;#ifdef DEBUG_SIG -printk ("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n" ,current->pid,regs.rip,regs.rsp,frame,eax); +printk ("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n" ,task_pid (current),regs.rip,regs.rsp,frame,eax);#endif if (do_sigaltstack (&frame->uc.uc_stack,NULL , regs->rsp) == -EFAULT )
@@ -297,7 +297,7 @@ static int setup_rt_frame(int sig, struc goto give_sigsegv;#ifdef DEBUG_SIG -printk ("%d old rip %lx old rsp %lx old rax %lx\n" , current->pid,regs->rip,regs->rsp,regs->rax); +printk ("%d old rip %lx old rsp %lx old rax %lx\n" ,task_pid (current),regs->rip,regs->rsp,regs->rax);#endif /* Set up registers for signal handler */
@@ -324,7 +324,7 @@ static int setup_rt_frame(int sig, strucptrace_notify (SIGTRAP );#ifdef DEBUG_SIG printk ("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n" , - current->comm, current->pid, frame, regs->rip, frame->pretcode); + current->comm,task_pid (current), frame, regs->rip, frame->pretcode);#endif return 1 ;
@@ -346,7 +346,7 @@ handle_signal(unsigned long sig, siginfo#ifdef DEBUG_SIG printk ("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n" , - current->pid, sig, +task_pid (current), sig, regs->rip, regs->rsp, regs);#endif
@@ -490,7 +490,7 @@ void signal_fault(struct pt_regs *regs,struct task_struct *me = current;if (exception_trace)printk ("%s[%d] bad frame in %s frame:%p rip:%lx rsp:%lx orax:%lx\n" , - me->comm,me->pid,where,frame,regs->rip,regs->rsp,regs->orig_rax); + me->comm,task_pid (me),where,frame,regs->rip,regs->rsp,regs->orig_rax);force_sig (SIGSEGV , me); }
arch/x86_64/kernel/traps.c +3 -3
@@ -282,7 +282,7 @@ void show_registers(struct pt_regs *regsprintk ("CPU %d " , cpu);__show_regs (regs);printk ("Process %s (pid: %d, threadinfo %p, task %p)\n" , - cur->comm, cur->pid, cur->thread_info, cur); + cur->comm,task_pid (cur), cur->thread_info, cur);/* * When in-kernel, we also print out the stack and code at the
@@ -447,7 +447,7 @@ static void __kprobes do_trap(int trapnrif (exception_trace &&unhandled_signal (tsk, signr))printk (KERN_INFO "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n" , - tsk->comm, tsk->pid, str, + tsk->comm,task_pid (tsk), str, regs->rip,regs->rsp,error_code); tsk->thread.error_code = error_code;
@@ -533,7 +533,7 @@ asmlinkage void __kprobes do_general_proif (exception_trace &&unhandled_signal (tsk,SIGSEGV ))printk (KERN_INFO "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n" , - tsk->comm, tsk->pid, + tsk->comm,task_pid (tsk), regs->rip,regs->rsp,error_code); tsk->thread.error_code = error_code;
arch/x86_64/mm/fault.c +4 -4
@@ -210,7 +210,7 @@ static int is_errata93(struct pt_regs *rint unhandled_signal (struct task_struct *tsk,int sig) { -if (tsk->pid ==1 ) +if (task_pid (tsk) ==1 )return 1 ;if (tsk->ptrace &PT_PTRACED )return 0 ;
@@ -482,8 +482,8 @@ bad_area_nosemaphore:if (exception_trace &&unhandled_signal (tsk,SIGSEGV )) {printk ("%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n" , - tsk->pid >1 ?KERN_INFO :KERN_EMERG , - tsk->comm, tsk->pid, address, regs->rip, +task_pid (tsk) >1 ?KERN_INFO :KERN_EMERG , + tsk->comm,task_pid (tsk), address, regs->rip, regs->rsp, error_code); }
@@ -545,7 +545,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield (); goto again; }
arch/xtensa/kernel/signal.c +2 -2
@@ -570,7 +570,7 @@ static void setup_frame(int sig, struct#if DEBUG_SIG printk ("SIG deliver (%s:%d): signal=%d sp=%p pc=%08x\n" , - current->comm, current->pid, signal, frame, regs->pc); + current->comm,task_pid (current), signal, frame, regs->pc);#endif return ;
@@ -634,7 +634,7 @@ static void setup_rt_frame(int sig, stru#if DEBUG_SIG printk ("SIG rt deliver (%s:%d): signal=%d sp=%p pc=%08x\n" , - current->comm, current->pid, signal, frame, regs->pc); + current->comm,task_pid (current), signal, frame, regs->pc);#endif return ;
arch/xtensa/kernel/syscalls.c +2 -2
@@ -245,7 +245,7 @@ void system_call (struct pt_regs *regs)if (strncmp (sysname,"sys_" ,4 ) ==0 ) sysname = sysname +4 ; -printk ("\017SYSCALL:I:%x:%d:%s %s(" , regs->pc, current->pid, +printk ("\017SYSCALL:I:%x:%d:%s %s(" , regs->pc,task_pid (current), current->comm, sysname);for (i =0 ; i < nargs; i++)printk ((i>0 ) ?", %#lx" :"%#lx" , parms[i]);
@@ -255,7 +255,7 @@ void system_call (struct pt_regs *regs) res =syscall ((void *)parm0, parm1, parm2, parm3, parm4, parm5);#if DEBUG -printk ("\017SYSCALL:O:%d:%s %s(" ,current->pid, current->comm, sysname); +printk ("\017SYSCALL:O:%d:%s %s(" ,task_pid (current), current->comm, sysname);for (i =0 ; i < nargs; i++)printk ((i>0 ) ?", %#lx" :"%#lx" , parms[i]);if (res <4096 )
arch/xtensa/kernel/traps.c +3 -3
@@ -176,7 +176,7 @@ void do_unhandled(struct pt_regs *regs,printk ("Caught unhandled exception in '%s' " "(pid = %d, pc = %#010lx) - should not happen\n" "\tEXCCAUSE is %ld\n" , - current->comm, current->pid, regs->pc, exccause); + current->comm,task_pid (current), regs->pc, exccause);force_sig (SIGILL , current); }
@@ -228,7 +228,7 @@ do_illegal_instruction(struct pt_regs *r/* If in user mode, send SIGILL signal to current process. */ printk ("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n" , - current->comm, current->pid, regs->pc); + current->comm,task_pid (current), regs->pc);force_sig (SIGILL , current); }
@@ -254,7 +254,7 @@ do_unaligned_user (struct pt_regs *regs) current->thread.error_code =-3 ;printk ("Unaligned memory access to %08lx in '%s' " "(pid = %d, pc = %#010lx)\n" , - regs->excvaddr, current->comm, current->pid, regs->pc); + regs->excvaddr, current->comm,task_pid (current), regs->pc); info.si_signo =SIGBUS ; info.si_errno =0 ; info.si_code =BUS_ADRALN ;
arch/xtensa/mm/fault.c +2 -2
@@ -64,7 +64,7 @@ void do_page_fault(struct pt_regs *regs) exccause == XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE) ? 1 : 0;#if 0 -printk ("[%s:%d:%08x:%d:%08x:%s%s]\n" , current->comm, current->pid, +printk ("[%s:%d:%08x:%d:%08x:%s%s]\n" , current->comm,task_pid (current), address, exccause, regs->pc, is_write?"w" :"" , is_exec?"x" :"" );#endif
@@ -144,7 +144,7 @@ bad_area:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/s390/kernel/asm-offsets.c +1 -1
@@ -22,7 +22,7 @@ int main(void)DEFINE (__THREAD_mm_segment, offsetof(struct task_struct, thread.mm_segment),);BLANK (); - DEFINE(__TASK_pid, offsetof(struct task_struct, pid),); + DEFINE(__TASK_pid, offsetof(struct task_struct, __pid),);BLANK (); DEFINE(__PER_atmid, offsetof(per_struct, lowcore.words.perc_atmid),); DEFINE(__PER_address, offsetof(per_struct, lowcore.words.address),);
drivers/s390/crypto/z90main.c +1 -1
@@ -942,7 +942,7 @@ init_work_element(struct work_element *w step =atomic_inc_return (&z90crypt_step);memcpy (we_p->caller_id+0 , (void *) &pid,sizeof (pid));memcpy (we_p->caller_id+4 , (void *) &step,sizeof (step)); -we_task_pid (p) = pid; + we_p->pid = pid; we_p->priv_data = priv_data; we_p->status[0 ] =STAT_DEFAULT ; we_p->audit[0 ] =0x00 ;
arch/x86_64/ia32/ptrace32.c +1 -1
@@ -212,7 +212,7 @@ static struct task_struct *find_target(iread_unlock (&tasklist_lock);if (child) { *err = -EPERM ; -if (child->pid ==1 ) +if (task_pid (child) ==1 ) goto out; *err =ptrace_check_attach (child, request ==PTRACE_KILL );if (*err <0 )
arch/x86_64/kernel/asm-offsets.c +1 -1
@@ -26,7 +26,7 @@ int main(void)ENTRY (state);ENTRY (flags);ENTRY (thread); -ENTRY (pid); +ENTRY (__pid);BLANK ();#undef ENTRY#define ENTRY (entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
arch/powerpc/mm/fault.c +1 -1
@@ -350,7 +350,7 @@ bad_area_nosemaphore:*/ out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/powerpc/xmon/xmon.c +1 -1
@@ -1368,7 +1368,7 @@ void excprint(struct pt_regs *fp)#endif if (current) {printf (" pid = %ld, comm = %s\n" , - current->pid, current->comm); +task_pid (current), current->comm); }if (trap ==0x700 )
arch/powerpc/kernel/traps.c +2 -2
@@ -195,7 +195,7 @@ void _exception(int signr, struct pt_reg* generate the same exception over and over again and we get * nowhere. Better to kill it and let the kernel panic. */ -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {__sighandler_t handler;spin_lock_irq (¤t->sighand->siglock);
@@ -860,7 +860,7 @@ void nonrecoverable_exception(struct pt_void trace_syscall (struct pt_regs *regs) {printk ("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n" , - current, current->pid, regs->nip, regs->link, regs->gpr[0 ], + current,task_pid (current), regs->nip, regs->link, regs->gpr[0 ], regs->ccr&0x10000000 ?"Error=" :"" , regs->gpr[3 ],print_tainted ()); }
arch/powerpc/platforms/pseries/ras.c +2 -2
@@ -313,10 +313,10 @@ static int recover_mce(struct pt_regs *r err->disposition == RTAS_DISP_NOT_RECOVERED && err->target == RTAS_TARGET_MEMORY && err->type == RTAS_TYPE_ECC_UNCORR && - !(current->pid == 0 || current->pid == 1)) { + !(task_pid(current) == 0 || task_pid(current) == 1)) {/* Kill off a user process with an ECC error */ printk (KERN_ERR "MCE: uncorrectable ecc error for pid %d\n" , - current->pid); +task_pid (current));/* XXX something better for ECC error? */ _exception (SIGBUS , regs,BUS_ADRERR , regs->nip); nonfatal =1 ;
arch/powerpc/kernel/process.c +1 -1
@@ -402,7 +402,7 @@ void show_regs(struct pt_regs * regs)if (trap ==0x300 || trap ==0x600 )printk ("DAR: " REG ", DSISR: " REG "\n" , regs->dar, regs->dsisr);printk ("TASK = %p[%d] '%s' THREAD: %p" , - current, current->pid, current->comm, current->thread_info); + current,task_pid (current), current->comm, current->thread_info);#ifdef CONFIG_SMP printk (" CPU: %d" ,smp_processor_id ());
--
RFC PATCH 3/13 Change pid accesses: filesystems.
In reply to Serge E. HallynReplace-Subject: Change pid accesses: filesystems.
From: Serge Hallyn <[email protected]>
Change pid accesses for filesystems.
--- fs/9p/debug.h | 4 ++-- fs/9p/fid.c | 5 +++-- fs/afs/cmservice.c | 2 +- fs/afs/kafsasyncd.c | 2 +- fs/afs/kafstimod.c | 2 +- fs/autofs/root.c | 2 +- fs/autofs4/autofs_i.h | 2 +- fs/autofs4/root.c | 2 +- fs/binfmt_elf.c | 8 ++++---- fs/binfmt_elf_fdpic.c | 2 +- fs/binfmt_flat.c | 2 +- fs/cifs/cifssmb.c | 2 +- fs/cifs/connect.c | 2 +- fs/cifs/dir.c | 2 +- fs/cifs/file.c | 4 ++-- fs/cifs/misc.c | 4 ++-- fs/cifs/transport.c | 2 +- fs/coda/upcall.c | 2 +- fs/compat.c | 2 +- fs/devfs/base.c | 2 +- fs/dnotify.c | 2 +- fs/exec.c | 8 ++++---- fs/ext2/inode.c | 2 +- fs/ext3/inode.c | 2 +- fs/fs-writeback.c | 2 +- fs/fuse/dev.c | 2 +- fs/jffs2/background.c | 2 +- fs/jffs2/debug.h | 8 ++++---- fs/lockd/clntproc.c | 2 +- fs/lockd/svc.c | 6 +++--- fs/locks.c | 16 ++++++++-------- fs/nfs/callback.c | 2 +- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfsd/nfs4state.c | 8 ++++---- fs/nfsd/vfs.c | 6 +++--- fs/proc/array.c | 12 +++++++----- fs/proc/base.c | 16 ++++++++-------- fs/smbfs/proc.c | 4 ++-- fs/smbfs/smbiod.c | 4 ++-- fs/xfs/linux-2.6/xfs_buf.c | 2 +- fs/xfs/linux-2.6/xfs_linux.h | 2 +- fs/xfs/support/debug.c | 2 +- 43 files changed, 86 insertions(+), 83 deletions(-)
fs/9p/debug.h +2 -2
@@ -39,13 +39,13 @@ extern int v9fs_debug_level;do { \if ((v9fs_debug_level & level)==level) \printk (KERN_NOTICE "-- %s (%d): " \ - format , __FUNCTION__, current->pid , ## arg); \ + format , __FUNCTION__, task_pid(current) , ## arg); \ } while(0) #define eprintk(level, format, arg...) \ do { \ printk(level "v9fs: %s (%d): " \ - format , __FUNCTION__, current->pid , ## arg); \ + format , __FUNCTION__, task_pid(current) , ## arg); \ } while(0)#if DEBUG_DUMP_PKT
fs/9p/fid.c +3 -2
@@ -60,7 +60,7 @@ static int v9fs_fid_insert(struct v9fs_f } fid->uid = current->uid; - fid->pid = current->pid; + fid->pid =task_pid (current);list_add (&fid->list, fid_list);return 0 ; }
@@ -242,7 +242,8 @@ struct v9fs_fid *v9fs_fid_get_created(st ret =NULL ;if (fid_list) {list_for_each_entry_safe (fid, ftmp, fid_list, list) { -if (fid->fidcreate && fid->pid == current->pid) { +if (fid->fidcreate && fid->pid == +task_pid (current)) {list_del (&fid->list); ret = fid;break ;
fs/afs/cmservice.c +1 -1
@@ -118,7 +118,7 @@ static int kafscmd(void *arg)_SRXAFSCM_xxxx_t func;int die; -printk ("kAFS: Started kafscmd %d\n" , current->pid); +printk ("kAFS: Started kafscmd %d\n" ,task_pid (current));daemonize ("kafscmd" );
fs/afs/kafsasyncd.c +1 -1
@@ -92,7 +92,7 @@ static int kafsasyncd(void *arg) kafsasyncd_task = current; -printk ("kAFS: Started kafsasyncd %d\n" , current->pid); +printk ("kAFS: Started kafsasyncd %d\n" ,task_pid (current));daemonize ("kafsasyncd" );
fs/afs/kafstimod.c +1 -1
@@ -69,7 +69,7 @@ static int kafstimod(void *arg)DECLARE_WAITQUEUE (myself, current); -printk ("kAFS: Started kafstimod %d\n" , current->pid); +printk ("kAFS: Started kafstimod %d\n" ,task_pid (current));daemonize ("kafstimod" );
fs/autofs/root.c +1 -1
@@ -213,7 +213,7 @@ static struct dentry *autofs_root_lookup oz_mode =autofs_oz_mode (sbi);DPRINTK (("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n" , - current->pid,process_group (current), sbi->catatonic, oz_mode)); +task_pid (current),process_group (current), sbi->catatonic, oz_mode));/* * Mark the dentry incomplete, but add it. This is needed so
fs/autofs4/autofs_i.h +1 -1
@@ -33,7 +33,7 @@/* #define DEBUG */ #ifdef DEBUG -#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , current->pid , __FUNCTION__ , ##args); } while(0) +#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , task_pid(current) , __FUNCTION__ , ##args); } while(0)#else #define DPRINTK(fmt,args...) do {} while(0)#endif
fs/autofs4/root.c +1 -1
@@ -465,7 +465,7 @@ static struct dentry *autofs4_lookup(str oz_mode =autofs4_oz_mode (sbi);DPRINTK ("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d" , - current->pid,process_group (current), sbi->catatonic, oz_mode); +task_pid (current),process_group (current), sbi->catatonic, oz_mode);/* * Mark the dentry incomplete, but add it. This is needed so
fs/binfmt_elf.c +4 -4
@@ -1270,8 +1270,8 @@ static void fill_prstatus(struct elf_prs prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; prstatus->pr_sigpend = p->pending.signal.sig[0 ]; prstatus->pr_sighold = p->blocked.sig[0 ]; - prstatus->pr_pid = p->pid; - prstatus->pr_ppid = p->parent->pid; + prstatus->pr_pid =task_pid (p); + prstatus->pr_ppid =task_pid (p->parent); prstatus->pr_pgrp =process_group (p); prstatus->pr_sid = p->signal->session;if (thread_group_leader (p)) {
@@ -1316,8 +1316,8 @@ static int fill_psinfo(struct elf_prpsin psinfo->pr_psargs[i] =' ' ; psinfo->pr_psargs[len] =0 ; - psinfo->pr_pid = p->pid; - psinfo->pr_ppid = p->parent->pid; + psinfo->pr_pid =task_pid (p); + psinfo->pr_ppid =task_pid (p->parent); psinfo->pr_pgrp =process_group (p); psinfo->pr_sid = p->signal->session;
fs/binfmt_elf_fdpic.c +1 -1
@@ -479,7 +479,7 @@ static int create_elf_fdpic_tables(struc* removed for 2.5 */ if (smp_num_siblings >1 ) - sp = sp - ((current->pid %64 ) <<7 ); + sp = sp - ((task_pid (current) %64 ) <<7 );#endif sp &= ~7UL ;
fs/binfmt_flat.c +1 -1
@@ -95,7 +95,7 @@ static struct linux_binfmt flat_format =static int flat_core_dump (long signr,struct pt_regs * regs,struct file *file) {printk ("Process %s:%d received signr %d and should have core dumped\n" , - current->comm, current->pid, (int ) signr); + current->comm,task_pid (current), (int ) signr);return (1 ); }
fs/cifs/cifssmb.c +1 -1
@@ -1247,7 +1247,7 @@ CIFSSMBLock(const int xid, struct cifsTc pSMB->Fid = smb_file_id;/* netfid stays le */ if ((numLock !=0 ) || (numUnlock !=0 )) { - pSMB->Locks[0 ].Pid =cpu_to_le16 (current->tgid); + pSMB->Locks[0 ].Pid =cpu_to_le16 (task_tgid (current));/* BB where to store pid high? */ pSMB->Locks[0 ].LengthLow =cpu_to_le32 ((u32 )len); pSMB->Locks[0 ].LengthHigh =cpu_to_le32 ((u32)(len>>32 ));
fs/cifs/connect.c +1 -1
@@ -345,7 +345,7 @@ cifs_demultiplex_thread(struct TCP_Serveallow_signal (SIGKILL ); current->flags |=PF_MEMALLOC ; server->tsk = current;/* save process info to wake at shutdown */ -cFYI (1 , ("Demultiplex PID: %d" , current->pid)); +cFYI (1 , ("Demultiplex PID: %d" ,task_pid (current)));write_lock (&GlobalSMBSeslock);atomic_inc (&tcpSesAllocCount); length = tcpSesAllocCount.counter;
fs/cifs/dir.c +1 -1
@@ -255,7 +255,7 @@ cifs_create(struct inode *inode, structmemset ((char *)pCifsFile,0 ,sizeof (struct cifsFileInfo )); pCifsFile->netfid = fileHandle; - pCifsFile->pid = current->tgid; + pCifsFile->pid =task_tgid (current); pCifsFile->pInode = newinode; pCifsFile->invalidHandle = FALSE; pCifsFile->closePend = FALSE;
fs/cifs/file.c +2 -2
@@ -45,7 +45,7 @@ static inline struct cifsFileInfo *cifs_ {memset (private_data,0 ,sizeof (struct cifsFileInfo )); private_data->netfid = netfid; - private_data->pid = current->tgid; + private_data->pid =task_tgid (current);init_MUTEX (&private_data->fh_sem); private_data->pfile = file;/* needed for writepage */ private_data->pInode = inode;
@@ -182,7 +182,7 @@ int cifs_open(struct inode *inode, struc pCifsFile = list_entry(tmp, struct cifsFileInfo, flist);if ((pCifsFile->pfile ==NULL ) && - (pCifsFile->pid == current->tgid)) { + (pCifsFile->pid ==task_tgid (current))) {/* mode set in cifs_create */ /* needed for writepage */
fs/cifs/misc.c +2 -2
@@ -308,8 +308,8 @@ header_assemble(struct smb_hdr *buffer, buffer->Command = smb_command; buffer->Flags =0x00 ;/* case sensitive */ buffer->Flags2 =SMBFLG2_KNOWS_LONG_NAMES ; - buffer->Pid =cpu_to_le16 ((__u16 )current->tgid); - buffer->PidHigh =cpu_to_le16 ((__u16)(current->tgid >>16 )); + buffer->Pid =cpu_to_le16 ((__u16 )task_tgid (current)); + buffer->PidHigh =cpu_to_le16 ((__u16)(task_tgid (current) >>16 ));spin_lock (&GlobalMid_Lock);spin_unlock (&GlobalMid_Lock);if (treeCon) {
fs/cifs/transport.c +1 -1
@@ -56,7 +56,7 @@ AllocMidQEntry(struct smb_hdr *smb_buffeelse {memset (temp,0 ,sizeof (struct mid_q_entry )); temp->mid = smb_buffer->Mid;/* always LE */ - temp->pid = current->pid; + temp->pid =task_pid (current); temp->command = smb_buffer->Command;cFYI (1 , ("For smb_command %d" , temp->command));/* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
fs/coda/upcall.c +1 -1
@@ -52,7 +52,7 @@ static void *alloc_upcall(int opcode, inreturn ERR_PTR (-ENOMEM ); inp->ih.opcode = opcode; - inp->ih.pid = current->pid; + inp->ih.pid =task_pid (current); inp->ih.pgid =process_group (current);#ifdef CONFIG_CODA_FS_OLD_API memset (&inp->ih.cred,0 ,sizeof (struct coda_cred ));
fs/compat.c +1 -1
@@ -332,7 +332,7 @@ static void compat_ioctl_error(struct fisprintf (buf,"%02x" , buf[1 ]);printk ("ioctl32(%s:%d): Unknown cmd fd(%d) " "cmd(%08x){%s} arg(%08x) on %s\n" , - current->comm, current->pid, + current->comm,task_pid (current), (int )fd, (unsigned int )cmd, buf, (unsigned int )arg, fn);
fs/devfs/base.c +1 -1
@@ -2695,7 +2695,7 @@ static int devfsd_ioctl(struct inode *inspin_unlock (&lock); fs_info->devfsd_pgrp = (process_group (current) == - current->pid) ?process_group (current) :0 ; +task_pid (current)) ?process_group (current) :0 ; fs_info->devfsd_file = file; fs_info->devfsd_info =kmalloc (sizeof *fs_info->devfsd_info,GFP_KERNEL );
fs/dnotify.c +1 -1
@@ -92,7 +92,7 @@ int fcntl_dirnotify(int fd, struct file prev = &odn->dn_next; } - error =f_setown (filp, current->pid,0 ); + error =f_setown (filp,task_pid (current),0 );if (error) goto out_free;
fs/exec.c +4 -4
@@ -685,8 +685,8 @@ static inline int de_thread(struct task_ proc_dentry2 =proc_pid_unhash (leader);write_lock_irq (&tasklist_lock); -BUG_ON (leader->tgid != current->tgid); -BUG_ON (current->pid == current->tgid); +BUG_ON (task_tgid (leader) !=task_tgid (current)); +BUG_ON (task_pid (current) ==task_tgid (current));/* * An exec() starts a new thread group with the * TGID of the previous thread group. Rehash the
@@ -1292,7 +1292,7 @@ static void format_corename(char *corenacase 'p' : pid_in_pattern =1 ; rc =snprintf (out_ptr, out_end - out_ptr, -"%d" , current->tgid); +"%d" ,task_tgid (current));if (rc > out_end - out_ptr) goto out; out_ptr += rc;
@@ -1364,7 +1364,7 @@ static void format_corename(char *corenaif (!pid_in_pattern && (core_uses_pid ||atomic_read (¤t->mm->mm_users) !=1 )) { rc =snprintf (out_ptr, out_end - out_ptr, -".%d" , current->tgid); +".%d" ,task_tgid (current));if (rc > out_end - out_ptr) goto out; out_ptr += rc;
fs/ext2/inode.c +1 -1
@@ -344,7 +344,7 @@ static unsigned long ext2_find_near(stru*/ bg_start = (ei->i_block_group *EXT2_BLOCKS_PER_GROUP (inode->i_sb)) +le32_to_cpu (EXT2_SB (inode->i_sb)->s_es->s_first_data_block); - colour = (current->pid %16 ) * + colour = (task_pid (current) %16 ) * (EXT2_BLOCKS_PER_GROUP (inode->i_sb) /16 );return bg_start + colour; }
fs/ext3/inode.c +1 -1
@@ -443,7 +443,7 @@ static unsigned long ext3_find_near(stru*/ bg_start = (ei->i_block_group *EXT3_BLOCKS_PER_GROUP (inode->i_sb)) +le32_to_cpu (EXT3_SB (inode->i_sb)->s_es->s_first_data_block); - colour = (current->pid %16 ) * + colour = (task_pid (current) %16 ) * (EXT3_BLOCKS_PER_GROUP (inode->i_sb) /16 );return bg_start + colour; }
fs/fs-writeback.c +1 -1
@@ -89,7 +89,7 @@ void __mark_inode_dirty(struct inode *inif (inode->i_ino ||strcmp (inode->i_sb->s_id,"bdev" ))printk (KERN_DEBUG "%s(%d): dirtied inode %lu (%s) on %s\n" , - current->comm, current->pid, inode->i_ino, + current->comm,task_pid (current), inode->i_ino, name, inode->i_sb->s_id); }
fs/fuse/dev.c +1 -1
@@ -99,7 +99,7 @@ static struct fuse_req *do_get_request(s req->preallocated =1 ; req->in.h.uid = current->fsuid; req->in.h.gid = current->fsgid; - req->in.h.pid = current->pid; + req->in.h.pid =task_pid (current);return req; }
fs/jffs2/background.c +1 -1
@@ -60,7 +60,7 @@ void jffs2_stop_garbage_collect_thread(sint wait =0 ;spin_lock (&c->erase_completion_lock);if (c->gc_task) { -D1 (printk (KERN_DEBUG "jffs2: Killing GC task %d\n" , c->gc_task->pid)); +D1 (printk (KERN_DEBUG "jffs2: Killing GC task %d\n" , c->gc_task_pid (task)));send_sig (SIGKILL , c->gc_task,1 ); wait =1 ; }
fs/lockd/clntproc.c +1 -1
@@ -130,7 +130,7 @@ static void nlmclnt_setlockargs(struct n lock->caller = system_utsname.nodename; lock->oh.data = req->a_owner; lock->oh.len =sprintf (req->a_owner,"%d@%s" , - current->pid, system_utsname.nodename); +task_pid (current), system_utsname.nodename);locks_copy_lock (&lock->fl, fl); }
fs/lockd/svc.c +3 -3
@@ -111,7 +111,7 @@ lockd(struct svc_rqst *rqstp)/* * Let our maker know we're running. */ - nlmsvc_pid = current->pid; + nlmsvc_pid =task_pid (current);up (&lockd_start);daemonize ("lockd" );
@@ -135,7 +135,7 @@ lockd(struct svc_rqst *rqstp)* NFS mount or NFS daemon has gone away, and we've been sent a * signal, or else another process has taken over our job. */ -while ((nlmsvc_users || !signalled ()) && nlmsvc_pid == current->pid) { +while ((nlmsvc_users || !signalled ()) && nlmsvc_pid ==task_pid (current)) {long timeout =MAX_SCHEDULE_TIMEOUT ;if (signalled ()) {
@@ -182,7 +182,7 @@ lockd(struct svc_rqst *rqstp)* Check whether there's a new lockd process before * shutting down the hosts and clearing the slot. */ -if (!nlmsvc_pid || current->pid == nlmsvc_pid) { +if (!nlmsvc_pid ||task_pid (current) == nlmsvc_pid) {if (nlmsvc_ops)nlmsvc_invalidate_all ();nlm_shutdown_hosts ();
fs/locks.c +8 -8
@@ -268,7 +268,7 @@ static int flock_make_lock(struct file *return -ENOMEM ; fl->fl_file = filp; - fl->fl_pid = current->tgid; + fl->fl_pid =task_tgid (current); fl->fl_flags =FL_FLOCK ; fl->fl_type = type; fl->fl_end =OFFSET_MAX ;
@@ -334,7 +334,7 @@ static int flock_to_posix_lock(struct fireturn -EOVERFLOW ; fl->fl_owner = current->files; - fl->fl_pid = current->tgid; + fl->fl_pid =task_tgid (current); fl->fl_file = filp; fl->fl_flags =FL_POSIX ; fl->fl_ops =NULL ;
@@ -380,7 +380,7 @@ static int flock64_to_posix_lock(structreturn -EOVERFLOW ; fl->fl_owner = current->files; - fl->fl_pid = current->tgid; + fl->fl_pid =task_tgid (current); fl->fl_file = filp; fl->fl_flags =FL_POSIX ; fl->fl_ops =NULL ;
@@ -433,7 +433,7 @@ static struct lock_manager_operations lestatic int lease_init (struct file *filp,int type,struct file_lock *fl) { fl->fl_owner = current->files; - fl->fl_pid = current->tgid; + fl->fl_pid =task_tgid (current); fl->fl_file = filp; fl->fl_flags =FL_LEASE ;
@@ -1043,7 +1043,7 @@ int locks_mandatory_area(int read_write,locks_init_lock (&fl); fl.fl_owner = current->files; - fl.fl_pid = current->tgid; + fl.fl_pid =task_tgid (current); fl.fl_file = filp; fl.fl_flags =FL_POSIX |FL_ACCESS ;if (filp && !(filp->f_flags &O_NONBLOCK ))
@@ -1442,7 +1442,7 @@ int fcntl_setlease(unsigned int fd, stru goto out_unlock; } - error =f_setown (filp, current->pid,0 ); + error =f_setown (filp,task_pid (current),0 ); out_unlock:unlock_kernel ();return error;
@@ -1861,7 +1861,7 @@ void locks_remove_posix(struct file *fil lock.fl_start =0 ; lock.fl_end =OFFSET_MAX ; lock.fl_owner = owner; - lock.fl_pid = current->tgid; + lock.fl_pid =task_tgid (current); lock.fl_file = filp; lock.fl_ops =NULL ; lock.fl_lmops =NULL ;
@@ -1905,7 +1905,7 @@ void locks_remove_flock(struct file *filif (filp->f_op && filp->f_op->flock) {struct file_lock fl = { - .fl_pid = current->tgid, + .fl_pid =task_tgid (current), .fl_file = filp, .fl_flags =FL_FLOCK , .fl_type =F_UNLCK ,
fs/nfs/callback.c +1 -1
@@ -44,7 +44,7 @@ static void nfs_callback_svc(struct svc___module_get (THIS_MODULE );lock_kernel (); - nfs_callback_info.pid = current->pid; + nfs_callback_info.pid =task_pid (current);daemonize ("nfsv4-svc" );/* Process request with signals blocked, but allow SIGKILL. */ allow_signal (SIGKILL );
fs/nfs/nfs3proc.c +1 -1
@@ -323,7 +323,7 @@ nfs3_proc_create(struct inode *dir, struif (flags &O_EXCL ) { arg.createmode =NFS3_CREATE_EXCLUSIVE ; arg.verifier[0 ] = jiffies; - arg.verifier[1 ] = current->pid; + arg.verifier[1 ] =task_pid (current); } sattr->ia_mode &= ~current->fs->umask;
fs/nfs/nfs4proc.c +1 -1
@@ -724,7 +724,7 @@ static int _nfs4_do_open(struct inode *dif (flags &O_EXCL ) {u32 *p = (u32 *) o_arg.u.verifier.data; p[0 ] = jiffies; - p[1 ] = current->pid; + p[1 ] =task_pid (current); }else o_arg.u.attrs = sattr;/* Serialization for the sequence id */
fs/nfsd/nfs4state.c +4 -4
@@ -1740,7 +1740,7 @@ nfs4_open_delegation(struct svc_fh *fh, fl.fl_end =OFFSET_MAX ; fl.fl_owner = (fl_owner_t )dp; fl.fl_file = stp->st_vfs_file; - fl.fl_pid = current->tgid; + fl.fl_pid =task_tgid (current);/* setlease checks to see if delegation should be handed out. * the lock_manager callbacks fl_mylease and fl_change are used
@@ -2784,7 +2784,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc goto out; } file_lock.fl_owner = (fl_owner_t )lock_sop; - file_lock.fl_pid = current->tgid; + file_lock.fl_pid =task_tgid (current); file_lock.fl_file = filp; file_lock.fl_flags =FL_POSIX ;
@@ -2903,7 +2903,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru &lockt->lt_clientid, &lockt->lt_owner);if (lockt->lt_stateowner) file_lock.fl_owner = (fl_owner_t )lockt->lt_stateowner; - file_lock.fl_pid = current->tgid; + file_lock.fl_pid =task_tgid (current); file_lock.fl_flags =FL_POSIX ; file_lock.fl_start = lockt->lt_offset;
@@ -2962,7 +2962,7 @@ nfsd4_locku(struct svc_rqst *rqstp, strulocks_init_lock (&file_lock); file_lock.fl_type =F_UNLCK ; file_lock.fl_owner = (fl_owner_t ) locku->lu_stateowner; - file_lock.fl_pid = current->tgid; + file_lock.fl_pid =task_tgid (current); file_lock.fl_file = filp; file_lock.fl_flags =FL_POSIX ; file_lock.fl_start = locku->lu_offset;
fs/nfsd/vfs.c +3 -3
@@ -955,13 +955,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, sif (EX_WGATHER (exp)) {if (atomic_read (&inode->i_writecount) >1 || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { -dprintk ("nfsd: write defer %d\n" , current->pid); +dprintk ("nfsd: write defer %d\n" ,task_pid (current));msleep (10 ); -dprintk ("nfsd: write resume %d\n" , current->pid); +dprintk ("nfsd: write resume %d\n" ,task_pid (current)); }if (inode->i_state &I_DIRTY ) { -dprintk ("nfsd: write sync %d\n" , current->pid); +dprintk ("nfsd: write sync %d\n" ,task_pid (current));nfsd_sync (file); }#if 0
fs/proc/array.c +7 -5
@@ -174,9 +174,10 @@ static inline char * task_state(struct t"Gid:\t%d\t%d\t%d\t%d\n" ,get_task_state (p), (p->sleep_avg/1024 )*100 /(1020000000 /1024 ), - p->tgid, - p->pid,pid_alive (p) ? p->group_leader->real_parent->tgid :0 , -pid_alive (p) && p->ptrace ? p->parent->pid :0 , +task_tgid (p), +task_pid (p),pid_alive (p) ? +task_tgid (p->group_leader->real_parent) :0 , +pid_alive (p) && p->ptrace ?task_pid (p->parent) :0 , p->uid, p->euid, p->suid, p->fsuid, p->gid, p->egid, p->sgid, p->fsgid);read_unlock (&tasklist_lock);
@@ -388,7 +389,8 @@ static int do_task_stat(struct task_stru } it_real_value = task->signal->it_real_value; } - ppid =pid_alive (task) ? task->group_leader->real_parent->tgid :0 ; + ppid =pid_alive (task) ? +task_tgid (task->group_leader->real_parent) :0 ;read_unlock (&tasklist_lock);if (!whole || num_threads<2 )
@@ -415,7 +417,7 @@ static int do_task_stat(struct task_stru res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %ld %llu %lu %ld %lu %lu %lu %lu %lu \ %lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n", - task->pid, + task_pid(task), tcomm, state, ppid,
fs/proc/base.c +8 -8
@@ -1160,7 +1160,7 @@ static int proc_readfd(struct file * filif (!pid_alive (p)) goto out; retval =0 ; - tid = p->pid; + tid =task_pid (p); fd = filp->f_pos;switch (fd) {
@@ -1227,7 +1227,7 @@ static int proc_pident_readdir(struct fi goto out; ret =0 ; - pid =proc_task (inode)->pid; + pid =task_pid (proc_task (inode)); i = filp->f_pos;switch (i) {case 0 :
@@ -1312,7 +1312,7 @@ static struct inode *proc_pid_make_inode ei =PROC_I (inode); ei->task =NULL ; inode->i_mtime = inode->i_atime = inode->i_ctime =CURRENT_TIME ; - inode->i_ino =fake_ino (task->pid, ino); + inode->i_ino =fake_ino (task_pid (task), ino);if (!pid_alive (task)) goto out_unlock;
@@ -1878,14 +1878,14 @@ static int proc_self_readlink(struct den int buflen) {char tmp[30 ]; -sprintf (tmp,"%d" , current->tgid); +sprintf (tmp,"%d" ,task_tgid (current));return vfs_readlink (dentry,buffer,buflen,tmp); }static void *proc_self_follow_link (struct dentry *dentry,struct nameidata *nd) {char tmp[30 ]; -sprintf (tmp,"%d" , current->tgid); +sprintf (tmp,"%d" ,task_tgid (current));return ERR_PTR (vfs_follow_link (nd,tmp)); }
@@ -2042,7 +2042,7 @@ static struct dentry *proc_task_lookup(sread_unlock (&tasklist_lock);if (!task) goto out; -if (leader->tgid != task->tgid) +if (task_tgid (leader) !=task_tgid (task)) goto out_drop_task; inode =proc_pid_make_inode (dir->i_sb, task,PROC_TID_INO );
@@ -2100,7 +2100,7 @@ static int get_tgid_list(int index, unsi p =next_task (&init_task);for ( ; p != &init_task; p =next_task (p)) { -int tgid = p->pid; +int tgid =task_pid (p);if (!pid_alive (p))continue ;if (--index >=0 )
@@ -2133,7 +2133,7 @@ static int get_tid_list(int index, unsig* via next_thread(). */ if (pid_alive(task)) do { - int tid = task->pid; + int tid = task_pid(task); if (--index >= 0) continue;
fs/smbfs/proc.c +2 -2
@@ -852,7 +852,7 @@ smb_newconn(struct smb_sb_info *server,struct sock *sk;int error; -VERBOSE ("fd=%d, pid=%d\n" , opt->fd, current->pid); +VERBOSE ("fd=%d, pid=%d\n" , opt->fd,task_pid (current));smb_lock_server (server);
@@ -876,7 +876,7 @@ smb_newconn(struct smb_sb_info *server, goto out_putf; server->sock_file = filp; - server->conn_pid = current->pid; + server->conn_pid =task_pid (current); server->opt = *opt; server->generation +=1 ; server->state =CONN_VALID ;
fs/smbfs/smbiod.c +2 -2
@@ -294,7 +294,7 @@ static int smbiod(void *unused)allow_signal (SIGKILL ); -VERBOSE ("SMB Kernel thread starting (%d) ...\n" , current->pid); +VERBOSE ("SMB Kernel thread starting (%d) ...\n" ,task_pid (current));for (;;) {struct smb_sb_info *server;
@@ -336,6 +336,6 @@ static int smbiod(void *unused)spin_unlock (&servers_lock); } -VERBOSE ("SMB Kernel thread exiting (%d) ...\n" , current->pid); +VERBOSE ("SMB Kernel thread exiting (%d) ...\n" ,task_pid (current));module_put_and_exit (0 ); }
fs/xfs/linux-2.6/xfs_buf.c +1 -1
@@ -68,7 +68,7 @@ ktrace_t *pagebuf_trace_buf;#endif #ifdef PAGEBUF_LOCK_TRACKING -# define PB_SET_OWNER (pb) ((pb)->pb_last_holder = current->pid) +# define PB_SET_OWNER (pb) ((pb)->pb_last_holder = task_pid(current))# define PB_CLEAR_OWNER (pb) ((pb)->pb_last_holder = -1)# define PB_GET_OWNER (pb) ((pb)->pb_last_holder)#else
fs/xfs/linux-2.6/xfs_linux.h +1 -1
@@ -134,7 +134,7 @@ static inline void set_buffer_unwritten_#define raw_smp_processor_id () smp_processor_id()#endif #define current_cpu () raw_smp_processor_id() -#define current_pid () (current->pid) +#define current_pid () (task_pid(current))#define current_fsuid (cred) (current->fsuid)#define current_fsgid (cred) (current->fsgid)
fs/xfs/support/debug.c +1 -1
@@ -60,7 +60,7 @@ random(void)int get_thread_id (void ) { -return current->pid; +return task_pid (current); }#endif /* DEBUG || INDUCE_IO_ERRROR || !NO_WANT_RANDOM */
fs/jffs2/debug.h +4 -4
@@ -81,28 +81,28 @@#define JFFS2_ERROR (fmt, ...) \ do { \ printk(JFFS2_ERR_MSG_PREFIX \ - " (%d) %s: " fmt, current->pid, \ + " (%d) %s: " fmt, task_pid(current), \ __FUNCTION__, ##__VA_ARGS__); \ } while(0)#define JFFS2_WARNING (fmt, ...) \ do { \ printk(JFFS2_WARN_MSG_PREFIX \ - " (%d) %s: " fmt, current->pid, \ + " (%d) %s: " fmt, task_pid(current), \ __FUNCTION__, ##__VA_ARGS__); \ } while(0)#define JFFS2_NOTICE (fmt, ...) \ do { \ printk(JFFS2_NOTICE_MSG_PREFIX \ - " (%d) %s: " fmt, current->pid, \ + " (%d) %s: " fmt, task_pid(current), \ __FUNCTION__, ##__VA_ARGS__); \ } while(0)#define JFFS2_DEBUG (fmt, ...) \ do { \ printk(JFFS2_DBG_MSG_PREFIX \ - " (%d) %s: " fmt, current->pid, \ + " (%d) %s: " fmt, task_pid(current), \ __FUNCTION__, ##__VA_ARGS__); \ } while(0)
--
RFC PATCH 4/13 Change pid accesses: include/.
In reply to Serge E. HallynReplace-Subject: Change pid accesses: include/.
From: Serge Hallyn <[email protected]>
Change pid accesses under include/.
--- include/linux/reiserfs_fs.h | 2 +- include/net/scm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/reiserfs_fs.h +1 -1
@@ -83,7 +83,7 @@ void reiserfs_warning(struct super_block if( !( cond ) ) \ reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \ __FILE__ ":%i:%s: " format "\n", \ - in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args ) + in_interrupt() ? -1 : task_pid(current), __LINE__ , __FUNCTION__ , ##args )#if defined(CONFIG_REISERFS_CHECK ) #define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
include/net/scm.h +1 -1
@@ -40,7 +40,7 @@ static __inline__ int scm_send(struct somemset (scm,0 ,sizeof (*scm)); scm->creds.uid = current->uid; scm->creds.gid = current->gid; - scm->creds.pid = current->tgid; + scm->creds.pid =task_tgid (current);if (msg->msg_controllen <=0 )return 0 ;return __scm_send (sock, msg, scm);
--
RFC PATCH 5/13 Change pid accesses: ipc
In reply to Serge E. HallynReplace-Subject: Change pid accesses: ipc
From: Serge Hallyn <[email protected]>
Change pid accesses for ipc/.
--- ipc/mqueue.c | 8 ++++---- ipc/msg.c | 6 +++--- ipc/sem.c | 8 ++++---- ipc/shm.c | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-)
ipc/mqueue.c +4 -4
@@ -359,7 +359,7 @@ static int mqueue_flush_file(struct filestruct mqueue_inode_info *info =MQUEUE_I (filp->f_dentry->d_inode);spin_lock (&info->lock); -if (current->tgid == info->notify_owner) +if (task_tgid (current) == info->notify_owner)remove_notification (info);spin_unlock (&info->lock);
@@ -511,7 +511,7 @@ static void __do_notify(struct mqueue_in sig_i.si_errno =0 ; sig_i.si_code =SI_MESGQ ; sig_i.si_value = info->notify.sigev_value; - sig_i.si_pid = current->tgid; + sig_i.si_pid =task_tgid (current); sig_i.si_uid = current->uid; kill_proc_info(info->notify.sigev_signo,
@@ -1034,7 +1034,7 @@ retry: ret =0 ;spin_lock (&info->lock);if (u_notification ==NULL ) { -if (info->notify_owner == current->tgid) { +if (info->notify_owner ==task_tgid (current)) {remove_notification (info); inode->i_atime = inode->i_ctime =CURRENT_TIME ; }
@@ -1058,7 +1058,7 @@ retry: info->notify.sigev_notify =SIGEV_SIGNAL ;break ; } - info->notify_owner = current->tgid; + info->notify_owner =task_tgid (current); inode->i_atime = inode->i_ctime =CURRENT_TIME ; }spin_unlock (&info->lock);
ipc/msg.c +3 -3
@@ -539,7 +539,7 @@ static inline int pipelined_send(struct msr->r_msg =ERR_PTR (-E2BIG ); }else { msr->r_msg =NULL ; - msq->q_lrpid = msr->r_tsk->pid; + msq->q_lrpid =task_pid (msr->r_tsk); msq->q_rtime =get_seconds ();wake_up_process (msr->r_tsk);smp_mb ();
@@ -621,7 +621,7 @@ asmlinkage long sys_msgsnd (int msqid, s } } - msq->q_lspid = current->tgid; + msq->q_lspid =task_tgid (current); msq->q_stime =get_seconds ();if (!pipelined_send (msq,msg)) {
@@ -717,7 +717,7 @@ asmlinkage long sys_msgrcv (int msqid, slist_del (&msg->m_list); msq->q_qnum--; msq->q_rtime =get_seconds (); - msq->q_lrpid = current->tgid; + msq->q_lrpid =task_tgid (current); msq->q_cbytes -= msg->m_ts;atomic_sub (msg->m_ts,&msg_bytes);atomic_dec (&msg_hdrs);
ipc/sem.c +4 -4
@@ -740,7 +740,7 @@ static int semctl_main(int semid, int sefor (un = sma->undo; un; un = un->id_next) un->semadj[semnum] =0 ; curr->semval = val; - curr->sempid = current->tgid; + curr->sempid =task_tgid (current); sma->sem_ctime =get_seconds ();/* maybe some queued-up processes were waiting for this */ update_queue (sma);
@@ -1132,7 +1132,7 @@ retry_undos:if (error) goto out_unlock_free; - error =try_atomic_semop (sma, sops, nsops, un, current->tgid); + error =try_atomic_semop (sma, sops, nsops, un,task_tgid (current));if (error <=0 ) {if (alter && error ==0 )update_queue (sma);
@@ -1147,7 +1147,7 @@ retry_undos: queue.sops = sops; queue.nsops = nsops; queue.undo = un; - queue.pid = current->tgid; + queue.pid =task_tgid (current); queue.id = semid; queue.alter = alter;if (alter)
@@ -1317,7 +1317,7 @@ found: sem->semval =0 ;if (sem->semval >SEMVMX ) sem->semval =SEMVMX ; - sem->sempid = current->tgid; + sem->sempid =task_tgid (current); } } sma->sem_otime =get_seconds ();
ipc/shm.c +3 -3
@@ -94,7 +94,7 @@ static inline void shm_inc (int id) {if (!(shp =shm_lock (id)))BUG (); shp->shm_atim =get_seconds (); - shp->shm_lprid = current->tgid; + shp->shm_lprid =task_tgid (current); shp->shm_nattch++;shm_unlock (shp); }
@@ -144,7 +144,7 @@ static void shm_close (struct vm_area_st/* remove from the list of attaches of the shm segment */ if (!(shp =shm_lock (id)))BUG (); - shp->shm_lprid = current->tgid; + shp->shm_lprid =task_tgid (current); shp->shm_dtim =get_seconds (); shp->shm_nattch--; if(shp->shm_nattch == 0 &&
@@ -232,7 +232,7 @@ static int newseg (key_t key, int shmflgif (id ==-1 ) goto no_id; - shp->shm_cprid = current->tgid; + shp->shm_cprid =task_tgid (current); shp->shm_lprid =0 ; shp->shm_atim = shp->shm_dtim =0 ; shp->shm_ctim =get_seconds ();
--
RFC PATCH 6/13 Change pid accesses: kernel/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: kernel/
From: Serge Hallyn <[email protected]>
Change pid accesses for kernel/.
--- kernel/acct.c | 4 ++-- kernel/auditsc.c | 14 +++++++------- kernel/capability.c | 8 ++++---- kernel/cpu.c | 2 +- kernel/cpuset.c | 2 +- kernel/exit.c | 30 +++++++++++++++--------------- kernel/fork.c | 16 ++++++++-------- kernel/futex.c | 2 +- kernel/kexec.c | 3 ++- kernel/pid.c | 12 ++++++------ kernel/posix-cpu-timers.c | 15 ++++++++------- kernel/posix-timers.c | 5 +++-- kernel/ptrace.c | 2 +- kernel/sched.c | 15 ++++++++------- kernel/signal.c | 22 +++++++++++----------- kernel/stop_machine.c | 2 +- kernel/sys.c | 10 +++++----- kernel/sysctl.c | 2 +- kernel/timer.c | 8 ++++---- 19 files changed, 89 insertions(+), 85 deletions(-)
kernel/acct.c +2 -2
@@ -485,8 +485,8 @@ static void do_acct_process(long exitcod ac.ac_gid16 = current->gid;#endif #if ACCT_VERSION ==3 - ac.ac_pid = current->tgid; - ac.ac_ppid = current->parent->tgid; + ac.ac_pid =task_tgid (current); + ac.ac_ppid =task_tgid (current->parent);#endif read_lock (&tasklist_lock);/* pin current->signal */
kernel/auditsc.c +7 -7
@@ -401,7 +401,7 @@ static int audit_filter_rules(struct tasswitch (field) {case AUDIT_PID : - result = (tsk->pid == value); + result = (task_pid (tsk) == value);break ;case AUDIT_UID : result = (tsk->uid == value);
@@ -536,7 +536,7 @@ static enum audit_state audit_filter_sysstruct audit_entry *e;enum audit_state state; -if (audit_pid && tsk->tgid == audit_pid) +if (audit_pid &&task_tgid (tsk) == audit_pid)return AUDIT_DISABLED ;rcu_read_lock ();
@@ -633,7 +633,7 @@ static inline struct audit_context *audi context->auditable =1 ; } - context->pid = tsk->pid; + context->pid =task_pid (tsk); context->uid = tsk->uid; context->gid = tsk->gid; context->euid = tsk->euid;
@@ -975,7 +975,7 @@ void audit_syscall_entry(struct task_strprintk (KERN_ERR "audit(:%d) pid=%d in syscall=%d;" " entering syscall=%d\n" , - context->serial, tsk->pid, context->major, major); + context->serial,task_pid (tsk), context->major, major);#endif newctx =audit_alloc_context (context->state);if (newctx) {
@@ -1179,7 +1179,7 @@ int audit_set_loginuid(struct task_strucif (ab) {audit_log_format (ab,"login pid=%d uid=%u " "old auid=%u new auid=%u" , - task->pid, task->uid, +task_pid (task), task->uid, task->audit_context->loginuid, loginuid);audit_log_end (ab); }
@@ -1284,10 +1284,10 @@ void audit_signal_info(int sig, struct textern pid_t audit_sig_pid;extern uid_t audit_sig_uid; -if (unlikely (audit_pid && t->tgid == audit_pid)) { +if (unlikely (audit_pid &&task_tgid (t) == audit_pid)) {if (sig ==SIGTERM || sig ==SIGHUP ) {struct audit_context *ctx = current->audit_context; - audit_sig_pid = current->pid; + audit_sig_pid =task_pid (current);if (ctx) audit_sig_uid = ctx->loginuid;else
kernel/capability.c +4 -4
@@ -66,7 +66,7 @@ asmlinkage long sys_capget(cap_user_headspin_lock (&task_capability_lock);read_lock (&tasklist_lock); -if (pid && pid != current->pid) { +if (pid && pid !=task_pid (current)) { target =find_task_by_pid (pid);if (!target) { ret = -ESRCH ;
@@ -132,7 +132,7 @@ static inline int cap_set_all(kernel_capint found =0 ; do_each_thread(g, target) { -if (target == current || target->pid ==1 ) +if (target == current ||task_pid (target) ==1 )continue ; found =1 ; if (security_capset_check(target, effective, inheritable,
@@ -187,7 +187,7 @@ asmlinkage long sys_capset(cap_user_headif (get_user (pid, &header->pid))return -EFAULT ; -if (pid && pid != current->pid && !capable (CAP_SETPCAP )) +if (pid && pid !=task_pid (current) && !capable (CAP_SETPCAP ))return -EPERM ; if (copy_from_user(&effective, &data->effective, sizeof(effective)) ||
@@ -198,7 +198,7 @@ asmlinkage long sys_capset(cap_user_headspin_lock (&task_capability_lock);read_lock (&tasklist_lock); -if (pid >0 && pid != current->pid) { +if (pid >0 && pid !=task_pid (current)) { target =find_task_by_pid (pid);if (!target) { ret = -ESRCH ;
kernel/cpu.c +1 -1
@@ -72,7 +72,7 @@ static inline void check_for_tasks(int c !cputime_eq(p->stime, cputime_zero)))printk (KERN_WARNING "Task %s (pid = %d) is on cpu %d\ (state = %ld, flags = %lx) \n" , - p->comm, p->pid, cpu, p->state, p->flags); + p->comm,task_pid (p), cpu, p->state, p->flags); }write_unlock_irq (&tasklist_lock); }
kernel/cpuset.c +1 -1
@@ -1261,7 +1261,7 @@ static inline int pid_array_load(pid_t * do_each_thread(g, p) {if (p->cpuset == cs) { - pidarray[n++] = p->pid; + pidarray[n++] =task_pid (p);if (unlikely (n == npids)) goto array_full; }
kernel/exit.c +15 -15
@@ -50,7 +50,7 @@ static void __unhash_process(struct taskif (thread_group_leader (p)) {detach_pid (p,PIDTYPE_PGID );detach_pid (p,PIDTYPE_SID ); -if (p->pid) +if (task_pid (p))__get_cpu_var (process_counts)--; }
@@ -170,7 +170,7 @@ static int will_become_orphaned_pgrp(int do_each_task_pid(pgrp, PIDTYPE_PGID, p) {if (p == ignored_task || p->exit_state - || p->real_parent->pid ==1 ) + ||task_pid (p->real_parent) ==1 )continue ;if (process_group (p->real_parent) != pgrp && p->real_parent->signal->session == p->signal->session) {
@@ -797,9 +797,9 @@ fastcall NORET_TYPE void do_exit(long coif (unlikely (in_interrupt ()))panic ("Aiee, killing interrupt handler!" ); -if (unlikely (!tsk->pid)) +if (unlikely (!task_pid (tsk)))panic ("Attempted to kill the idle task!" ); -if (unlikely (tsk->pid ==1 )) +if (unlikely (task_pid (tsk) ==1 ))panic ("Attempted to kill init!" );if (tsk->io_context)exit_io_context ();
@@ -832,7 +832,7 @@ fastcall NORET_TYPE void do_exit(long coif (unlikely (in_atomic ()))printk (KERN_INFO "note: %s[%d] exited with preempt_count %d\n" , - current->comm, current->pid, + current->comm,task_pid (current),preempt_count ());acct_update_integrals (tsk);
@@ -951,7 +951,7 @@ asmlinkage void sys_exit_group(int errorstatic int eligible_child (pid_t pid,int options,task_t *p) {if (pid >0 ) { -if (p->pid != pid) +if (task_pid (p) != pid)return 0 ; }else if (!pid) {if (process_group (p) !=process_group (current))
@@ -980,7 +980,7 @@ static int eligible_child(pid_t pid, int* Do not consider thread group leaders that are * in a non-empty thread group: */ -if (current->tgid != p->tgid &&delay_group_leader (p)) +if (task_tgid (current) !=task_tgid (p) &&delay_group_leader (p))return 2 ;if (security_task_wait (p))
@@ -1028,7 +1028,7 @@ static int wait_task_zombie(task_t *p, iint status;if (unlikely (noreap)) { -pid_t pid = p->pid; +pid_t pid =task_pid (p);uid_t uid = p->uid;int exit_code = p->exit_code;int why, status;
@@ -1135,7 +1135,7 @@ static int wait_task_zombie(task_t *p, i retval =put_user (status, &infop->si_status); }if (!retval && infop) - retval =put_user (p->pid, &infop->si_pid); + retval =put_user (task_pid (p), &infop->si_pid);if (!retval && infop) retval =put_user (p->uid, &infop->si_uid);if (retval) {
@@ -1143,7 +1143,7 @@ static int wait_task_zombie(task_t *p, i p->exit_state =EXIT_ZOMBIE ;return retval; } - retval = p->pid; + retval =task_pid (p);if (p->real_parent != p->parent) {write_lock_irq (&tasklist_lock);/* Double-check with lock held. */
@@ -1203,7 +1203,7 @@ static int wait_task_stopped(task_t *p,read_unlock (&tasklist_lock);if (unlikely (noreap)) { -pid_t pid = p->pid; +pid_t pid =task_pid (p);uid_t uid = p->uid;int why = (p->ptrace &PT_PTRACED ) ?CLD_TRAPPED :CLD_STOPPED ;
@@ -1274,11 +1274,11 @@ bail_ref:if (!retval && infop) retval =put_user (exit_code, &infop->si_status);if (!retval && infop) - retval =put_user (p->pid, &infop->si_pid); + retval =put_user (task_pid (p), &infop->si_pid);if (!retval && infop) retval =put_user (p->uid, &infop->si_uid);if (!retval) - retval = p->pid; + retval =task_pid (p);put_task_struct (p);BUG_ON (!retval);
@@ -1315,7 +1315,7 @@ static int wait_task_continued(task_t *p p->signal->flags &= ~SIGNAL_STOP_CONTINUED ;spin_unlock_irq (&p->sighand->siglock); - pid = p->pid; + pid =task_pid (p); uid = p->uid;get_task_struct (p);read_unlock (&tasklist_lock);
@@ -1326,7 +1326,7 @@ static int wait_task_continued(task_t *pif (!retval && stat_addr) retval =put_user (0xffff , stat_addr);if (!retval) - retval = p->pid; + retval =task_pid (p); }else { retval = wait_noreap_copyout(p, pid, uid, CLD_CONTINUED, SIGCONT,
kernel/fork.c +8 -8
@@ -850,7 +850,7 @@ asmlinkage long sys_set_tid_address(int { current->clear_child_tid = tidptr; -return current->pid; +return task_pid (current); }/*
@@ -927,10 +927,10 @@ static task_t *copy_process(unsigned lon p->did_exec =0 ;copy_flags (clone_flags, p); - p->pid = pid; + p->__pid = pid; retval = -EFAULT ;if (clone_flags &CLONE_PARENT_SETTID ) -if (put_user (p->pid, parent_tidptr)) +if (put_user (task_pid (p), parent_tidptr)) goto bad_fork_cleanup; p->proc_dentry =NULL ;
@@ -975,9 +975,9 @@ static task_t *copy_process(unsigned lon }#endif - p->tgid = p->pid; + p->__tgid =task_pid (p);if (clone_flags &CLONE_THREAD ) - p->tgid = current->tgid; + p->__tgid =task_tgid (current);if ((retval =security_task_alloc (p))) goto bad_fork_cleanup_policy;
@@ -1128,12 +1128,12 @@ static task_t *copy_process(unsigned loncpuset_fork (p); -attach_pid (p,PIDTYPE_PID , p->pid); -attach_pid (p,PIDTYPE_TGID , p->tgid); +attach_pid (p,PIDTYPE_PID ,task_pid (p)); +attach_pid (p,PIDTYPE_TGID ,task_tgid (p));if (thread_group_leader (p)) {attach_pid (p,PIDTYPE_PGID ,process_group (p));attach_pid (p,PIDTYPE_SID , p->signal->session); -if (p->pid) +if (task_pid (p))__get_cpu_var (process_counts)++; }
kernel/futex.c +1 -1
@@ -789,7 +789,7 @@ static int futex_fd(unsigned long uaddr, filp->f_mapping = filp->f_dentry->d_inode->i_mapping;if (signal) { - err =f_setown (filp, current->pid,1 ); + err =f_setown (filp,task_pid (current),1 );if (err <0 ) { goto error; }
kernel/kexec.c +2 -1
@@ -36,7 +36,8 @@ struct resource crashk_res = {int kexec_should_crash (struct task_struct *p) { -if (in_interrupt () || !p->pid || p->pid ==1 || panic_on_oops) +if (in_interrupt () || !task_pid (p) || +task_pid (p) ==1 || panic_on_oops)return 1 ;return 0 ; }
kernel/pid.c +6 -6
@@ -232,17 +232,17 @@ void switch_exec_pids(task_t *leader, ta__detach_pid (thread,PIDTYPE_PID );__detach_pid (thread,PIDTYPE_TGID ); - leader->pid = leader->tgid = thread->pid; - thread->pid = thread->tgid; + leader->__pid = leader->__tgid = thread->__pid; + thread->__pid = thread->__tgid; -attach_pid (thread,PIDTYPE_PID , thread->pid); -attach_pid (thread,PIDTYPE_TGID , thread->tgid); +attach_pid (thread,PIDTYPE_PID , thread->__pid); +attach_pid (thread,PIDTYPE_TGID , thread->__tgid);attach_pid (thread,PIDTYPE_PGID , thread->signal->pgrp);attach_pid (thread,PIDTYPE_SID , thread->signal->session);list_add_tail (&thread->tasks, &init_task.tasks); -attach_pid (leader,PIDTYPE_PID , leader->pid); -attach_pid (leader,PIDTYPE_TGID , leader->tgid); +attach_pid (leader,PIDTYPE_PID , leader->__pid); +attach_pid (leader,PIDTYPE_TGID , leader->__tgid);attach_pid (leader,PIDTYPE_PGID , leader->signal->pgrp);attach_pid (leader,PIDTYPE_SID , leader->signal->session); }
kernel/posix-cpu-timers.c +8 -7
@@ -22,7 +22,8 @@ static int check_clock(clockid_t which_cread_lock (&tasklist_lock); p =find_task_by_pid (pid);if (!p || (CPUCLOCK_PERTHREAD (which_clock) ? - p->tgid != current->tgid : p->tgid != pid)) { +task_tgid (p) !=task_tgid (current) + :task_tgid (p) != pid)) { error = -EINVAL ; }read_unlock (&tasklist_lock);
@@ -238,7 +239,7 @@ static int cpu_clock_sample_group_lockedwhile ((t =next_thread (t)) != p) { cpu->sched += t->sched_time; } -if (p->tgid == current->tgid) { +if (task_tgid (p) ==task_tgid (current)) {/* * We're sampling ourselves, so include the * cycles not yet banked. We still omit
@@ -306,11 +307,11 @@ int posix_cpu_clock_get(clockid_t which_ p =find_task_by_pid (pid);if (p) {if (CPUCLOCK_PERTHREAD (which_clock)) { -if (p->tgid == current->tgid) { +if (task_tgid (p) ==task_tgid (current)) { error =cpu_clock_sample (which_clock, p, &rtn); } - }else if (p->tgid == pid && p->signal) { + }else if (task_tgid (p) == pid && p->signal) { error =cpu_clock_sample_group (which_clock, p, &rtn); }
@@ -348,7 +349,7 @@ int posix_cpu_timer_create(struct k_itim p = current; }else { p =find_task_by_pid (pid); -if (p && p->tgid != current->tgid) +if (p &&task_tgid (p) !=task_tgid (current)) p =NULL ; } }else {
@@ -356,7 +357,7 @@ int posix_cpu_timer_create(struct k_itim p = current->group_leader; }else { p =find_task_by_pid (pid); -if (p && p->tgid != pid) +if (p &&task_tgid (p) != pid) p =NULL ; } }
@@ -1423,7 +1424,7 @@ int posix_cpu_nsleep(clockid_t which_clo*/ if (CPUCLOCK_PERTHREAD (which_clock) && (CPUCLOCK_PID (which_clock) ==0 || -CPUCLOCK_PID (which_clock) == current->pid)) +CPUCLOCK_PID (which_clock) ==task_pid (current)))return -EINVAL ;/*
kernel/posix-timers.c +3 -2
@@ -519,7 +519,7 @@ static inline struct task_struct * good_if ((event->sigev_notify &SIGEV_THREAD_ID ) && (!(rtn =find_task_by_pid (event->sigev_notify_thread_id)) || - rtn->tgid != current->tgid || +task_tgid (rtn) !=task_tgid (current) || (event->sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_SIGNAL ))return NULL ;
@@ -747,7 +747,8 @@ static struct k_itimer * lock_timer(timespin_unlock (&idr_lock);if ((timr->it_id != timer_id) || !(timr->it_process) || - timr->it_process->tgid != current->tgid) { +task_tgid (timr->it_process) != +task_tgid (current)) {unlock_timer (timr, *flags); timr =NULL ; }
kernel/ptrace.c +1 -1
@@ -153,7 +153,7 @@ int ptrace_attach(struct task_struct *taint retval;task_lock (task); retval = -EPERM ; -if (task->pid <=1 ) +if (task_pid (task) <=1 ) goto bad;if (task->tgid == current->tgid) goto bad;
kernel/sched.c +8 -7
@@ -1653,7 +1653,7 @@ asmlinkage void schedule_tail(task_t *prpreempt_enable ();#endif if (current->set_child_tid) -put_user (current->pid, current->set_child_tid); +put_user (task_pid (current), current->set_child_tid); }/*
@@ -2961,7 +2961,7 @@ asmlinkage void __sched schedule(void)if (unlikely (in_atomic ())) {printk (KERN_ERR "scheduling while atomic: " "%s/0x%08x/%d\n" , - current->comm,preempt_count (), current->pid); + current->comm,preempt_count (),task_pid (current));dump_stack (); } }
@@ -4333,17 +4333,18 @@ static void show_task(task_t *p) free = (unsigned long) n - (unsigned long)(p->thread_info+1); }#endif -printk ("%5lu %5d %6d " , free, p->pid, p->parent->pid); +printk ("%5lu %5d %6d " , free,task_pid (p), +task_pid (p->parent));if ((relative =eldest_child (p))) -printk ("%5d " , relative->pid); +printk ("%5d " ,task_pid (relative));else printk (" " );if ((relative =younger_sibling (p))) -printk ("%7d" , relative->pid); +printk ("%7d" ,task_pid (relative));else printk (" " );if ((relative =older_sibling (p))) -printk (" %5d" , relative->pid); +printk (" %5d" ,task_pid (relative));else printk (" " );if (!p->mm)
@@ -4623,7 +4624,7 @@ static void move_task_off_dead_cpu(int dif (tsk->mm &&printk_ratelimit ())printk (KERN_INFO "process %d (%s) no " "longer affine to cpu%d\n" , - tsk->pid, tsk->comm, dead_cpu); +task_pid (tsk), tsk->comm, dead_cpu); }__migrate_task (tsk, dead_cpu, dest_cpu); }
kernel/signal.c +11 -11
@@ -809,7 +809,7 @@ static int send_signal(int sig, struct s q->info.si_signo = sig; q->info.si_errno =0 ; q->info.si_code =SI_USER ; - q->info.si_pid = current->pid; + q->info.si_pid =task_pid (current); q->info.si_uid = current->uid;break ;case (unsigned long )SEND_SIG_PRIV :
@@ -946,7 +946,7 @@ __group_complete_signal(int sig, structif (t ==NULL )/* restart balancing at this thread */ t = p->signal->curr_target = p; -BUG_ON (t->tgid != p->tgid); +BUG_ON (task_tgid (t) !=task_tgid (p));while (!wants_signal (sig, t)) { t =next_thread (t);
@@ -1208,7 +1208,7 @@ static int kill_something_info(int sig,read_lock (&tasklist_lock);for_each_process (p) { -if (p->pid >1 && p->tgid != current->tgid) { +if (task_pid (p) >1 &&task_tgid (p) !=task_tgid (current)) {int err =group_send_sig_info (sig, info, p); ++count;if (err != -EPERM )
@@ -1478,7 +1478,7 @@ void do_notify_parent(struct task_struct info.si_signo = sig; info.si_errno =0 ; - info.si_pid = tsk->pid; + info.si_pid =task_pid (tsk); info.si_uid = tsk->uid;/* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1543,7 +1543,7 @@ static void do_notify_parent_cldstop(str info.si_signo =SIGCHLD ; info.si_errno =0 ; - info.si_pid = tsk->pid; + info.si_pid =task_pid (tsk); info.si_uid = tsk->uid;/* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1646,7 +1646,7 @@ void ptrace_notify(int exit_code)memset (&info,0 ,sizeof info); info.si_signo =SIGTRAP ; info.si_code = exit_code; - info.si_pid = current->pid; + info.si_pid =task_pid (current); info.si_uid = current->uid;/* Let the debugger run. */
@@ -1871,7 +1871,7 @@ relock: info->si_signo = signr; info->si_errno =0 ; info->si_code =SI_USER ; - info->si_pid = current->parent->pid; + info->si_pid =task_pid (current->parent); info->si_uid = current->parent->uid; }
@@ -1902,7 +1902,7 @@ relock:continue ;/* Init gets no signals it doesn't want. */ -if (current->pid ==1 ) +if (task_pid (current) ==1 )continue ;if (sig_kernel_stop (signr)) {
@@ -2254,7 +2254,7 @@ sys_kill(int pid, int sig) info.si_signo = sig; info.si_errno =0 ; info.si_code =SI_USER ; - info.si_pid = current->tgid; + info.si_pid =task_tgid (current); info.si_uid = current->uid;return kill_something_info (sig, &info, pid);
@@ -2270,12 +2270,12 @@ static int do_tkill(int tgid, int pid, i info.si_signo = sig; info.si_errno =0 ; info.si_code =SI_TKILL ; - info.si_pid = current->tgid; + info.si_pid =task_tgid (current); info.si_uid = current->uid;read_lock (&tasklist_lock); p =find_task_by_pid (pid); -if (p && (tgid <=0 || p->tgid == tgid)) { +if (p && (tgid <=0 ||task_tgid (p) == tgid)) { error =check_kill_permission (sig, &info, p);/* * The null signal is a permissions and process existence
kernel/stop_machine.c +1 -1
@@ -91,7 +91,7 @@ static int stop_machine(void)/* One high-prio thread per cpu. We'll do this one. */ set_fs (KERNEL_DS ); -sys_sched_setscheduler (current->pid,SCHED_FIFO , +sys_sched_setscheduler (task_pid (current),SCHED_FIFO , (struct sched_param __user *)¶m);set_fs (old_fs);
kernel/sys.c +5 -5
@@ -267,7 +267,7 @@ asmlinkage long sys_setpriority(int whicswitch (which) {case PRIO_PROCESS :if (!who) - who = current->pid; + who =task_pid (current); p =find_task_by_pid (who);if (p) error =set_one_prio (p, niceval, error);
@@ -320,7 +320,7 @@ asmlinkage long sys_getpriority(int whicswitch (which) {case PRIO_PROCESS :if (!who) - who = current->pid; + who =task_pid (current); p =find_task_by_pid (who);if (p) { niceval =20 -task_nice (p);
@@ -1086,7 +1086,7 @@ asmlinkage long sys_setpgid(pid_t pid, pint err = -EINVAL ;if (!pid) - pid = current->pid; + pid =task_pid (current);if (!pgid) pgid = pid;if (pgid <0 )
@@ -1216,12 +1216,12 @@ asmlinkage long sys_setsid(void)down (&tty_sem);write_lock_irq (&tasklist_lock); - pid =find_pid (PIDTYPE_PGID , current->pid); + pid =find_pid (PIDTYPE_PGID ,task_pid (current));if (pid) goto out; current->signal->leader =1 ; -__set_special_pids (current->pid, current->pid); +__set_special_pids (task_pid (current),task_pid (current)); current->signal->tty =NULL ; current->signal->tty_old_pgrp =0 ; err =process_group (current);
kernel/sysctl.c +1 -1
@@ -1764,7 +1764,7 @@ int proc_dointvec_bset(ctl_table *table,return -EPERM ; } - op = (current->pid ==1 ) ?OP_SET :OP_AND ; + op = (task_pid (current) ==1 ) ?OP_SET :OP_AND ;return do_proc_dointvec (table,write,filp,buffer,lenp,ppos, do_proc_dointvec_bset_conv,&op); }
kernel/timer.c +4 -4
@@ -937,11 +937,11 @@ asmlinkage unsigned long sys_alarm(unsig* the pid are identical unless CLONE_THREAD was specified on clone() in * which case the tgid is the same in all threads of the same group. * -* This is SMP safe as current->tgid does not change. +* This is SMP safe as task_tgid(current) does not change. */ asmlinkage long sys_getpid (void ) { -return current->tgid; +return task_tgid (current); }/*
@@ -968,7 +968,7 @@ asmlinkage long sys_getppid(void) parent = me->group_leader->real_parent;for (;;) { - pid = parent->tgid; + pid =task_tgid (parent);#if defined(CONFIG_SMP ) || defined(CONFIG_PREEMPT ) {struct task_struct *old = parent;
@@ -1115,7 +1115,7 @@ EXPORT_SYMBOL(schedule_timeout_uninterru/* Thread ID - the internal kernel "pid" */ asmlinkage long sys_gettid (void ) { -return current->pid; +return task_pid (current); }static long __sched nanosleep_restart (struct restart_block *restart)
--
RFC PATCH 7/13 Change pid accesses: lib/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: lib/
From: Serge Hallyn <[email protected]>
Change pid accesses under lib/.
--- lib/rwsem-spinlock.c | 2 +- lib/rwsem.c | 2 +- lib/smp_processor_id.c | 2 +- lib/spinlock_debug.c | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-)
lib/rwsem-spinlock.c +1 -1
@@ -22,7 +22,7 @@ void rwsemtrace(struct rw_semaphore *sem {if (sem->debug)printk ("[%d] %s({%d,%d})\n" , - current->pid, str, sem->activity, +task_pid (current), str, sem->activity,list_empty (&sem->wait_list) ?0 :1 ); }#endif
lib/rwsem.c +1 -1
@@ -23,7 +23,7 @@ void rwsemtrace(struct rw_semaphore *semprintk ("sem=%p\n" , sem);printk ("(sem)=%08lx\n" , sem->count);if (sem->debug) - printk("[%d] %s({%08lx})\n", current->pid, str, sem->count); + printk("[%d] %s({%08lx})\n", task_pid(current), str, sem->count); }#endif
lib/smp_processor_id.c +1 -1
@@ -42,7 +42,7 @@ unsigned int debug_smp_processor_id(voidif (!printk_ratelimit ()) goto out_enable; -printk (KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n" ,preempt_count (), current->comm, current->pid); +printk (KERN_ERR "BUG: using smp_processor_id() in preemptible [%08x] code: %s/%d\n" ,preempt_count (), current->comm,task_pid (current));print_symbol ("caller is %s\n" , (long )__builtin_return_address (0 ));dump_stack ();
lib/spinlock_debug.c +6 -6
@@ -20,11 +20,11 @@ static void spin_bug(spinlock_t *lock, cif (lock->owner && lock->owner !=SPINLOCK_OWNER_INIT ) owner = lock->owner;printk ("BUG: spinlock %s on CPU#%d, %s/%d\n" , - msg,smp_processor_id (), current->comm, current->pid); + msg,smp_processor_id (), current->comm,task_pid (current));printk (" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n" , lock, lock->magic, owner ? owner->comm :"<none>" , - owner ? owner->pid :-1 , + owner ?task_pid (owner) :-1 , lock->owner_cpu);dump_stack ();#ifdef CONFIG_SMP
@@ -78,7 +78,7 @@ static void __spin_lock_debug(spinlock_tif (print_once) { print_once =0 ;printk ("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n" , -smp_processor_id (), current->comm, current->pid, +smp_processor_id (), current->comm,task_pid (current), lock);dump_stack (); }
@@ -120,7 +120,7 @@ static void rwlock_bug(rwlock_t *lock, cif (xchg (&print_once,0 )) {printk ("BUG: rwlock %s on CPU#%d, %s/%d, %p\n" , msg, -smp_processor_id (), current->comm, current->pid, lock); +smp_processor_id (), current->comm,task_pid (current), lock);dump_stack ();#ifdef CONFIG_SMP /*
@@ -148,7 +148,7 @@ static void __read_lock_debug(rwlock_t *if (print_once) { print_once =0 ;printk ("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n" , -smp_processor_id (), current->comm, current->pid, +smp_processor_id (), current->comm,task_pid (current), lock);dump_stack (); }
@@ -220,7 +220,7 @@ static void __write_lock_debug(rwlock_tif (print_once) { print_once =0 ;printk ("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n" , -smp_processor_id (), current->comm, current->pid, +smp_processor_id (), current->comm,task_pid (current), lock);dump_stack (); }
--
RFC PATCH 8/13 Change pid accesses: mm/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: mm/
From: Serge Hallyn <[email protected]>
Change pid accesses for mm/.
--- mm/nommu.c | 14 +++++++------- mm/oom_kill.c | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-)
mm/nommu.c +7 -7
@@ -264,7 +264,7 @@ static void show_process_blocks(void) {struct vm_list_struct *vml; -printk ("Process blocks %d:" , current->pid); +printk ("Process blocks %d:" ,task_pid (current));for (vml = ¤t->mm->context.vmlist; vml; vml = vml->next) {printk (" %p: %p" , vml, vml->vma);
@@ -380,7 +380,7 @@ static int validate_mmap_request(structif (flags &MAP_FIXED || addr) {printk (KERN_DEBUG "%d: Can't do fixed-address/overlay mmap of RAM\n" , - current->pid); +task_pid (current));return -EINVAL ; }
@@ -626,7 +626,7 @@ static int do_mmap_private(struct vm_are#ifdef WARN_ON_SLACK if (len +WARN_ON_SLACK <=kobjsize (result))printk ("Allocation of %lu bytes from process %d has %lu bytes of slack\n" , - len, current->pid,kobjsize (result) - len); + len,task_pid (current),kobjsize (result) - len);#endif if (vma->vm_file) {
@@ -663,7 +663,7 @@ error_free: enomem:printk ("Allocation of length %lu from process %d failed\n" , - len, current->pid); + len,task_pid (current));show_free_areas ();return -ENOMEM ; }
@@ -855,13 +855,13 @@ unsigned long do_mmap_pgoff(struct fileup_write (&nommu_vma_sem);kfree (vml);printk ("Allocation of vma for %lu byte allocation from process %d failed\n" , - len, current->pid); + len,task_pid (current));show_free_areas ();return -ENOMEM ; error_getting_vml:printk ("Allocation of vml for %lu byte allocation from process %d failed\n" , - len, current->pid); + len,task_pid (current));show_free_areas ();return -ENOMEM ; }
@@ -915,7 +915,7 @@ int do_munmap(struct mm_struct *mm, unsi goto found;printk ("munmap of non-mmaped memory by process %d (%s): %p\n" , - current->pid, current->comm, (void *) addr); +task_pid (current), current->comm, (void *) addr);return -EINVAL ; found:
mm/oom_kill.c +5 -5
@@ -125,7 +125,7 @@ unsigned long badness(struct task_struct#ifdef DEBUG printk (KERN_DEBUG "OOMkill: task %d (%s) got %d points\n" , - p->pid, p->comm, points); +task_pid (p), p->comm, points);#endif return points; }
@@ -149,7 +149,7 @@ static struct task_struct * select_bad_pint releasing;/* skip the init task with pid == 1 */ -if (p->pid ==1 ) +if (task_pid (p) ==1 )continue ;if (p->oomkilladj ==OOM_DISABLE )continue ;
@@ -184,7 +184,7 @@ static struct task_struct * select_bad_p*/ static void __oom_kill_task (task_t *p) { -if (p->pid ==1 ) { +if (task_pid (p) ==1 ) {WARN_ON (1 );printk (KERN_WARNING "tried to kill init!\n" );return ;
@@ -199,7 +199,7 @@ static void __oom_kill_task(task_t *p) }task_unlock (p);printk (KERN_ERR "Out of Memory: Killed process %d (%s).\n" , - p->pid, p->comm); +task_pid (p), p->comm);/* * We give our sacrificial lamb high priority and access to
@@ -230,7 +230,7 @@ static struct mm_struct *oom_kill_task(t* but are in a different thread group */ do_each_thread(g, q) -if (q->mm == mm && q->tgid != p->tgid) +if (q->mm == mm &&task_tgid (q) !=task_tgid (p))__oom_kill_task (q);while_each_thread (g, q);
--
RFC PATCH 9/13 Change pid accesses: net/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: net/
From: Serge Hallyn <[email protected]>
Change pid accesses for net/.
--- net/core/pktgen.c | 4 ++-- net/core/rtnetlink.c | 3 ++- net/core/scm.c | 2 +- net/ipv4/devinet.c | 2 +- net/ipv4/fib_semantics.c | 2 +- net/ipv4/ipvs/ip_vs_sync.c | 6 +++--- net/ipv4/tcp.c | 2 +- net/ipv6/addrconf.c | 6 +++--- net/ipv6/ip6_flowlabel.c | 2 +- net/ipv6/route.c | 2 +- net/netlink/af_netlink.c | 2 +- net/rxrpc/krxiod.c | 2 +- net/rxrpc/krxsecd.c | 2 +- net/rxrpc/krxtimod.c | 2 +- net/sunrpc/sched.c | 2 +- net/unix/af_unix.c | 6 +++--- 16 files changed, 24 insertions(+), 23 deletions(-)
net/core/pktgen.c +2 -2
@@ -2699,9 +2699,9 @@ static void pktgen_thread_worker(struct t->control &= ~(T_STOP ); t->control &= ~(T_REMDEV ); - t->pid = current->pid; + t->pid =task_pid (current); -PG_DEBUG (printk ("pktgen: starting pktgen/%d: pid=%d\n" , cpu, current->pid)); +PG_DEBUG (printk ("pktgen: starting pktgen/%d: pid=%d\n" , cpu,task_pid (current))); max_before_softirq = t->max_before_softirq;
net/core/rtnetlink.c +2 -1
@@ -455,7 +455,8 @@ void rtmsg_ifinfo(int type, struct net_dif (!skb)return ; -if (rtnetlink_fill_ifinfo (skb, dev, type, current->pid,0 , change,0 ) <0 ) { +if (rtnetlink_fill_ifinfo (skb, dev, type,task_pid (current), +0 , change,0 ) <0 ) {kfree_skb (skb);return ; }
net/core/scm.c +1 -1
@@ -41,7 +41,7 @@static __inline__int scm_check_creds (struct ucred *creds) { - if ((creds->pid == current->tgid || capable(CAP_SYS_ADMIN)) && + if ((creds->pid == task_tgid(current) || capable(CAP_SYS_ADMIN)) && ((creds->uid == current->uid || creds->uid == current->euid || creds->uid == current->suid) || capable(CAP_SETUID)) && ((creds->gid == current->gid || creds->gid == current->egid ||
net/ipv4/devinet.c +1 -1
@@ -1113,7 +1113,7 @@ static void rtmsg_ifa(int event, structif (!skb)netlink_set_err (rtnl,0 ,RTNLGRP_IPV4_IFADDR ,ENOBUFS ); -else if (inet_fill_ifaddr (skb, ifa, current->pid,0 , event,0 ) <0 ) { +else if (inet_fill_ifaddr (skb, ifa,task_pid (current),0 , event,0 ) <0 ) {kfree_skb (skb);netlink_set_err (rtnl,0 ,RTNLGRP_IPV4_IFADDR ,EINVAL ); }else {
net/ipv4/fib_semantics.c +1 -1
@@ -1043,7 +1043,7 @@ fib_convert_rtentry(int cmd, struct nlms } nl->nlmsg_flags =NLM_F_REQUEST ; - nl->nlmsg_pid = current->pid; + nl->nlmsg_pid =task_pid (current); nl->nlmsg_seq =0 ; nl->nlmsg_len =NLMSG_LENGTH (sizeof (*rtm));if (cmd ==SIOCDELRT ) {
net/ipv4/ipvs/ip_vs_sync.c +3 -3
@@ -786,7 +786,7 @@ static int sync_thread(void *startup)add_wait_queue (&sync_wait, &wait); -set_sync_pid (state, current->pid); +set_sync_pid (state,task_pid (current));complete ((struct completion *)startup);/* processing master/backup loop here */
@@ -841,7 +841,7 @@ int start_sync_thread(int state, char *m (state == IP_VS_STATE_BACKUP && sync_backup_pid))return -EEXIST ; -IP_VS_DBG (7 ,"%s: pid %d\n" , __FUNCTION__, current->pid); +IP_VS_DBG (7 ,"%s: pid %d\n" , __FUNCTION__,task_pid (current));IP_VS_DBG (7 ,"Each ip_vs_sync_conn entry need %Zd bytes\n" ,sizeof (struct ip_vs_sync_conn ));
@@ -876,7 +876,7 @@ int stop_sync_thread(int state) (state == IP_VS_STATE_BACKUP && !sync_backup_pid))return -ESRCH ; -IP_VS_DBG (7 ,"%s: pid %d\n" , __FUNCTION__, current->pid); +IP_VS_DBG (7 ,"%s: pid %d\n" , __FUNCTION__,task_pid (current));IP_VS_INFO ("stopping sync thread %d ...\n" , (state ==IP_VS_STATE_MASTER ) ? sync_master_pid : sync_backup_pid);
net/ipv4/tcp.c +1 -1
@@ -1299,7 +1299,7 @@ do_prequeue:if ((flags &MSG_PEEK ) && peek_seq != tp->copied_seq) {if (net_ratelimit ())printk (KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n" , - current->comm, current->pid); + current->comm,task_pid (current)); peek_seq = tp->copied_seq; }continue ;
net/ipv6/addrconf.c +3 -3
@@ -2997,7 +2997,7 @@ static void inet6_ifa_notify(int event,netlink_set_err (rtnl,0 ,RTNLGRP_IPV6_IFADDR ,ENOBUFS );return ; } -if (inet6_fill_ifaddr (skb, ifa, current->pid,0 , event,0 ) <0 ) { +if (inet6_fill_ifaddr (skb, ifa,task_pid (current),0 , event,0 ) <0 ) {kfree_skb (skb);netlink_set_err (rtnl,0 ,RTNLGRP_IPV6_IFADDR ,EINVAL );return ;
@@ -3132,7 +3132,7 @@ void inet6_ifinfo_notify(int event, strunetlink_set_err (rtnl,0 ,RTNLGRP_IPV6_IFINFO ,ENOBUFS );return ; } -if (inet6_fill_ifinfo (skb, idev, current->pid,0 , event,0 ) <0 ) { +if (inet6_fill_ifinfo (skb, idev,task_pid (current),0 , event,0 ) <0 ) {kfree_skb (skb);netlink_set_err (rtnl,0 ,RTNLGRP_IPV6_IFINFO ,EINVAL );return ;
@@ -3192,7 +3192,7 @@ static void inet6_prefix_notify(int evennetlink_set_err (rtnl,0 ,RTNLGRP_IPV6_PREFIX ,ENOBUFS );return ; } -if (inet6_fill_prefix (skb, idev, pinfo, current->pid,0 , event,0 ) <0 ) { +if (inet6_fill_prefix (skb, idev, pinfo,task_pid (current),0 , event,0 ) <0 ) {kfree_skb (skb);netlink_set_err (rtnl,0 ,RTNLGRP_IPV6_PREFIX ,EINVAL );return ;
net/ipv6/ip6_flowlabel.c +1 -1
@@ -342,7 +342,7 @@ fl_create(struct in6_flowlabel_req *freqcase IPV6_FL_S_ANY :break ;case IPV6_FL_S_PROCESS : - fl->owner = current->pid; + fl->owner =task_pid (current);break ;case IPV6_FL_S_USER : fl->owner = current->euid;
net/ipv6/route.c +1 -1
@@ -1840,7 +1840,7 @@ void inet6_rt_notify(int event, struct r {struct sk_buff *skb;int size =NLMSG_SPACE (sizeof (struct rtmsg )+256 ); -u32 pid = current->pid; +u32 pid =task_pid (current);u32 seq =0 ;if (req)
net/netlink/af_netlink.c +1 -1
@@ -476,7 +476,7 @@ static int netlink_autobind(struct sockestruct hlist_head *head;struct sock *osk;struct hlist_node *node; -s32 pid = current->pid; +s32 pid =task_pid (current);int err;static s32 rover =-4097 ;
net/rxrpc/krxiod.c +1 -1
@@ -40,7 +40,7 @@ static int rxrpc_krxiod(void *arg) {DECLARE_WAITQUEUE (krxiod,current); -printk ("Started krxiod %d\n" ,current->pid); +printk ("Started krxiod %d\n" ,task_pid (current));daemonize ("krxiod" );
net/rxrpc/krxsecd.c +1 -1
@@ -53,7 +53,7 @@ static int rxrpc_krxsecd(void *arg)int die; -printk ("Started krxsecd %d\n" , current->pid); +printk ("Started krxsecd %d\n" ,task_pid (current));daemonize ("krxsecd" );
net/rxrpc/krxtimod.c +1 -1
@@ -68,7 +68,7 @@ static int krxtimod(void *arg)rxrpc_timer_t *timer; -printk ("Started krxtimod %d\n" , current->pid); +printk ("Started krxtimod %d\n" ,task_pid (current));daemonize ("krxtimod" );
net/sunrpc/sched.c +1 -1
@@ -792,7 +792,7 @@ void rpc_init_task(struct rpc_task *taskspin_unlock (&rpc_sched_lock);dprintk ("RPC: %4d new task procpid %d\n" , task->tk_pid, - current->pid); +task_pid (current)); } static struct rpc_task *
net/unix/af_unix.c +3 -3
@@ -439,7 +439,7 @@ static int unix_listen(struct socket *so sk->sk_max_ack_backlog = backlog; sk->sk_state =TCP_LISTEN ;/* set credentials so connect can copy them */ - sk->sk_peercred.pid = current->tgid; + sk->sk_peercred.pid =task_tgid (current); sk->sk_peercred.uid = current->euid; sk->sk_peercred.gid = current->egid; err =0 ;
@@ -1043,7 +1043,7 @@ restart:unix_peer (newsk) = sk; newsk->sk_state =TCP_ESTABLISHED ; newsk->sk_type = sk->sk_type; - newsk->sk_peercred.pid = current->tgid; + newsk->sk_peercred.pid =task_tgid (current); newsk->sk_peercred.uid = current->euid; newsk->sk_peercred.gid = current->egid; newu =unix_sk (newsk);
@@ -1105,7 +1105,7 @@ static int unix_socketpair(struct socketsock_hold (skb);unix_peer (ska)=skb;unix_peer (skb)=ska; - ska->sk_peercred.pid = skb->sk_peercred.pid = current->tgid; + ska->sk_peercred.pid = skb->sk_peercred.pid =task_tgid (current); ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid;
--
RFC PATCH 10/13 Change pid accesses: security/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: security/
From: Serge Hallyn <[email protected]>
Change pid accesses for security modules.
--- security/commoncap.c | 2 +- security/keys/process_keys.c | 6 +++--- security/keys/request_key_auth.c | 2 +- security/seclvl.c | 16 ++++++++-------- security/selinux/avc.c | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-)
security/commoncap.c +1 -1
@@ -169,7 +169,7 @@ void cap_bprm_apply_creds (struct linux_/* For init, we want to retain the capabilities set * in the init_task struct. Thus we skip the usual * capability rules */ -if (current->pid !=1 ) { +if (task_pid (current) !=1 ) { current->cap_permitted = new_permitted; current->cap_effective =cap_intersect (new_permitted, bprm->cap_effective);
security/keys/process_keys.c +3 -3
@@ -140,7 +140,7 @@ int install_thread_keyring(struct task_schar buf[20 ];int ret; -sprintf (buf,"_tid.%u" , tsk->pid); +sprintf (buf,"_tid.%u" ,task_pid (tsk)); keyring =keyring_alloc (buf, tsk->uid, tsk->gid,1 ,NULL );if (IS_ERR (keyring)) {
@@ -173,7 +173,7 @@ int install_process_keyring(struct task_int ret;if (!tsk->signal->process_keyring) { -sprintf (buf,"_pid.%u" , tsk->tgid); +sprintf (buf,"_pid.%u" ,task_tgid (tsk)); keyring =keyring_alloc (buf, tsk->uid, tsk->gid,1 ,NULL );if (IS_ERR (keyring)) {
@@ -213,7 +213,7 @@ static int install_session_keyring(struc/* create an empty session keyring */ if (!keyring) { -sprintf (buf,"_ses.%u" , tsk->tgid); +sprintf (buf,"_ses.%u" ,task_tgid (tsk)); keyring =keyring_alloc (buf, tsk->uid, tsk->gid,1 ,NULL );if (IS_ERR (keyring)) {
security/keys/request_key_auth.c +1 -1
@@ -60,7 +60,7 @@ static int request_key_auth_instantiate(else {/* it isn't - use this process as the context */ rka->context = current; - rka->pid = current->pid; + rka->pid =task_pid (current); } rka->target_key =key_get ((struct key *) data);
security/seclvl.c +8 -8
@@ -296,7 +296,7 @@ static struct file_operations passwd_filstatic int seclvl_ptrace (struct task_struct *parent,struct task_struct *child) {if (seclvl >=0 ) { -if (child->pid ==1 ) { +if (task_pid (child) ==1 ) {seclvl_printk (1 ,KERN_WARNING ,"Attempt to ptrace " "the init process dissallowed in " "secure level %d\n" , seclvl);
@@ -313,7 +313,7 @@ static int seclvl_ptrace(struct task_strstatic int seclvl_capable (struct task_struct *tsk,int cap) {/* init can do anything it wants */ -if (tsk->pid ==1 ) +if (task_pid (tsk) ==1 )return 0 ;switch (seclvl) {
@@ -375,10 +375,10 @@ static int seclvl_settime(struct timespe (tv->tv_sec == now.tv_sec && tv->tv_nsec < now.tv_nsec)) {seclvl_printk (1 ,KERN_WARNING ,"Attempt to decrement " "time in secure level %d denied: " -"current->pid = [%d], " -"current->group_leader->pid = [%d]\n" , - seclvl, current->pid, - current->group_leader->pid); +"current pid = [%d], " +"current->group_leader pid = [%d]\n" , + seclvl,task_pid (current), +task_pid (current->group_leader));return -EPERM ; }/* if attempt to decrement time */ }/* if seclvl > 1 */
@@ -424,7 +424,7 @@ static void seclvl_bd_release(struct inostatic int seclvl_inode_permission (struct inode *inode,int mask,struct nameidata *nd) { -if (current->pid !=1 &&S_ISBLK (inode->i_mode) && (mask &MAY_WRITE )) { +if (task_pid (current) !=1 &&S_ISBLK (inode->i_mode) && (mask &MAY_WRITE )) {switch (seclvl) {case 2 : seclvl_printk(1, KERN_WARNING, "Write to block device "
@@ -479,7 +479,7 @@ static void seclvl_file_free_security(st*/ static int seclvl_umount (struct vfsmount *mnt,int flags) { -if (current->pid ==1 ) +if (task_pid (current) ==1 )return 0 ;if (seclvl ==2 ) { seclvl_printk(1, KERN_WARNING, "Attempt to unmount in secure "
security/selinux/avc.c +2 -2
@@ -558,8 +558,8 @@ void avc_audit(u32 ssid, u32 tsid,audit_log_format (ab," for " );if (a && a->tsk) tsk = a->tsk; -if (tsk && tsk->pid) { -audit_log_format (ab," pid=%d comm=" , tsk->pid); +if (tsk &&task_pid (tsk)) { +audit_log_format (ab," pid=%d comm=" ,task_pid (tsk));audit_log_untrustedstring (ab, tsk->comm); }if (a) {
--
RFC PATCH 11/13 Change pid accesses: sound/
In reply to Serge E. HallynReplace-Subject: Change pid accesses: sound/
From: Serge Hallyn <[email protected]>
Change pid accesses for sound drivers.
--- sound/core/control.c | 4 ++-- sound/core/pcm.c | 2 +- sound/core/rawmidi.c | 2 +- sound/core/timer.c | 4 ++-- sound/oss/forte.c | 2 +- sound/pci/korg1212/korg1212.c | 4 ++-- sound/pci/rme9652/hdsp.c | 4 ++-- sound/pci/rme9652/hdspm.c | 4 ++-- sound/pci/rme9652/rme9652.c | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-)
sound/core/control.c +2 -2
@@ -78,7 +78,7 @@ static int snd_ctl_open(struct inode *ininit_waitqueue_head (&ctl->change_sleep);spin_lock_init (&ctl->read_lock); ctl->card = card; - ctl->pid = current->pid; + ctl->pid =task_pid (current); file->private_data = ctl;write_lock_irqsave (&card->ctl_files_rwlock, flags);list_add_tail (&ctl->list, &card->ctl_files);
@@ -781,7 +781,7 @@ static int snd_ctl_elem_lock(snd_ctl_fil result = -EBUSY ; else { vd->owner = file; - vd->owner_pid = current->pid; + vd->owner_pid =task_pid (current); result =0 ; } }
sound/core/pcm.c +1 -1
@@ -754,7 +754,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcdown_read (&card->controls_rwsem);list_for_each (list, &card->ctl_files) { kctl =snd_ctl_file (list); -if (kctl->pid == current->pid) { +if (kctl->pid ==task_pid (current)) { prefer_subdevice = kctl->prefer_pcm_subdevice;break ; }
sound/core/rawmidi.c +1 -1
@@ -423,7 +423,7 @@ static int snd_rawmidi_open(struct inodedown_read (&card->controls_rwsem);list_for_each (list, &card->ctl_files) { kctl =snd_ctl_file (list); -if (kctl->pid == current->pid) { +if (kctl->pid ==task_pid (current)) { subdevice = kctl->prefer_rawmidi_subdevice;break ; }
sound/core/timer.c +2 -2
@@ -1512,10 +1512,10 @@ static int snd_timer_user_tselect(struct err = -EFAULT ; goto __err; } -sprintf (str,"application %i" , current->pid); +sprintf (str,"application %i" ,task_pid (current));if (tselect.id.dev_class !=SNDRV_TIMER_CLASS_SLAVE ) tselect.id.dev_sclass =SNDRV_TIMER_SCLASS_APPLICATION ; - err =snd_timer_open (&tu->timeri, str, &tselect.id, current->pid); + err =snd_timer_open (&tu->timeri, str, &tselect.id,task_pid (current));if (err <0 ) goto __err;
sound/oss/forte.c +1 -1
@@ -1256,7 +1256,7 @@ forte_dsp_open (struct inode *inode, str file->private_data = forte; -DPRINTK ("%s: dsp opened by %d\n" , __FUNCTION__, current->pid); +DPRINTK ("%s: dsp opened by %d\n" , __FUNCTION__,task_pid (current));if (file->f_mode &FMODE_WRITE )forte_channel_init (forte, &forte->play);
sound/pci/korg1212/korg1212.c +2 -2
@@ -1443,7 +1443,7 @@ static int snd_korg1212_playback_open(snspin_lock_irqsave (&korg1212->lock, flags); korg1212->playback_substream = substream; - korg1212->playback_pid = current->pid; + korg1212->playback_pid =task_pid (current); korg1212->periodsize =K1212_PERIODS ; korg1212->channels =K1212_CHANNELS ; korg1212->errorcnt =0 ;
@@ -1475,7 +1475,7 @@ static int snd_korg1212_capture_open(sndspin_lock_irqsave (&korg1212->lock, flags); korg1212->capture_substream = substream; - korg1212->capture_pid = current->pid; + korg1212->capture_pid =task_pid (current); korg1212->periodsize =K1212_PERIODS ; korg1212->channels =K1212_CHANNELS ;
sound/pci/rme9652/hdsp.c +2 -2
@@ -4188,7 +4188,7 @@ static int snd_hdsp_playback_open(snd_pc runtime->dma_area = hdsp->playback_buffer; runtime->dma_bytes =HDSP_DMA_AREA_BYTES ; - hdsp->playback_pid = current->pid; + hdsp->playback_pid =task_pid (current); hdsp->playback_substream = substream;spin_unlock_irq (&hdsp->lock);
@@ -4261,7 +4261,7 @@ static int snd_hdsp_capture_open(snd_pcm runtime->dma_area = hdsp->capture_buffer; runtime->dma_bytes =HDSP_DMA_AREA_BYTES ; - hdsp->capture_pid = current->pid; + hdsp->capture_pid =task_pid (current); hdsp->capture_substream = substream;spin_unlock_irq (&hdsp->lock);
sound/pci/rme9652/hdspm.c +2 -2
@@ -3102,7 +3102,7 @@ static int snd_hdspm_playback_open(snd_pif (hdspm->capture_substream ==NULL )hdspm_stop_audio (hdspm); - hdspm->playback_pid = current->pid; + hdspm->playback_pid =task_pid (current); hdspm->playback_substream = substream;spin_unlock_irq (&hdspm->lock);
@@ -3151,7 +3151,7 @@ static int snd_hdspm_capture_open(snd_pcif (hdspm->playback_substream ==NULL )hdspm_stop_audio (hdspm); - hdspm->capture_pid = current->pid; + hdspm->capture_pid =task_pid (current); hdspm->capture_substream = substream;spin_unlock_irq (&hdspm->lock);
sound/pci/rme9652/rme9652.c +2 -2
@@ -2321,7 +2321,7 @@ static int snd_rme9652_playback_open(sndrme9652_set_thru (rme9652,-1 ,0 ); } - rme9652->playback_pid = current->pid; + rme9652->playback_pid =task_pid (current); rme9652->playback_substream = substream;spin_unlock_irq (&rme9652->lock);
@@ -2381,7 +2381,7 @@ static int snd_rme9652_capture_open(snd_rme9652_set_thru (rme9652,-1 ,0 ); } - rme9652->capture_pid = current->pid; + rme9652->capture_pid =task_pid (current); rme9652->capture_substream = substream;spin_unlock_irq (&rme9652->lock);
--
RFC PATCH 12/13 Change pid accesses: ia64 and mips
In reply to Serge E. HallynReplace-Subject: Change pid accesses: ia64 and mips
From: Serge Hallyn <[email protected]>
Change pid accesses for ia64 and mips architectures.
--- arch/ia64/ia32/ia32_signal.c | 4 arch/ia64/ia32/sys_ia32.c | 6 - arch/ia64/kernel/mca.c | 4 arch/ia64/kernel/mca_drv.c | 2 arch/ia64/kernel/perfmon.c | 158 ++++++++++++++++---------------- arch/ia64/kernel/perfmon_default_smpl.c | 16 +-- arch/ia64/kernel/process.c | 2 arch/ia64/kernel/signal.c | 8 - arch/ia64/kernel/traps.c | 6 - arch/ia64/kernel/unaligned.c | 2 arch/ia64/mm/fault.c | 2 arch/ia64/sn/kernel/xpc_main.c | 2 arch/mips/kernel/irixelf.c | 8 - arch/mips/kernel/irixioctl.c | 4 arch/mips/kernel/irixsig.c | 20 ++-- arch/mips/kernel/process.c | 2 arch/mips/kernel/signal.c | 4 arch/mips/kernel/signal32.c | 4 arch/mips/kernel/signal_n32.c | 2 arch/mips/kernel/sysirix.c | 136 +++++++++++++-------------- arch/mips/kernel/time.c | 2 arch/mips/kernel/traps.c | 2 arch/mips/mm/fault.c | 4 23 files changed, 200 insertions(+), 200 deletions(-)
arch/ia64/ia32/ia32_signal.c +2 -2
@@ -868,7 +868,7 @@ setup_frame_ia32 (int sig, struct k_siga#if 0 printk ("SIG deliver (%s:%d): sig=%d sp=%p pc=%lx ra=%x\n" , - current->comm, current->pid, sig, (void *) frame, regs->cr_iip, frame->pretcode); + current->comm,task_pid (current), sig, (void *) frame, regs->cr_iip, frame->pretcode);#endif return 1 ;
@@ -946,7 +946,7 @@ setup_rt_frame_ia32 (int sig, struct k_s#if 0 printk ("SIG deliver (%s:%d): sp=%p pc=%lx ra=%x\n" , - current->comm, current->pid, (void *) frame, regs->cr_iip, frame->pretcode); + current->comm,task_pid (current), (void *) frame, regs->cr_iip, frame->pretcode);#endif return 1 ;
arch/ia64/ia32/sys_ia32.c +3 -3
@@ -769,7 +769,7 @@ emulate_mmap (struct file *file, unsigneif (flags &MAP_SHARED )printk (KERN_INFO "%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n" , - current->comm, current->pid, start); + current->comm,task_pid (current), start); ret =mmap_subpage (file, start,min (PAGE_ALIGN (start), end), prot, flags, off);if (IS_ERR ((void *) ret))
@@ -782,7 +782,7 @@ emulate_mmap (struct file *file, unsigneif (flags &MAP_SHARED )printk (KERN_INFO "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n" , - current->comm, current->pid, end); + current->comm,task_pid (current), end); ret =mmap_subpage (file,max (start,PAGE_START (end)), end, prot, flags, (off + len) -offset_in_page (end));if (IS_ERR ((void *) ret))
@@ -812,7 +812,7 @@ emulate_mmap (struct file *file, unsigneif ((flags &MAP_SHARED ) && !is_congruent)printk (KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap " -"(addr=0x%lx,off=0x%llx)\n" , current->comm, current->pid, start, off); +"(addr=0x%lx,off=0x%llx)\n" , current->comm,task_pid (current), start, off);DBG ("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n" , pstart, pend, is_congruent ?"congruent" :"not congruent" , poff);
arch/ia64/kernel/mca.c +2 -2
@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt* (swapper or nested MCA/INIT) then use the start of the previous comm * field suffixed with its cpu. */ -if (previous_current->pid) +if (previous_task_pid (current))snprintf (comm,sizeof (comm),"%s %d" , - current->comm, previous_current->pid); + current->comm,previous_task_pid (current));else {int l;if ((p =strchr (previous_current->comm,' ' )))
arch/ia64/kernel/mca_drv.c +1 -1
@@ -124,7 +124,7 @@ void mca_handler_bh(unsigned long paddr) {printk (KERN_DEBUG "OS_MCA: process [pid: %d](%s) encounters MCA.\n" , - current->pid, current->comm); +task_pid (current), current->comm);spin_lock (&mca_bh_lock);switch (mca_page_isolate (paddr)) {
arch/ia64/kernel/perfmon.c +79 -79
593 lines not on this page · raw message
arch/ia64/kernel/perfmon_default_smpl.c +8 -8
@@ -45,11 +45,11 @@ default_validate(struct task_struct *tasint ret =0 ;if (data ==NULL ) { -DPRINT (("[%d] no argument passed\n" , task->pid)); +DPRINT (("[%d] no argument passed\n" ,task_pid (task)));return -EINVAL ; } -DPRINT (("[%d] validate flags=0x%x CPU%d\n" , task->pid, flags, cpu)); +DPRINT (("[%d] validate flags=0x%x CPU%d\n" ,task_pid (task), flags, cpu));/* * must hold at least the buffer header + one minimally sized entry
@@ -89,7 +89,7 @@ default_init(struct task_struct *task, v hdr->hdr_count =0UL ; DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n", - task->pid, + task_pid(task), buf, hdr->hdr_buf_size, sizeof(*hdr),
@@ -111,7 +111,7 @@ default_handler(struct task_struct *taskunsigned char ovfl_notify;if (unlikely (buf ==NULL || arg ==NULL || regs ==NULL || task ==NULL )) { -DPRINT (("[%d] invalid arguments buf=%p arg=%p\n" , task->pid, buf, arg)); +DPRINT (("[%d] invalid arguments buf=%p arg=%p\n" ,task_pid (task), buf, arg));return -EINVAL ; }
@@ -140,7 +140,7 @@ default_handler(struct task_struct *task hdr->hdr_count++; DPRINT_ovfl(("[%d] count=%lu cur=%p last=%p free_bytes=%lu ovfl_pmd=%d ovfl_notify=%d npmds=%u\n", - task->pid, + task_pid(task), hdr->hdr_count, cur, last, last-cur,
@@ -157,7 +157,7 @@ default_handler(struct task_struct *task* system-wide: * - this is not necessarily the task controlling the session */ - ent->pid = current->pid; + ent->pid =task_pid (current); ent->ovfl_pmd = ovfl_pmd; ent->last_reset_val = arg->pmd_last_reset;//pmd[0].reg_last_reset_val;
@@ -169,7 +169,7 @@ default_handler(struct task_struct *task ent->tstamp = stamp; ent->cpu =smp_processor_id (); ent->set = arg->active_set; - ent->tgid = current->tgid; + ent->tgid =task_tgid (current);/* * selectively store PMDs in increasing index number
@@ -246,7 +246,7 @@ default_restart(struct task_struct *taskstatic int default_exit (struct task_struct *task,void *buf,struct pt_regs *regs) { -DPRINT (("[%d] exit(%p)\n" , task->pid, buf)); +DPRINT (("[%d] exit(%p)\n" ,task_pid (task), buf));return 0 ; }
arch/ia64/kernel/process.c +1 -1
@@ -109,7 +109,7 @@ show_regs (struct pt_regs *regs)unsigned long ip = regs->cr_iip +ia64_psr (regs)->ri;print_modules (); -printk ("\nPid: %d, CPU %d, comm: %20s\n" , current->pid,smp_processor_id (), current->comm); +printk ("\nPid: %d, CPU %d, comm: %20s\n" ,task_pid (current),smp_processor_id (), current->comm);printk ("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n" , regs->cr_ipsr, regs->cr_ifs, ip,print_tainted ());print_symbol ("ip is at %s\n" , ip);
arch/ia64/kernel/signal.c +4 -4
@@ -257,7 +257,7 @@ ia64_rt_sigreturn (struct sigscratch *sc#if DEBUG_SIG printk ("SIG return (%s:%d): sp=%lx ip=%lx\n" , - current->comm, current->pid, scr->pt.r12, scr->pt.cr_iip); + current->comm,task_pid (current), scr->pt.r12, scr->pt.cr_iip);#endif /* * It is more difficult to avoid calling this function than to
@@ -270,7 +270,7 @@ ia64_rt_sigreturn (struct sigscratch *sc si.si_signo =SIGSEGV ; si.si_errno =0 ; si.si_code =SI_KERNEL ; - si.si_pid = current->pid; + si.si_pid =task_pid (current); si.si_uid = current->uid; si.si_addr = sc;force_sig_info (SIGSEGV , &si, current);
@@ -375,7 +375,7 @@ force_sigsegv_info (int sig, void __user si.si_signo =SIGSEGV ; si.si_errno =0 ; si.si_code =SI_KERNEL ; - si.si_pid = current->pid; + si.si_pid =task_pid (current); si.si_uid = current->uid; si.si_addr = addr;force_sig_info (SIGSEGV , &si, current);
@@ -448,7 +448,7 @@ setup_frame (int sig, struct k_sigaction#if DEBUG_SIG printk ("SIG deliver (%s:%d): sig=%d sp=%lx ip=%lx handler=%p\n" , - current->comm, current->pid, sig, scr->pt.r12, frame->sc.sc_ip, frame->handler); + current->comm,task_pid (current), sig, scr->pt.r12, frame->sc.sc_ip, frame->handler);#endif return 1 ; }
arch/ia64/kernel/traps.c +3 -3
@@ -107,7 +107,7 @@ die (const char *str, struct pt_regs *reif (++die.lock_owner_depth <3 ) {printk ("%s[%d]: %s %ld [%d]\n" , - current->comm, current->pid, str, err, ++die_counter); + current->comm,task_pid (current), str, err, ++die_counter); (void )notify_die (DIE_OOPS , (char *)str, regs, err,255 ,SIGSEGV );show_regs (regs); }else
@@ -346,7 +346,7 @@ handle_fpu_swa (int fp_fault, struct pt_ ++fpu_swa_count;printk (KERN_WARNING "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n" , - current->comm, current->pid, regs->cr_iip +ia64_psr (regs)->ri, isr); + current->comm,task_pid (current), regs->cr_iip +ia64_psr (regs)->ri, isr); } exception = fp_emulate(fp_fault, bundle, ®s->cr_ipsr, ®s->ar_fpsr, &isr, ®s->pr,
@@ -482,7 +482,7 @@ ia64_fault (unsigned long vector, unsignif (code ==8 ) {# ifdef CONFIG_IA64_PRINT_HAZARDS printk ("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n" , - current->comm, current->pid, + current->comm,task_pid (current), regs.cr_iip +ia64_psr (®s)->ri, regs.pr);# endif return ;
arch/ia64/kernel/unaligned.c +1 -1
@@ -1330,7 +1330,7 @@ ia64_handle_unaligned (unsigned long ifasize_t len; len =sprintf (buf,"%s(%d): unaligned access to 0x%016lx, " -"ip=0x%016lx\n\r" , current->comm, current->pid, +"ip=0x%016lx\n\r" , current->comm,task_pid (current), ifa, regs->cr_iip + ipsr->ri);/* * Don't call tty_write_message() if we're in the kernel; we might
arch/ia64/mm/fault.c +1 -1
@@ -241,7 +241,7 @@ ia64_do_page_fault (unsigned long addres out_of_memory:up_read (&mm->mmap_sem); -if (current->pid ==1 ) { +if (task_pid (current) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
arch/ia64/sn/kernel/xpc_main.c +1 -1
@@ -508,7 +508,7 @@ xpc_activating(void *__partid) ret =sched_setscheduler (current,SCHED_FIFO , ¶m);if (ret !=0 ) {dev_warn (xpc_part,"unable to set pid %d to a realtime " -"priority, ret=%d\n" , current->pid, ret); +"priority, ret=%d\n" ,task_pid (current), ret); }/* allow this thread and its children to run on any CPU */
arch/mips/kernel/irixelf.c +4 -4
@@ -556,9 +556,9 @@ static void irix_map_prda_page(void)return ; pp = (struct prda *) v; - pp->prda_sys.t_pid = current->pid; + pp->prda_sys.t_pid =task_pid (current); pp->prda_sys.t_prid =read_c0_prid (); - pp->prda_sys.t_rpid = current->pid; + pp->prda_sys.t_rpid =task_pid (current);/* We leave the rest set to zero */ }
@@ -1148,11 +1148,11 @@ static int irix_core_dump(long signr, st prstatus.pr_info.si_signo = prstatus.pr_cursig = signr; prstatus.pr_sigpend = current->pending.signal.sig[0 ]; prstatus.pr_sighold = current->blocked.sig[0 ]; - psinfo.pr_pid = prstatus.pr_pid = current->pid; + psinfo.pr_pid = prstatus.pr_pid =task_pid (current); psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; psinfo.pr_pgrp = prstatus.pr_pgrp =process_group (current); psinfo.pr_sid = prstatus.pr_sid = current->signal->session; -if (current->pid == current->tgid) { +if (task_pid (current) ==task_tgid (current)) {/* * This is the record for the group leader. Add in the * cumulative times of previous dead threads. This total
arch/mips/kernel/irixioctl.c +2 -2
@@ -62,7 +62,7 @@ asmlinkage int irix_ioctl(int fd, unsignint i, error =0 ;#ifdef DEBUG_IOCTLS -printk ("[%s:%d] irix_ioctl(%d, " , current->comm, current->pid, fd); +printk ("[%s:%d] irix_ioctl(%d, " , current->comm,task_pid (current), fd);#endif switch (cmd) {case 0x00005401 :
@@ -236,7 +236,7 @@ asmlinkage int irix_ioctl(int fd, unsignsys_write (2 , msg,strlen (msg));set_fs (old_fs);printk ("[%s:%d] Does unimplemented IRIX ioctl cmd %08lx\n" , - current->comm, current->pid, cmd); + current->comm,task_pid (current), cmd);do_exit (255 );#else error =sys_ioctl (fd, cmd, arg);
arch/mips/kernel/irixsig.c +10 -10
@@ -232,7 +232,7 @@ irix_sigreturn(struct pt_regs *regs) sig = (int ) regs->regs[base +6 ];#ifdef DEBUG_SIG printk ("[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])\n" , - current->comm, current->pid, context, magic, sig); + current->comm,task_pid (current), context, magic, sig);#endif if (!context) context = magic;
@@ -473,7 +473,7 @@ asmlinkage int irix_sigpoll_sys(unsigned#ifdef DEBUG_SIG printk ("[%s:%d] irix_sigpoll_sys(%p,%p,%p)\n" , - current->comm, current->pid, set, info, tp); + current->comm,task_pid (current), set, info, tp);#endif /* Must always specify the signal set. */
@@ -586,7 +586,7 @@ repeat: tsk = current;list_for_each (_p,&tsk->children) { p = list_entry(_p,struct task_struct,sibling); -if ((type ==IRIX_P_PID ) && p->pid != pid) +if ((type ==IRIX_P_PID ) &&task_pid (p) != pid)continue ;if ((type ==IRIX_P_PGID ) &&process_group (p) != pid)continue ;
@@ -613,7 +613,7 @@ repeat: retval =__put_user (SIGCHLD , &info->sig); retval |=__put_user (0 , &info->code); - retval |=__put_user (p->pid, &info->stuff.procinfo.pid); + retval |=__put_user (task_pid (p), &info->stuff.procinfo.pid); retval |=__put_user ((p->exit_code >>8 ) &0xff , &info->stuff.procinfo.procdata.child.status); retval |=__put_user (p->utime, &info->stuff.procinfo.procdata.child.utime);
@@ -631,7 +631,7 @@ repeat:getrusage (p,RUSAGE_BOTH , ru); retval =__put_user (SIGCHLD , &info->sig); retval |=__put_user (1 , &info->code);/* CLD_EXITED */ - retval |=__put_user (p->pid, &info->stuff.procinfo.pid); + retval |=__put_user (task_pid (p), &info->stuff.procinfo.pid); retval |=__put_user ((p->exit_code >>8 ) &0xff , &info->stuff.procinfo.procdata.child.status); retval |= __put_user(p->utime,
@@ -701,7 +701,7 @@ asmlinkage int irix_getcontext(struct pt#ifdef DEBUG_SIG printk ("[%s:%d] irix_getcontext(%p)\n" , - current->comm, current->pid, ctx); + current->comm,task_pid (current), ctx);#endif if (!access_ok (VERIFY_WRITE , ctx,sizeof (*ctx)));
@@ -749,7 +749,7 @@ asmlinkage void irix_setcontext(struct p#ifdef DEBUG_SIG printk ("[%s:%d] irix_setcontext(%p)\n" , - current->comm, current->pid, ctx); + current->comm,task_pid (current), ctx);#endif if (!access_ok (VERIFY_READ , ctx,sizeof (*ctx)))
@@ -806,7 +806,7 @@ asmlinkage int irix_sigstack(struct irix {#ifdef DEBUG_SIG printk ("[%s:%d] irix_sigstack(%p,%p)\n" , - current->comm, current->pid, new, old); + current->comm,task_pid (current), new, old);#endif if (new) {if (!access_ok (VERIFY_READ , new,sizeof (*new)))
@@ -828,7 +828,7 @@ asmlinkage int irix_sigaltstack(struct i {#ifdef DEBUG_SIG printk ("[%s:%d] irix_sigaltstack(%p,%p)\n" , - current->comm, current->pid, new, old); + current->comm,task_pid (current), new, old);#endif if (new)if (!access_ok (VERIFY_READ , new,sizeof (*new)))
@@ -852,7 +852,7 @@ asmlinkage int irix_sigsendset(struct irreturn -EFAULT ;#ifdef DEBUG_SIG printk ("[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)\n" , - current->comm, current->pid, + current->comm,task_pid (current), pset->cmd, pset->ltype, pset->lid, pset->rtype, pset->rid, sig);#endif
arch/mips/kernel/process.c +1 -1
@@ -170,7 +170,7 @@ int copy_thread(int nr, unsigned long cl }#endif childregs->regs[2 ] =0 ;/* Child gets zero as return value */ - regs->regs[2 ] = p->pid; + regs->regs[2 ] =task_pid (p);if (childregs->cp0_status &ST0_CU0 ) { childregs->regs[28 ] = (unsigned long ) ti;
arch/mips/kernel/signal.c +2 -2
@@ -314,7 +314,7 @@ int setup_frame(struct k_sigaction * ka,#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n" , - current->comm, current->pid, + current->comm,task_pid (current), frame, regs->cp0_epc, frame->regs[31 ]);#endif return 1 ;
@@ -374,7 +374,7 @@ int setup_rt_frame(struct k_sigaction *#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n" , - current->comm, current->pid, + current->comm,task_pid (current), frame, regs->cp0_epc, regs->regs[31 ]);#endif return 1 ;
arch/mips/kernel/signal32.c +2 -2
@@ -691,7 +691,7 @@ int setup_frame_32(struct k_sigaction *#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n" , - current->comm, current->pid, + current->comm,task_pid (current), frame, regs->cp0_epc, frame->sf_code);#endif return 1 ;
@@ -762,7 +762,7 @@ int setup_rt_frame_32(struct k_sigaction#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n" , - current->comm, current->pid, + current->comm,task_pid (current), frame, regs->cp0_epc, frame->rs_code);#endif return 1 ;
arch/mips/kernel/signal_n32.c +1 -1
@@ -181,7 +181,7 @@ int setup_rt_frame_n32(struct k_sigactio#if DEBUG_SIG printk ("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%p\n" , - current->comm, current->pid, + current->comm,task_pid (current), frame, regs->cp0_epc, regs->regs[31 ]);#endif return 1 ;
arch/mips/kernel/sysirix.c +68 -68
523 lines not on this page · raw message
arch/mips/kernel/time.c +1 -1
@@ -409,7 +409,7 @@ static long last_rtc_update;*/ void local_timer_interrupt (int irq,void *dev_id,struct pt_regs *regs) { -if (current->pid) +if (task_pid (current))profile_tick (CPU_PROFILING , regs);update_process_times (user_mode (regs)); }
arch/mips/kernel/traps.c +1 -1
@@ -267,7 +267,7 @@ void show_registers(struct pt_regs *regsshow_regs (regs);print_modules ();printk ("Process %s (pid: %d, threadinfo=%p, task=%p)\n" , - current->comm, current->pid,current_thread_info (), current); + current->comm,task_pid (current),current_thread_info (), current);show_stack (current, (long *) regs->regs[29 ]);show_trace (current, (long *) regs->regs[29 ]);show_code ((unsigned int *) regs->cp0_epc);
arch/mips/mm/fault.c +2 -2
@@ -43,7 +43,7 @@ asmlinkage void do_page_fault(struct pt_#if 0 printk ("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n" ,smp_processor_id (), - current->comm, current->pid, field, address, write, + current->comm,task_pid (current), field, address, write, field, regs->cp0_epc);#endif
@@ -172,7 +172,7 @@ no_context:*/ out_of_memory:up_read (&mm->mmap_sem); -if (tsk->pid ==1 ) { +if (task_pid (tsk) ==1 ) {yield ();down_read (&mm->mmap_sem); goto survive;
--
Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
Quoted 6 lines · Serge E. Hallyn
Index:
linux-2.6.15-rc1/arch/ia64/kernel/mca.c
===================================================================arch/ia64/kernel/mca.c +0
-0@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt* (swapper or nested MCA/INIT) then use the start of the previous comm
arch/ia64/kernel/mca.c ia64_mca_modify_original_stack(struct pt · line 763
Quoted 10 lines
arch/ia64/kernel/mca.c +2
-2* field suffixed with its cpu. */ -if (previous_current->pid) +if (previous_task_pid (current))snprintf (comm,sizeof (comm),"%s %d" , - current->comm, previous_current->pid); + current->comm,previous_task_pid (current));else {int l;if ((p =strchr (previous_current->comm,' ' )))
That makes no sense, previous_task_pid() is not defined anywhere. Looks like a global edit error and should probably be task_pid(previous_current).
Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
Quoted 14 lines · Keith Owens
Quoted 12 lines · Serge E. Hallyn
Index:
linux-2.6.15-rc1/arch/ia64/kernel/mca.c
===================================================================arch/ia64/kernel/mca.c +1
-2@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt* (swapper or nested MCA/INIT) then use the start of the previous comm * field suffixed with its cpu. */ -if (previous_current->pid) +if (previous_task_pid (current)) snprintf(comm, sizeof(comm), "%s %d", - current->comm, previous_current->pid);
Quoted 8 lines
arch/ia64/kernel/mca.c ia64_mca_modify_original_stack(struct pt · line 763
Quoted 4 lines
arch/ia64/kernel/mca.c +1
-0+ current->comm, previous_task_pid(current)); else {int l;if ((p =strchr (previous_current->comm,' ' )))That makes no sense,
previous_task_pid()is not defined anywhere. Looks like a global edit error and should probably betask_pid(previous_current).
Yup, sure is.
thanks,
-serge
Re: [RFC] [PATCH 12/13] Change pid accesses: ia64 and mips
In reply to Keith OwensQuoted 14 lines · Keith Owens
Quoted 12 lines · Serge E. Hallyn
Index:
linux-2.6.15-rc1/arch/ia64/kernel/mca.c
===================================================================arch/ia64/kernel/mca.c +1
-2@@ -755,9 +755,9 @@ ia64_mca_modify_original_stack(struct pt* (swapper or nested MCA/INIT) then use the start of the previous comm * field suffixed with its cpu. */ -if (previous_current->pid) +if (previous_task_pid (current)) snprintf(comm, sizeof(comm), "%s %d", - current->comm, previous_current->pid);
Quoted 8 lines
arch/ia64/kernel/mca.c ia64_mca_modify_original_stack(struct pt · line 763
Quoted 4 lines
arch/ia64/kernel/mca.c +1
-0+ current->comm, previous_task_pid(current)); else {int l;if ((p =strchr (previous_current->comm,' ' )))That makes no sense,
previous_task_pid()is not defined anywhere. Looks like a global edit error and should probably betask_pid(previous_current).
Note there are a few more ia64 errors - working on a test compile now and will send out a new patch, though i don't have the hw to boot-test.
thanks,
-serge
RFC PATCH 13/13 Define new task_pid api
In reply to Serge E. HallynReplace-Subject: Define new task_pid api
From: Serge Hallyn <[email protected]>
Actually define the task_pid() and task_tgid() functions. Also replace pid with __pid so as to make sure any missed accessors are caught.
The resulting object code seems to be identical in most cases, and is actually shorter in cases where current->pid is used twice in a row, as it does not dereference task-> twice.
--- include/linux/sched.h | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
include/linux/sched.h +13 -3
@@ -733,8 +733,8 @@ struct task_struct {/* ??? */ unsigned long personality; unsigned did_exec:1; -pid_t pid; -pid_t tgid; +pid_t __pid; +pid_t __tgid;/* * pointers to (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with
@@ -878,6 +878,16 @@ static inline int pid_alive(struct task_return p->pids[PIDTYPE_PID ].nr !=0 ; } +static inline pid_t task_pid (const struct task_struct *p) +{ +return p->__pid; +} + +static inline pid_t task_tgid (const struct task_struct *p) +{ +return p->__tgid; +} +extern void free_task (struct task_struct *tsk);extern void __put_task_struct (struct task_struct *tsk);#define get_task_struct (tsk) do { atomic_inc(&(tsk)->usage); } while(0)
@@ -1202,7 +1212,7 @@ extern void wait_task_inactive(task_t *extern task_t *FASTCALL (next_thread (const task_t *p)); -#define thread_group_leader (p) (p->pid == p->tgid) +#define thread_group_leader (p) (task_pid(p) == task_tgid(p))static inline int thread_group_empty (task_t *p) {
--
How about adding the accessor routines in the first patch (still referencing task->pid), then doing all the changes as you did, then renaming task->pid to task->__pid and updating the accessor to that change, in the last patch? Then it would build all the way through.
Quoted 3 lines · Serge
The resulting object code seems to be identical in most cases, and is actually shorter in cases where
current->pidis used twice in a row, as it does not dereference task-> twice.
You lost me here. Why does using these accessor routines avoid the second reference?
Have you crosstool'd built this for most arch's? I could imagine some piece of code having a local or other struct variable named 'pid' that would be broken by a mistake in this change. This could be so whether the change was done by a script, or by hand. Probably need to test 'allyesconfig' too.
Quoted 2 lines
Note that this does not change the kernel's
internal idea of pids, only what users see.
How can that be? Doesn't it run all accesses to the task->pid field through the accessor, regardless of whether it's something the user will see, or something used within the kernel?
How about other fields holding a pid, such as (one I happen to know about) kernel/cpuset.c marker_pid? Grep for "pid_t" in include/linux for other such possible fields. What about other kerel-user interfaces that deal with pids such as fcntl, msgctl, sched_setaffinity, semop, shmctl, sigaction, ...
How do you propose to synchronize incoming pid's with these potentially modified displayed pids? There many invocations of find_task_by_pid() in the kernel, typically converting a user provided pid into a task struct. If doing "kill(getpid(), 1)" in user code didn't sighup myself, that would be uncool.
How do you intend to use these accessor routines in order to help solve the problems with checkpoint/restart?
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Paul Jackson
How about adding the accessor routines in the first patch (still referencing
task->pid), then doing all the changes as you did, then renamingtask->pidtotask->__pidand updating the accessor to that change, in the last patch? Then it would build all the way through.
Ok, thanks - will send out a new patchset to do this.
Quoted 8 lines
Quoted 3 lines · Serge
The resulting object code seems to be identical in most cases, and is actually shorter in cases where
current->pidis used twice in a row, as it does not dereference task-> twice.You lost me here. Why does using these accessor routines avoid the second reference?
Why, I don't know :) I just looked at the resulting object code, and the static inline causes task->pid to be dereferenced once and pushed twice, whereas using task->pid causes it to be dereferenced twice.
Quoted 1 line
Have you crosstool'd built this for most arch's? I could imagine
No - I've never used crosstool, but will it a shot.
Quoted 6 lines
Quoted 2 lines
Note that this does not change the kernel's
internal idea of pids, only what users see.How can that be? Doesn't it run all accesses to the
task->pidfield through the accessor, regardless of whether it's something the user will see, or something used within the kernel?
Ok... our intent is to not change the kernel pid concept :) Of course the accessor functions could be coded so as to change it, but as far as I know we will not do so.
Quoted 5 lines
How about other fields holding a pid, such as (one I happen to know about)
kernel/cpuset.cmarker_pid? Grep for "pid_t" ininclude/linuxfor other such possible fields. What about other kerel-user interfaces that deal with pids such as fcntl, msgctl,sched_setaffinity, semop, shmctl, sigaction, ...
Yes, our next patchset will introduce the actual pid to vpid translations and place those functions in the right place. What I meant to say was that the kernel pids will still be pids just as they are now. The barrier between virtual pids and pids does not yet exist in this patchset. This patchset is to lay the groundwork to make those translations simpler. We switch task_pid() to task_vpid() in the right places, and use task_pid_to_vpid() at the barriers between pids and vpids.
Quoted 3 lines
How do you propose to synchronize incoming pid's with these potentially modified displayed pids? There many invocations of
find_task_by_pid()in the kernel, typically converting a user provided pid into a task
These are replaced with find_task_by_vpid(), which looks for a the given vpid in the pid-space of the calling process.
Quoted 5 lines
struct. If doing "
kill(getpid(), 1)" in user code didn't sighup myself, that would be uncool.How do you intend to use these accessor routines in order to help solve the problems with checkpoint/restart?
Let's say we want to start a process group. Start the first process in a new pidspace. (Hubertus or Dave can tell use exactly how this will be done in the first prototype, but I would expect something like
echo 5 > /proc/$$/childpidspace
start_my_program # This forks, and its children remain in pidspace 5
)
Now the processes in pidspace 5 are checkpointed and killed. When they are restarted, they will create a new pidspace for the group again, and ask for their checkpointed pids within that pidspace. Their kernelpids will still be the same pid it would have been. But when one of the processes looks for process 10, task_vpid_to_pid(current, 10) will return the real pid for the vpid 10 in current's pidspace.
thanks,
-serge
Quoted 1 line · Serge
Ok, thanks - will send out a new patchset to do this.
This one change probably isn't worth new patches.
At least keep this in mind next time. No biggie
either way.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 3 lines · Serge
But when one of the
processes looks for process 10,task_vpid_to_pid(current, 10)will return the real pid for the vpid 10 in current's pidspace.
So a "kill -1 10" will mean different things, depending on the pidspace that the kill is running in. And pid's passed about between user tasks as if they were usable system-wide are now aliased by their invisible pidspace.
Yuck. Such virtualizations usually have a much harder time addressing the last 10% of situations than they did the easy 90%.
How about instead having a way to put the pid's of checkpointed tasks in deep freeze, saving them for reuse when the task restarts?
System calls that operate on pid values could error out with some new errno, -EFROZEN or some such.
This would seem far less invasive. Not just less invasive of the code, but more importantly, not introducing some never entirely realizable semantic change to the scope of pids.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 5 lines · Paul Jackson
Quoted 3 lines · Serge
But when one of the
processes looks for process 10,task_vpid_to_pid(current, 10)will return the real pid for the vpid 10 in current's pidspace.
Quoted 7 lines
So a "kill -1 10" will mean different things, depending on the pidspace that the kill is running in. And pid's passed about between user tasks as if they were usable system-wide are now aliased by their invisible pidspace.
Yuck. Such virtualizations usually have a much harder time addressing the last 10% of situations than they did the easy 90%.
For simplicity, the only pids a process will see are those in its own pidspace, and the only controls (I expect) will be the ability to start a new pidspace, and request a pid. So it is no more complicated than the vserver model, where a process becomes pid 1 only for other proceses in the same vserver, and process don't see processes in other vservers - except that now every process in the pidspace can be known as a different pid, not just the first.
Quoted 4 lines
How about instead having a way to put the pid's of checkpointed tasks in deep freeze, saving them for reuse when the task restarts? System calls that operate on pid values could error out with some new errno,
-EFROZENor some such.
Unfortunately that would not work for checkpoints across boots, or, more importantly, for process (set) migration.
Quoted 3 lines
This would seem far less invasive. Not just less invasive of the code, but more importantly, not introducing some never entirely realizable semantic change to the scope of pids.
Hopefully the next patchset, implementing the pid-vpid split, will show it's not as complicated as I've made it sound.
Of course, if it remains too complicated a conceptual change to be mergeable, we're better off knowing that now...
thanks,
-serge
Quoted 1 line · Serge
the vserver model
What's that?
Quoted 1 line
Unfortunately that would not work for checkpoints across boots,
That could be made to work, by an early init script that looked in the "checkedpointed tasks storage locker" on disk, and reserved any pid's used therein, marking them as frozen. A little care can ensure that no task with such a pid is already running.
Quoted 1 line
or, more importantly, for process (set) migration.
Migration to a system that has already been up a while, where no reservation of pid's was made ahead of time, hence where pid's overlap, would not work with my EFROZEN scheme - you are right there.
How large is our numeric pid space (on 64 bit systems, anyway)? If large enough, then reservation of pid ranges becomes an easy task. If say we had 10 bits to spare, then a server farm could pre-ordain say a thousand virtual servers, which come and go on various hardware systems, each virtual server with its own hostname, pid-range, and other such paraphernalia.
However there is an elephant in the room, or a camel outside the tent or some such. Yes, the camel's nose may well fit inside the tent, but before we invite his nose, we should have some idea if the rest of the camel will fit.
In other words, since I don't see any compelling reason for this virtualization of pids -except- for checkpoint/restart sorts of features, the usefulness of pid virtualization would seem to rest on the acceptability of the rest of the checkpoint/restart proposal.
For all I know now (not much) the amount of effort required to sufficiently virtualize all the elements of the Linux kernel-user interface enough to enable robust job migration across machines and reboots may well make virtualizing the kernel's address space look easy. Linux is not VM.
Hence, until sold on the larger direction, I am skeptical of this first step.
Though, I will grant, I am interested too. A good Linux checkpoint/restart solution would be valuable.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Paul Jackson
Quoted 1 line · Serge
the vserver model
What's that?
:) Well a vserver pretends to be a full system of its own, though you can have lots of vservers on one machine. Processes in each virtual server see only other processes in the same vserver. However in vserver the pids they see are the real kernel pids - except for one process per vserver which can be the fakeinit. Other processes in the same vserver see it as pid 1, but to the kernel it is still known by its real pid.
Quoted 6 lines
How large is our numeric pid space (on 64 bit systems, anyway)? If large enough, then reservation of pid ranges becomes an easy task. If say we had 10 bits to spare, then a server farm could pre-ordain say a thousand virtual servers, which come and go on various hardware systems, each virtual server with its own hostname, pid-range, and other such paraphernalia.
In fact this is one way we considered implementing the virtual pids - the pidspace id would be the upper some bits of the pid, and the vpid would be the lower bits, so that the kernel pid would simply be (pidspace_id << some_shift | vpid).
-serge
Quoted 1 line · Serge
Well a vserver pretends to be a full system of its own
Do you have any references, links?
Quoted 1 line
In fact this is one way we considered implementing the virtual pids -
No no - not what I meant. I meant to have the pid be the same in all views, for all time, kernel and user, inside and outside the virtual server. Just like pids are now. A given virtual server would have a dedicated range of pids, reserved for it on all hardware systems in the farm.
You could move the tasks in one such virtual server from one hardware system to another without having pid collisions because the destination hardware system would have been reserving those pids all along for that virtual server.
The additional kernel facilities this would require:
1) For a given task (inherited) designate which pid range to use for newly forked children.
2) Restart a task into the same pid it had before, which would fail if that pid was in use by any other task on the system.
Administratively, create named virtual servers, each one assigned a permanent pid range. On each hardware system, each task would be managed to be using pids for forking from the pid range for the virtual server it was running in.
Perhaps each hardware system would have one pid range, say pids 0..2000, overlapping with all other such systems, for tasks specific to that hardware system. These tasks could not be checkpoint/restarted on another hardware system.
For example, the virtual server "magnolia" would always have pids 9,000 to 9,999, and all hardware systems in the server farm would keep this pid range open for running "magnolia", if asked to. If you saw a tasks pid was 9.543, then you would immediately know it ran on virtual server "magnolia."
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Paul Jackson
Quoted 1 line · Serge
Well a vserver pretends to be a full system of its own
Do you have any references, links?
Oh - linux-vserver.org
Quoted 7 lines
Quoted 1 line
In fact this is one way we considered implementing the virtual pids -
No no - not what I meant. I meant to have the pid be the same in all views, for all time, kernel and user, inside and outside the virtual server. Just like pids are now. A given virtual server would have a dedicated range of pids, reserved for it on all hardware systems in the farm.
But in the end isn't that more complicated than our approach? The kernel still needs to be modified to let processes request their pids, and now processes have to worry *always* about the value or range of their pids, both at startup and restart. In the pidspace approach, processes simply have a concept of starting a new pidspace, after which the rest of the system processes are effectively gone as far as this pidspace is concerned, and, other than that, processes continue as normal. Upon restart, they do have to reclaim their vpids, either from userspace, or through in-kernel restart code.
-serge
Quoted 2 lines
But in the end isn't that more complicated than our approach? The kernel still needs to be modified to let processes request their pids,
No - getpid() works, as always. Perhaps I don't understand your comment.
Quoted 2 lines
and now processes have to worry *always* about the value or range of their pids, both at startup and restart.
No - tasks get the pid the kernel gives them at fork, as always. The task keeps that exact same pid, across all checkpoints, restarts and migrations. Nothing that the application process has to worry about, either inside the kernel code or in userspace, beyond the fork code honoring the assigned pid range when allocating a new pid.
No wide spread kernel code change, compared to yours. As now, tasks have a pid field, and that pid is the same value, system-wide.
An additional per-task attribute, set by a batch manager typically when it starts a job on a checkpointable, restartable, movable "virtual server" connects the job parent task, and hence all its descendents in that job, with a named kernel object that has among its attributes a pid range. When fork is handing out new pids, it honors that pid range. User level code, in the batch manager or system administration layer manages a set of these named virtual servers, including assigning pid ranges to them, and puts what is usually the same such configuration on each server in the farm.
There will likely be other system-wide or job-wide name spaces and associated resources that will need to be preserved across these operations, such as shared memory, ipc, sockets, tmp files, signals, locking, shared file descriptors, process tree, permissions, ulimits, accounting, ... For each system-wide namespace, give each virtual server a dedicated portion of that space, the same across all servers in the farm. Where those names are kernel assigned, such as pids, teach the kernel to assign within the specified portion, such as the assigned pid range.
The real complexity comes, I claim, from changing the pid from a system-wide name space to a partially per-job namespace. You can never do that conversion entirely and will always have confusions around the edges, as pids relative to one virtual server are used, incorrectly, in the environment of another virtual server or system wide.
The difficulty of things is best not measured by the effort to do the first 90%, but by the effort to do the last 10%. And when trying to reconcile two irreconcilable concepts, that last 10% can never be completed.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 5 lines · Paul Jackson
No - tasks get the pid the kernel gives them at fork, as always. The task keeps that exact same pid, across all checkpoints, restarts and migrations. Nothing that the application process has to worry about, either inside the kernel code or in userspace, beyond the fork code honoring the assigned pid range when allocating a new pid.
The main issues I worry about with such a static allocation scheme are getting the allocation patterns right, without causing new restrictions on the containers. This kind of scheme is completely thrown out the window if someone wanted to start a process on their disconnected laptop and later migrate it to another machine when they connect back up to the network.
Quoted 6 lines
The real complexity comes, I claim, from changing the pid from a system-wide name space to a partially per-job namespace. You can never do that conversion entirely and will always have confusions around the edges, as pids relative to one virtual server are used, incorrectly, in the environment of another virtual server or system wide.
You're basically concerned about pids "leaking" across containers, and confusing applications in the process? That's a pretty valid concern. However, the long-term goal here is to virtualize more than pids. As you noted, this will include thing like shm ids. Yes, I worry that we'll end up modifying a _ton_ of stuff in the process of doing this.
As for passing confusing pids from different namespaces in the filesystem, like in /var/run, there are solutions in the pipeline. Private namespaces and versioned filesystems should be able to cope with this kind of isolation very nicely.
-- Dave
Well ... from your response, Dave, I think you understood what I was saying. Thanks.
Quoted 3 lines
The main issues I worry about with such a static allocation scheme are getting the allocation patterns right, without causing new restrictions on the containers.
Yes - the basic problem with pre-allocating static containers is that you have to pre-allocate them ;).
Quoted 4 lines
This kind of scheme is completely thrown out the
window if someone wanted to start a process on their disconnected laptop and later migrate it to another machine when they connect back up to the network.
Transparent relocation without anticipating and preparing in _some_ way for that relocation prior to starting the job has the potential to be one of those "Just say no to crazy requirements" moments. I am sure some marketing folks don't agree.
Quoted 2 lines
You're basically concerned about pids "leaking" across containers, and confusing applications in the process? That's a pretty valid concern.
Partly that, yes. Pids have been a system-wide notion since forever. They get buried in lots of places and uses.
There is a natural tendency in these virtualization efforts to put blinders on, and be encouraged by the potential ease of solving the first 80% or 90% of the problem.
The kernel needs to be clear and consistent in what notions it supports, avoiding getting caught between two inconsistent models without a clear definition of which model applies when.
Quoted 1 line
we'll end up modifying a _ton_ of stuff in the process of doing this.
That's the kicker. Pid remapping seems useless by itself unless the rest of this stuff is modified as well, to make a workable solution. I'm looking for the larger design, before deciding on individual patches.
My intuition is that somehow or other, jobs that have the potential to be restarted or relocated have to start their life in a container that isolates them.
My mind is wandering now to something Xen like, perhaps. Something Open Source, available to us all, but with key virtualizations in middleware rather then the kernel. See also the results of a Google search on "checkpoint restart comparison zap" and the pods of Zap:
http://www.cs.cmu.edu/~sosman/publications/osdi2002/ZAP-OSDI.html.
This Zap paper is a good example of the design overview required to motivate the individual patches needed to provide such a solution. Their pod construct is not exactly what I was concocting in my replies on this thread so far, but is far better thought out and more persuasive, even to me.
A proposal that integrated a next generation Zap into the kernel would be most interesting. We don't have to keep it isolated to a loadable kernel module that hacks the system call table, which may give us leverage on improving it in other ways.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 5 lines · Paul Jackson
No - tasks get the pid the kernel gives them at fork, as always. The task keeps that exact same pid, across all checkpoints, restarts and migrations. Nothing that the application process has to worry about, either inside the kernel code or in userspace, beyond the fork code honoring the assigned pid range when allocating a new pid.
Paul, this approach seems very risky at best. How do you checkpoint, stop, reboot the system, and restart? Does the system recall that a checkpoint occured and then reserve those from early in boot? What about a checkpointed task which is completed on a different system? How is that handled? What if the checkpointed and terminated task is deemed not worth restarting, how do you inform the system to reuse the pids. Just seems like a hornets nest.
I would think _for_pids_and_not_everything, the checkpoint could write out the core file and a restart file. The restart file would contain the pid related information. Then the restart tool could use a preloader to intercept system calls that specify pids and translate pids from old to new. It might not be as easy as using the kernel, but it makes some sense to from my limited point of view and makes the kernel code less polluted.
Robin
Quoted 7 lines · Paul Jackson
Quoted 2 lines
But in the end isn't that more complicated than our approach? The kernel still needs to be modified to let processes request their pids,
No -
getpid()works, as always. Perhaps I don't understand your comment.
Quoted 8 lines
Quoted 2 lines
and now processes have to worry *always* about the value or range of their pids, both at startup and restart.
No - tasks get the pid the kernel gives them at fork, as always. The task keeps that exact same pid, across all checkpoints, restarts and migrations. Nothing that the application process has to worry about, either inside the kernel code or in userspace, beyond the fork code honoring the assigned pid range when allocating a new pid.
Ok, so we have fork code to dole out pid ranges per vserver, I see where the app doesn't need to request a pid on startup. But what about restart? Surely the app still needs to be restarted with the same pid - just that now we are more trusting that the pid remains available bc of the pid ranges?
Quoted 1 line
No wide spread kernel code change, compared to yours. As now, tasks
Note that while the patch is large, so far its main purpose is to introduce a clean concept rather than hack the vpid idea in. The latter has beem done before, and only requires intercepting the points where pids go from user to kernel. This leaves the question of which pid is which more ambiguous.
-serge
Quoted 2 lines · Serge E. Hallyn
Quoting Paul Jackson ([email protected]):
There have been a few suggestions going fro and back. Let me address them all at once.
(A) why a vpid?
For transparent checkpointing. Vserver for instance has not implemented a checkpoint/restart yet, because without this concept it is not possible. The moment you want transparent checkpoint, you need to deal with the fact that the results of a getpid() are in register (worst case) and upon restart the system must provide the same pid on the different machine. That immediately suggest pid range reservation... but see point (B) below.
(B) syscall interception and LD_PRELOAD:
In principle that is possible, but it leads to potentially inefficient code and at large leaves the issue of pid space creation and migration on the table. However it makes clear that as long as I keep the transformation or mappings consistent between virtual and real, that this is a quite useful concept.
The question now is how deep into the kernel do I have to drive it in order to create an efficient implementation.
(C) Fixed PID range allocation:
That is completely unscalable and unnecessary:
First PID range allocation at a global level (e.g. cluster level) requires some agent. Given that PID_MAX ~ 2**22 leaves us on 32-bit architectures with only 512 pidspaces (negative range needs to be preserved I think).
However it is not unreasonable to assume that 512 different pidspaces per OS image is not a restriction.
Hence, when a pidspace is migrated it will be assigned a different pidspace id.
Then going with kernelpid = (pidspace_id << 22) | vpid is an efficient means to
map between virtual pidspace and physical pidspace and vice versa.
All that needs to be managed is local pidspace allocation.
The translations from vpid <-> pid are very light weight as can be seen from the above composition.
Take for example the vserver system. A local vserver agent could maintain the pidspace allocation. On creation of a vserver it assigns the next available pidspace. That pidspace id is internal to vserver and is not exported as a property of a vserver. When a vserver is migrated to a different machine, a potentially different pidspace is allocate, yet all the vpids remain the same.
(D) Cross compilation
I do all stuff on s390 so that space is covered.
If I missed some of the issues that were raised let me know and we will try to address those.
I am part of Serge's team and have been working on intercepting the various places where virtual to real pid translations have to occur in the kernel. It's still in pretty bad shape, but it boots for the default pid space (:- ). Of my head I say there are about 40 places each to do the translation. Many are in the /proc/fs, some in the signal handling
I hope by end of the week I have something to post that gives idea how we are thinking this could be realized.
I don't think that the checkpoint/restart/relocation design should be driven by mico-optimizations of getpid(). It needs to be driven by a design that addresses (for better or worse) the many larger questions encountered in such an effort.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 5 lines · Paul Jackson
I don't think that the checkpoint/restart/relocation design should be driven by mico-optimizations of
getpid(). It needs to be driven by a design that addresses (for better or worse) the many larger questions encountered in such an effort.
Neither did we suggest one.
My note, was simply addressing some of the issues that were thrown out with the alternative articulated in the many responses.
-- Hubertus
Quoted 9 lines · Paul Jackson
An additional per-task attribute, set by a batch manager typically when it starts a job on a checkpointable, restartable, movable "virtual server" connects the job parent task, and hence all its descendents in that job, with a named kernel object that has among its attributes a pid range. When fork is handing out new pids, it honors that pid range. User level code, in the batch manager or system administration layer manages a set of these named virtual servers, including assigning pid ranges to them, and puts what is usually the same such configuration on each server in the farm.
I guess the one thing I really don't see supported here (apart from the system/laptop joins the network after spawning a job which has been mentioned) is restarting multiple simulatenous instances of a single checkpoint. In the pidspace approach, each restarted instance would have a different pidspace id, but use the same vpids. In the preallocation scheme, only one pid has been reserved at checkpoint for each process instance.
Is there a simple way to solve this? (And how valid a concern is this? :)
Other than that, I guess your approach is growing on me...
-serge
Quoted 12 lines · Serge E. Hallyn
Quoted 9 lines · Paul Jackson
An additional per-task attribute, set by a batch manager typically when it starts a job on a checkpointable, restartable, movable "virtual server" connects the job parent task, and hence all its descendents in that job, with a named kernel object that has among its attributes a pid range. When fork is handing out new pids, it honors that pid range. User level code, in the batch manager or system administration layer manages a set of these named virtual servers, including assigning pid ranges to them, and puts what is usually the same such configuration on each server in the farm.
And that's how we implement this.
The difference is that the pidrange-id is assigned on the fly, that is when the virtual server is created or recreated after restart.
This, as described in my previous note, is more scalable, because I don't have to do a global pidrange partitioning.
global pidrange partitioning has implications, for instance what if I simply want to freeze an app only to restart it much later. This would freeze that range autmatically.
On process restart, we force fork to use a particular <pidspace/pid> for its kernel pid assignment, rather then searching for a free one.
-- Hubertus
Quoted 3 lines · Serge
restarting multiple simulatenous instances of a single checkpoint. ... Is there a simple way to solve this? (And how valid a concern is this? :)
Offhand, I don't see a way to resolve it in the preallocation scheme.
That's not on my list of stuff to worry about. But, who knows, someone else might find that a valid concern.
Quoted 1 line
Other than that, I guess your approach is growing on me...
Oh dear. I'm drifting away from advocating a pid-range preallocation and toward thinking we need a more systematic approach, design and architecture. This isn't just pids. Simple range based preallocation won't help much on some of the other resources that we need to virtualize.
The Zap pods are sounding good to me right now, properly embedded in the kernel rather than hacking the syscall table via a module.
In any case, I am suspecting that starting the job in some sort of nice container should be a prerequisite for relocating or checkpoint/restarting the job.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Paul Jackson
Oh dear. I'm drifting away from advocating a pid-range preallocation and toward thinking we need a more systematic approach, design and architecture. This isn't just pids. Simple range based preallocation won't help much on some of the other resources that we need to virtualize.
Ah ! you said the word: "virtualize".
Quoted 2 lines
The Zap pods are sounding good to me right now, properly embedded in the kernel rather than hacking the syscall table via a module.
hacking the syscall table via a module is evil and does not work. You can't hack pids in a signal siginfo that way, you won't support NPTL, etc.
Quoted 3 lines
In any case, I am suspecting that starting the job in some sort of nice container should be a prerequisite for relocating or checkpoint/restarting the job.
Indeed. Did you ever think about using PAGG as a foundation for a checkpoint/restart container ?
Aggregation and isolation are key requirements for checkpoint/restart. And then, the next one that comes on the list is private namespace or virtualization, depends how you call it :)
C.
Quoted 2 lines · Cedric
Indeed. Did you ever think about using PAGG as a foundation for a checkpoint/restart container ?
Other than the name, I didn't realize that PAGG provided a good foundation for this work. However, I should let my PAGG colleagues address that further if worthwhile.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 6 lines · Serge E. Hallyn
Quoted 4 lines · Paul Jackson
Quoted 1 line · Serge
the vserver model
What's that?
Quoted 7 lines
:) Well a vserver pretends to be a full system of its own, though you can have lots of vservers on one machine. Processes in each virtual server see only other processes in the same vserver. However in vserver the pids they see are the real kernel pids - except for one process per vserver which can be the fakeinit. Other processes in the same vserver see it as pid 1, but to the kernel it is still known by its real pid.
Why not just use Xen? It can handle process migration from one virtual machine to another just fine.
thanks,
greg k-h
Quoted 15 lines · Greg KH
Quoted 6 lines · Serge E. Hallyn
Quoted 4 lines · Paul Jackson
Quoted 1 line · Serge
the vserver model
What's that?
Quoted 7 lines
:) Well a vserver pretends to be a full system of its own, though you can have lots of vservers on one machine. Processes in each virtual server see only other processes in the same vserver. However in vserver the pids they see are the real kernel pids - except for one process per vserver which can be the fakeinit. Other processes in the same vserver see it as pid 1, but to the kernel it is still known by its real pid.
Quoted 2 lines
Why not just use Xen? It can handle process migration from one virtual machine to another just fine.
It handles vm migration, but not process migration. The most compelling thing (imo) which the latter allows you to do is live OS upgrade under an application. Xen won't let you do that. Of course load-balancing is also more fine-grained and powerful with process set migration, and the overhead of a full OS per migrateable job is quite heavy.
That's not to say we don't also want to use Xen :) - it has it's own advantages and I'm not intending to denigrate those. We just hope to get both!
-serge
Quoted 2 lines · Greg KH
Why not just use Xen? It can handle process migration from one virtual machine to another just fine.
Xen is relatively slow compared to the approach that we want to use. It's a pain in the neck to set up, especially if you want a _lot_ of partitions. We were going to try to compare the relative performance of the two approaches as as the number of vservers and Xen VMs is increased. We haven't found anyone brave enough to set up 100 Xen guests on a single system. :)
The overhead of storing the application snapshots that we're envisioning can be quite tiny compared to Xen. This becomes horribly important if you want to store the snapshots for a bit, and not simply keep one around for long enough to restore the image elsewhere.
Xen doesn't share Linux caches between partitions. So, as you increase the number of Xen partitions, the overhead of storing things like the '/' dentry goes up pretty linearly. Keeping only one Linux instance around makes such things much nicer to share.
The laundry-list of advantages is pretty long. This is starting to sound like a good OLS paper :)
-- Dave
Quoted 5 lines · Paul Jackson
Have you crosstool'd built this for most arch's? I could imagine some piece of code having a local or other struct variable named 'pid' that would be broken by a mistake in this change. This could be so whether the change was done by a script, or by hand. Probably need to test 'allyesconfig' too.
Argh - in fact it appears I compiled and booted my 2.6.14 version, not this 2.6.15-rc1 version. Another patch is needed for this to compile and boot (on a power5 system, in addition to a patch pending for -mm to make rpaphp_pci compile). Sorry.
--- block/cfq-iosched.c | 4 ++-- block/ll_rw_blk.c | 2 +- kernel/ptrace.c | 2 +- net/llc/af_llc.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
kernel/ptrace.c +1 -1
@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *ta retval = -EPERM ;if (task_pid (task) <=1 ) goto bad; -if (task->tgid == current->tgid) +if (task_tgid (task) ==task_tgid (current)) goto bad;/* the same process cannot be attached many times */ if (task->ptrace &PT_PTRACED )
block/ll_rw_blk.c +1 -1
@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)if (unlikely (block_dump)) {char b[BDEVNAME_SIZE ];printk (KERN_DEBUG "%s(%d): %s block %Lu on %s\n" , - current->comm, current->pid, + current->comm,task_pid (current), (rw &WRITE ) ?"WRITE" :"READ" , (unsigned long long )bio->bi_sector,bdevname (bio->bi_bdev,b));
block/cfq-iosched.c +2 -2
@@ -621,7 +621,7 @@ cfq_reposition_crq_rb(struct cfq_queue *static struct request *cfq_find_rq_rb (struct cfq_data *cfqd,sector_t sector) { -struct cfq_queue *cfqq =cfq_find_cfq_hash (cfqd, current->pid,CFQ_KEY_ANY ); +struct cfq_queue *cfqq =cfq_find_cfq_hash (cfqd,task_pid (current),CFQ_KEY_ANY );struct rb_node *n;if (!cfqq)
@@ -1754,7 +1754,7 @@ static void cfq_prio_boost(struct cfq_qustatic inline pid_t cfq_queue_pid (struct task_struct *task,int rw) {if (rw ==READ ||process_sync (task)) -return task->pid; +return task_pid (task);return CFQ_KEY_ASYNC ; }
net/llc/af_llc.c +1 -1
@@ -757,7 +757,7 @@ static int llc_ui_recvmsg(struct kiocb *if (net_ratelimit ())printk (KERN_DEBUG "LLC(%s:%d): Application " "bug, race in MSG_PEEK.\n" , - current->comm, current->pid); + current->comm,task_pid (current)); peek_seq = llc->copied_seq; }continue ;
Quoted 12 lines
Quoted 5 lines
Have you crosstool'd built this for most arch's? I could imagine some piece of code having a local or other struct variable named 'pid' that would be broken by a mistake in this change. This could be so whether the change was done by a script, or by hand. Probably need to test 'allyesconfig' too.
Argh - in fact it appears I compiled and booted my 2.6.14 version, not this 2.6.15-rc1 version. Another patch is needed for this to compile and boot (on a power5 system, in addition to a patch pending for -mm to make
rpaphp_pcicompile). Sorry.
block/ll_rw_blk.c void submit_bio(int rw, struct bio *bio) · line 2931
Quoted 8 lines
block/ll_rw_blk.c +1
-1@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)if (unlikely (block_dump)) {char b[BDEVNAME_SIZE ];printk (KERN_DEBUG "%s(%d): %s block %Lu on %s\n" , - current->comm, current->pid, + current->comm,task_pid (current), (rw &WRITE ) ?"WRITE" :"READ" , (unsigned long long )bio->bi_sector,bdevname (bio->bi_bdev,b));
...and now printk is close to useless, because uer can't know to which pidspace that pid belongs. Oops.
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
Quoted 11 lines · Pavel Machek
block/ll_rw_blk.c void submit_bio(int rw, struct bio *bio) · line 2931
Quoted 9 lines
block/ll_rw_blk.c +1
-1@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)if (unlikely (block_dump)) {char b[BDEVNAME_SIZE ];printk (KERN_DEBUG "%s(%d): %s block %Lu on %s\n" , - current->comm, current->pid, + current->comm,task_pid (current), (rw &WRITE ) ?"WRITE" :"READ" , (unsigned long long )bio->bi_sector,bdevname (bio->bi_bdev,b));...and now printk is close to useless, because uer can't know to which pidspace that pid belongs. Oops.
Uhh, this patch doesn't introduce any kind of virtualization yet. When that happens, _this_ code will remain the same (it wants the real pid), but *other* code will switch to use task_vpid(current) instead. This is an extremely literal translation of current->pid to task_pid(current), both of which do exactly the same thing.
Cheers,
Kyle Moffett
--
There is no way to make Linux robust with unreliable memory subsystems, sorry. It would be like trying to make a human more robust with an unreliable O2 supply. Memory just has to work.
-- Andi Kleen
Hi!
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
block/ll_rw_blk.c +0
-0@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)if (unlikely (block_dump)) {char b[BDEVNAME_SIZE ]; printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",Quoted 8 lines
block/ll_rw_blk.c void submit_bio(int rw, struct bio *bio) · line 2931
Quoted 5 lines
block/ll_rw_blk.c +1
-1- current->comm, current->pid, + current->comm,task_pid (current), (rw &WRITE ) ?"WRITE" :"READ" , (unsigned long long )bio->bi_sector, bdevname(bio->bi_bdev,b));...and now printk is close to useless, because uer can't know to which pidspace that pid belongs. Oops.
Quoted 5 lines
Uhh, this patch doesn't introduce any kind of virtualization yet. When that happens, _this_ code will remain the same (it wants the real pid), but *other* code will switch to use
task_vpid(current)instead. This is an extremely literal translation ofcurrent->pidtotask_pid(current), both of which do exactly the same thing.
Hmm... it is hard to judge a patch without context. Anyway, can't we get process snasphot/resume without virtualizing pids? Could we switch to 128-bits so that pids are never reused or something like that?
Pavel
Signature · 1 line
Thanks, Sharp!
Quoted 3 lines · Pavel Machek
Hmm... it is hard to judge a patch without context. Anyway, can't we get process snasphot/resume without virtualizing pids? Could we switch to 128-bits so that pids are never reused or something like that?
That might work fine for a managed cluster, but it wouldn't be a good fit if you ever wanted to support something like a laptop in disconnected operation, or if you ever want to restore the same snapshot more than once. There may also be some practical userspace issues making pids that large.
I also hate bloating types and making them sparse just for the hell of it. It is seriously demoralizing to do a ps and see 7011827128432950176177290 staring back at you. :)
-- Dave
Hi!
Quoted 10 lines
Quoted 3 lines
Hmm... it is hard to judge a patch without context. Anyway, can't we get process snasphot/resume without virtualizing pids? Could we switch to 128-bits so that pids are never reused or something like that?
That might work fine for a managed cluster, but it wouldn't be a good fit if you ever wanted to support something like a laptop in disconnected operation, or if you ever want to restore the same snapshot more than once. There may also be some practical userspace issues making pids that large.
Quoted 3 lines
I also hate bloating types and making them sparse just for the hell of it. It is seriously demoralizing to do a ps and see 7011827128432950176177290 staring back at you. :)
Well, doing cat /var/something/foo.pid, and seeing pid of unrelated process is wrong, too... especially if you try to kill it....
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
Quoted 12 lines · Pavel Machek
Hi!
Quoted 10 lines
Quoted 3 lines
Hmm... it is hard to judge a patch without context. Anyway, can't we get process snasphot/resume without virtualizing pids? Could we switch to 128-bits so that pids are never reused or something like that?
That might work fine for a managed cluster, but it wouldn't be a good fit if you ever wanted to support something like a laptop in disconnected operation, or if you ever want to restore the same snapshot more than once. There may also be some practical userspace issues making pids that large.
Quoted 6 lines
Quoted 3 lines
I also hate bloating types and making them sparse just for the hell of it. It is seriously demoralizing to do a ps and see 7011827128432950176177290 staring back at you. :)
Well, doing cat
/var/something/foo.pid, and seeing pid of unrelated process is wrong, too... especially if you try to kill it....
Good point. However the foo.pid scheme is incompatible with checkpoint/restart and migration regardless.
a. what good is trying to kill something using such a file if the process is checkpointed+killed, to be restarted later? b. it is expected that any files used by a checkpointable processes exist on a network fs, so that the fd can be moved. What good is foo.pid if it's on a network filesystem?
So if you wanted to checkpoint and restart/migrate a process with a foo.pid type of file, you might need to start it with a private tmpfs in a private namespace. That part is trivial to do as part of the management tools, though checkpointing a whole tmpfs per process could be unfortunate.
-serge
Quoted 17 lines · Serge E. Hallyn
Quoted 16 lines · Pavel Machek
Hi!
Quoted 13 lines
Quoted 3 lines
Hmm... it is hard to judge a patch without context. Anyway, can't we get process snasphot/resume without virtualizing pids? Could we switch to 128-bits so that pids are never reused or something like that?
That might work fine for a managed cluster, but it wouldn't be a good fit if you ever wanted to support something like a laptop in disconnected operation, or if you ever want to restore the same snapshot more than once. There may also be some practical userspace issues making pids that large.
I also hate bloating types and making them sparse just for the hell of it. It is seriously demoralizing to do a ps and see 7011827128432950176177290 staring back at you. :)
Quoted 5 lines
Quoted 2 lines
Well, doing cat
/var/something/foo.pid, and seeing pid of unrelated process is wrong, too... especially if you try to kill it....Good point. However the foo.pid scheme is incompatible with checkpoint/restart and migration regardless.
Well if you look at the other uses vserver and bsd style jail mechanisms the concept is not nearly so ridiculous.
The funny thing though is that this is a trivial thing to continue to make be sensible. Run the process in a chroot or a private namespace and the /var/something/foo.pid works fine.
Quoted 6 lines
So if you wanted to checkpoint and restart/migrate a process with a foo.pid type of file, you might need to start it with a private tmpfs in a private namespace. That part is trivial to do as part of the management tools, though checkpointing a whole tmpfs per process could be unfortunate.
The way you describe it I bet that tmpfs will likely be a small fraction of the size of the processes that you are thinking about checkpointing.
Eric
On 20 Nov 2005, Pavel Machek stated:
Quoted 7 lines
Hi!
Quoted 3 lines
I also hate bloating types and making them sparse just for the hell of it. It is seriously demoralizing to do a ps and see 7011827128432950176177290 staring back at you. :)
Well, doing cat
/var/something/foo.pid, and seeing pid of unrelated process is wrong, too... especially if you try to kill it....
I'd venture to say that anything using multiple pid namespaces should be mounting its own private /var/run subtree (and similar for other such directories). Consider it as similar to the problem of colliding PIDs on multiple physical hosts, or on a host and a pile of UMLs it's running:
the solution there, too, is to unshare /var/run (by not NFS-exporting it in the latter two cases, by private mounts in the former).
(Isn't this PID namespace stuff meant for chroots anyway?)
Signature · 2 lines
`Y'know, London's nice at this time of year. If you like your cities freezing cold and full of surly gits.' --- David Damerell
Quoted 2 lines
Could we switch
to 128-bits so that pids are never reused or something like that?
Not easily. We've got a very cool pid-dispenser at this point that has excellent performance and scalability, but requires a bit map, one bit per potential pid. That bitmap can't exceed a small percentage of main memory on most any configuration, constraining us to perhaps 20 to 30 bits. The code currently has a 22 bit arbitrary limit. Something like 30 bits would usually only make sense on the terabyte NUMA monster boxes.
128-bit UUID technology scales fine, but adds quite a few compute cycles per allocation, and would blow out a whole lot of user code expecting to put a pid in a machine word.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Pavel Machek
Quoted 4 lines
block/ll_rw_blk.c +0
-0@@ -2925,7 +2925,7 @@ void submit_bio(int rw, struct bio *bio)if (unlikely (block_dump)) {char b[BDEVNAME_SIZE ]; printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
Quoted 8 lines
block/ll_rw_blk.c void submit_bio(int rw, struct bio *bio) · line 2931
Quoted 5 lines
block/ll_rw_blk.c +1
-1- current->comm, current->pid, + current->comm,task_pid (current), (rw &WRITE ) ?"WRITE" :"READ" , (unsigned long long )bio->bi_sector, bdevname(bio->bi_bdev,b));...and now printk is close to useless, because uer can't know to which pidspace that pid belongs. Oops.
That is true, but only if we print the virtualized pid. Before we go and actually implement the pid virtualization, we probably need a thorough audit of this kind of stuff to see what we really want.
There will always be a "real pid" (the real thing in tsk->__pid) backing whatever is virtualized and presented to getpid(). I would imagine that this is the same that needs to go into dmesg.
-- Dave
Quoted 1 line · Paul Jackson
Have you crosstool'd built this for most arch's? I could imagine
Thanks for this suggestion. I've now done this for s390, and see how to set it up easily for all arches - this should be a tremendous help!
thanks,
-serge
Quoted 6 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
Can't you just build a restart preloader which intercepts system calls and translates pids? Wouldn't this keep the kernel simpler and only affect those applications that are being restarted? Christoph, I added you since you seem to tirelessly promote using preloaders to work around this type of issue. Is it possible?
Thanks,
Robin
Quoted 5 lines · Robin Holt
Can't you just build a restart preloader which intercepts system calls and translates pids? Wouldn't this keep the kernel simpler and only affect those applications that are being restarted? Christoph, I added you since you seem to tirelessly promote using preloaders to work around this type of issue. Is it possible?
Statically linked applications really throw a pretty big monkey wrench into that kind of plan. I'd hate to give up on _any_ statically linked app from the beginning.
-- Dave
Quoted 7 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
I've read through the rest of this thread, but it seems to me that the real problems are in the basic assumptions you are making that are driving the rest of this effort and perhaps we should be examining those assumptions instead of your patch.
For example, from what I've read (particularly Hubertus's post that the pid could be in a register), I'm inferring that what you want to do is to be able to checkpoint/restart an arbitrary process at an arbitrary time and without any special support for checkpoint/restart in that process.
Also (c. f. Dave Hansen's post on the number of Xen virtual machines required), you appear to think that the number of processes on the system for which checkpoint/restart should be enabled is large (more or less the same as the number of processes on the system).
Am I reading this correctly?
Signature · 3 lines
Ray Bryant AMD Performance Labs Austin, Tx 512-602-0038 (o) 512-507-7807 (c)
Quoted 9 lines · Ray Bryant
Quoted 7 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
Quoted 4 lines
I've read through the rest of this thread, but it seems to me that the real problems are in the basic assumptions you are making that are driving the rest of this effort and perhaps we should be examining those assumptions instead of your patch.
Ok.
Quoted 4 lines
For example, from what I've read (particularly Hubertus's post that the pid could be in a register), I'm inferring that what you want to do is to be able to checkpoint/restart an arbitrary process at an arbitrary time and without any special support for checkpoint/restart in that process.
Yes.
Quoted 4 lines
Also (c. f. Dave Hansen's post on the number of Xen virtual machines required), you appear to think that the number of processes on the system for which checkpoint/restart should be enabled is large (more or less the same as the number of processes on the system).
Right.
Quoted 1 line
Am I reading this correctly?
As far as I can see, yes.
-serge
Quoted 28 lines · Serge E. Hallyn
Quoted 8 lines · Ray Bryant
Quoted 6 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
Quoted 4 lines
I've read through the rest of this thread, but it seems to me that the real problems are in the basic assumptions you are making that are driving the rest of this effort and perhaps we should be examining those assumptions instead of your patch.
Ok.
Quoted 4 lines
For example, from what I've read (particularly Hubertus's post that the pid could be in a register), I'm inferring that what you want to do is to be able to checkpoint/restart an arbitrary process at an arbitrary time and without any special support for checkpoint/restart in that process.
Yes.
Quoted 4 lines
Also (c. f. Dave Hansen's post on the number of Xen virtual machines required), you appear to think that the number of processes on the system for which checkpoint/restart should be enabled is large (more or less the same as the number of processes on the system).
Quoted 7 lines
Right.
Quoted 1 line
Am I reading this correctly?
As far as I can see, yes.
-serge
Personally, I think that these assumptions are incorrect for a
checkpoint/restart facility. I think that:
(1) It is really only possible to checkpoint/restart a cooperative process. For this to work with uncooperative processes you have to figure out (for example) how to save and restore the file system state. (e. g. how do you get the file position set correctly for an open file in the restored program
instance?) And this doesn't even consider what to do with open network
connections.
Similarly, what does one do about the content of System V shared memory
regions or the contents of System V semaphores? I'm sure there are many
more such problems we can come up with a careful study of the Linux/Unix API.
(Note that "cooperation" in this context can also mean "willing to run inside of a container of some kind that supports checkpoint/restart".)
So you can probably only checkpoint the process at certain points in its lifetime, points which the application should be willing to identify in some
way. And I would argue that at such points in time, you can require that
the current register state doesn't include the results of a system call such as getpid(), couldn't you?
(2) Checkpoint/Restart really only makes sense for a long running, resource
intensive job. (e. g. for a job that is doing a lot of work and hence, for
which, recovery is hard -- perhaps as hard as re-running the entire job). By their very nature, there are probably only a few such jobs running on the
system. If there are lots of such jobs on the system, then re-running each
one can't be that hard, can it?
So, I guess my question is wrt the task_pid API is the following: Given that
there are a lot of other problems to solve before transparent checkpointing of uncooperative processes is possible, why should this partial solution be accepted into the main line kernel and "set in stone" so to speak?
Don't get me wrong, I would love for there to be a commonly accepted
checkpoint/restart API. But I don't think that this can be done
transparently at the kernel level and without some cooperation from the target task.
Signature · 3 lines
Ray Bryant AMD Performance Labs Austin, Tx 512-602-0038 (o) 512-507-7807 (c)
Quoted 40 lines · Ray Bryant
Quoted 28 lines · Serge E. Hallyn
Quoted 8 lines · Ray Bryant
Quoted 6 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
Quoted 4 lines
I've read through the rest of this thread, but it seems to me that the real problems are in the basic assumptions you are making that are driving the rest of this effort and perhaps we should be examining those assumptions instead of your patch.
Ok.
Quoted 4 lines
For example, from what I've read (particularly Hubertus's post that the pid could be in a register), I'm inferring that what you want to do is to be able to checkpoint/restart an arbitrary process at an arbitrary time and without any special support for checkpoint/restart in that process.
Yes.
Quoted 4 lines
Also (c. f. Dave Hansen's post on the number of Xen virtual machines required), you appear to think that the number of processes on the system for which checkpoint/restart should be enabled is large (more or less the same as the number of processes on the system).
Quoted 7 lines
Right.
Quoted 1 line
Am I reading this correctly?
As far as I can see, yes.
-serge
Personally, I think that these assumptions are incorrect for a
checkpoint/restart facility. I think that:
Quoted 6 lines
(1) It is really only possible to checkpoint/restart a cooperative process. For this to work with uncooperative processes you have to figure out (for example) how to save and restore the file system state. (e. g. how do you get the file position set correctly for an open file in the restored program
instance?) And this doesn't even consider what to do with open network
connections.
Many of these problems have been solved before. See for instance Zap and ckpt (www.cs.wisc.edu/~zandy/ckpt), and more examples at
http://www.checkpointing.org/
Certainly there are pieces of state which are harder to correclty restore than others, but even network connections have been shown to be migrateable (see zap, and tpccp for cryopid). In fact IIUC one of the hardest things to deal with are ttys.
Quoted 3 lines
Similarly, what does one do about the content of System V shared memory
regions or the contents of System V semaphores? I'm sure there are many
more such problems we can come up with a careful study of the Linux/Unix API.
Yup, sysv shmem has been handled before... And yes, there are plenty more :) /proc files, device files, pipes...
Quoted 5 lines
(Note that "cooperation" in this context can also mean "willing to run inside of a container of some kind that supports checkpoint/restart".)
So you can probably only checkpoint the process at certain points in its lifetime, points which the application should be willing to identify in some
This has been demonstrated to be not true. Again, see ckpt for a simple example.
Oh, right, well willingness to run inside of a container *is* something we would require :) Not needed for checkpointing a single process, however - see ckpt.
Quoted 4 lines
So, I guess my question is wrt the
task_pidAPI is the following: Given that
there are a lot of other problems to solve before transparent checkpointing of uncooperative processes is possible, why should this partial solution be accepted into the main line kernel and "set in stone" so to speak?
It shouldn't. This was a request for comment, not for inclusion :) As you say there are lots of pieces to put together, and we simply decided to start with trying to solve this one.
In fact what I sent out doesn't even do the stuff we've been talking about lately - that will come later this week. This patchset merely lays the groundwork for that.
-serge
Quoted 6 lines
This has been demonstrated to be not true. Again, see ckpt for a simple example.
Oh, right, well willingness to run inside of a container *is* something we would require :) Not needed for checkpointing a single process, however - see ckpt.
Be careful not to assume that some set of requirements on our result is an appropriate set because, for each requirement, someone else has demonstrated a solution that meets that requirement.
Sometimes there are tradeoffs. For example, ckpt will checkpoint/restart a single task without kernel support, but doesn't preserve (from its README at http://www.cs.wisc.edu/~zandy/ckpt/README):
- File descriptors of open files, special devices,
pipes, and sockets;
- Interprocess communication state (such as shared memory, semaphores, mutex, messages);
- Kernel-level thread state;
- Process identifiers, including process id, process group; id, user id, or group id.
and doesn't work with static bound programs (uses PRELOAD).
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 4 lines · Ray Bryant
Personally, I think that these assumptions are incorrect for a
checkpoint/restart facility. I think that:(1) It is really only possible to checkpoint/restart a cooperative process.
What do you mean by cooperative ? that the code should be modified to cooperate with a checkpoint/restart tool ? do you have something else in mind ?
Quoted 2 lines
For this to work with uncooperative processes you have to figure out (for example) how to save and restore the file system state.
Files are definitely very difficult to handle efficiently but there are ways to deal with them. One way is not to deal with them at all and let the application organize its data in such a way that we don't have to checkpoint the file system, share storage is one solution, copying files from a checkpointed node to another node is an other. It can be very inefficient but it works.
But, I agree with you, we don't want to checkpoint a filesystem.
Quoted 2 lines
(e. g. how do you get the file position set correctly for an open file in the restored program instance?)
well, if the file is available, lseek() should do the job. Pipes are more difficult to handle than regular files in fact.
Quoted 1 line
And this doesn't even consider what to do with open network connections.
network connections are indeed very tricky. The network code is very complex, very large, plenty of protocols to handle but it can be done for TCP/IP by blocking the traffic, checkpointing the data and checkpointing the PCBs. But tell me more, what are the main issues for you ?
Private interconnect are a challenge.
Quoted 2 lines
Similarly, what does one do about the content of System V shared memory regions or the contents of System V semaphores?
Well, they have to be constrained in a known set of processes, or a container, to make sure we are not checkpointing a moving target.
Quoted 2 lines
I'm sure there are many more such problems we can come up with a careful study of the Linux/Unix API.
Oh yes, the UNIX API is very large but in checkpoint/restart we care more about implementation. This can be tricky.
Quoted 2 lines
(Note that "cooperation" in this context can also mean "willing to run inside of a container of some kind that supports checkpoint/restart".)
Indeed !
We need an isolation mecanism to make sure we control the boundaries of an application. We don't want any leaks when we initiate a checkpoint.
Quoted 3 lines
So you can probably only checkpoint the process at certain points in its lifetime, points which the application should be willing to identify in some way.
We do need to reach a quiescience point. a SIGSTOP is enough or a container wide schedule(), a la software suspend. But no more.
Quoted 3 lines
And I would argue that at such points in time, you can require that the current register state doesn't include the results of a system call such as
getpid(), couldn't you?
Well, what if that register holds a virtualized pid, this is no more an issue, nop ?
Quoted 3 lines
(2) Checkpoint/Restart really only makes sense for a long running, resource
intensive job. (e. g. for a job that is doing a lot of work and hence, for
which, recovery is hard -- perhaps as hard as re-running the entire job).
HPC industry is indeed an obvious target.
However, we have successfully checkpinted desktop applications like openoffice, thunderbird, mozilla, emacs, etc. We are still working on pty in order to migrate terminals. We think in can also be useful in that area and others.
Quoted 3 lines
By their very nature, there are probably only a few such jobs running on the
system. If there are lots of such jobs on the system, then re-running each
one can't be that hard, can it?
hmm, didn't get your point here ? can you elaborate ?
Quoted 4 lines
So, I guess my question is wrt the
task_pidAPI is the following: Given that
there are a lot of other problems to solve before transparent checkpointing of uncooperative processes is possible, why should this partial solution be accepted into the main line kernel and "set in stone" so to speak?
Well, let's say that we want to present this one step after the other and try to have each step brings some interesting value to the linux kernel.
Process aggregation is the first big step, other projects have shown interest in this area, PAGG for instance. Isolation is another. The virtualization step could be thought as dedicated to checkpoint/restart but we're pretty sure it should help some projects like vserser that need to virtualize some ancestor pid. On that subject, having a way to manage cluster wide pids could be useful to HPC batch managers.
Quoted 4 lines
Don't get me wrong, I would love for there to be a commonly accepted
checkpoint/restart API. But I don't think that this can be done
transparently at the kernel level and without some cooperation from the target task.
Well, we've already migrated some pretty ugly applications, database engines, without modifying them :)
C.
Quoted 2 lines · Cedric
Well, we've already migrated some pretty ugly applications, database engines, without modifying them :)
You will have to teach us how it is done.
As you likely know by now, Linux doesn't incorporate new technology en mass. We sniff and poke at it, break it down into its constituent elements and reconstitute it in ways that seem to fit Linux better. It's all part of how we keep the body Linux healthy.
Especially for things like this that touch many of the more interesting kernel constructs, the end result seldom resembles the initial input.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 9 lines · Serge E. Hallyn
--
I'm part of a project implementing checkpoint/restart processes. After a process or group of processes is checkpointed, killed, and restarted, the changing of pids could confuse them. There are many other such issues, but we wanted to start with pids.
Does something like this, presumably after much working over, seem mergeable?
This set of patches looks like a global s/current->pid/task_pid(current)/ Which may be an interesting exercise but I don't see how this helps your problem. And as has been shown by a few comments this process making all of these changes is subject to human error.
Many of the interesting places that deal with pids and where you want translation are not where the values are read from current->pid, but where the values are passed between functions. Think about the return value of do_fork.
There are also a lot of cases you haven't even tried to address. You haven't touched process groups, or sessions.
At the current time the patch definitely fails the no in kernel users test because it doesn't go as far as taking advantage of the abstraction it attempts to introduce. Which means other people can't read through the code and make sense of what you are trying to do or to see if there is a better way.
I will also contend that walking down a path that does not cause compilation to fail when the subtle things like which flavor of pid you want to see is a problem.
Another question is how do your pid spaces nest. Currently it sounds like you are taking the vserver model and allowing everyone outside your pid space to see all of your internal pids. Is this really what you want? Who do you report as the source of your signal.
What pid does waitpid return when the parent of your pidspace exits? What pid does waitpid return when both processes are in the same pidspace?
How does /proc handle multiple pid spaces?
While something allowing multiple pidspaces may be mergeable, unnecessary and incomplete changes rarely are. This is a fundamental change to the unix API so it will take a lot of scrutiny to get merged.
Eric
Quoted 4 lines · Eric W. Biederman
This set of patches looks like a global s/current->pid/task_pid(current)/ Which may be an interesting exercise but I don't see how this helps your problem. And as has been shown by a few comments this process making all of these changes is subject to human error.
As with any good set of kernel changes, this is step one. Step two will include calling something _other_ than task_pid(). But, in the interests of small, incremental changes, this is what we decided to do first.
Quoted 4 lines
Many of the interesting places that deal with pids and where you want translation are not where the values are read from
current->pid, but where the values are passed between functions. Think about the return value ofdo_fork.
Exactly. The next phase will focus on such places. Hubertus has some stuff working that's probably not ready for LKML, but could certainly be shared.
Quoted 2 lines
There are also a lot of cases you haven't even tried to address. You haven't touched process groups, or sessions.
I preferred to keep the number of patches at 13, rather than 130. Those are in the pipeline, but pids are the most important first step which gets the most functionality.
Quoted 5 lines
At the current time the patch definitely fails the no in kernel users test because it doesn't go as far as taking advantage of the abstraction it attempts to introduce. Which means other people can't read through the code and make sense of what you are trying to do or to see if there is a better way.
This isn't excatly a new feature, nor does it add any appreciable code or complexity. I'm not sure that test even applies.
Quoted 3 lines
I will also contend that walking down a path that does not cause compilation to fail when the subtle things like which flavor of pid you want to see is a problem.
I agree. I'm trying to figure out which way is best to go about this. I have the feeling that using sparse tags like __user and __kernel is the way to go, but we might also want to take the embedded struct approach like atomic_t.
Quoted 1 line
Another question is how do your pid spaces nest.
They don't, and thankfully there is anybody asking for it. It adds loads of complexity, and nobody apparently needs it.
Quoted 4 lines
Currently
it sounds like you are taking the vserver model and allowing everyone outside your pid space to see all of your internal pids. Is this really what you want?
For our application, yes. For vserver, maybe not. We'd like things like 'top' to still work like normal, even though there are processes in their own pidspace around.
Quoted 1 line
Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good answer. Can you explain the mechanics of how you would go about doing this?
Quoted 2 lines
What pid does waitpid return when the parent of your pidspace exits? What pid does waitpid return when both processes are in the same pidspace?
The pids coming out of system calls are always in the context of the process doing the call.
Quoted 1 line
How does /proc handle multiple pid spaces?
I'm working on it :)
Right now, there's basically a hack in d_hash() to get new dentries for each pidspace. It is horrible and causes a 50x decrease in performance on some benchmarks like dbench.
I think the long-term solution is to make multiple, independent proc mounts, and give each pidspace a separate filesystem view. That requires some of the nifty new bind mount functionality and a chroot when a new pidspace is created, but I think it works.
Quoted 4 lines
While something allowing multiple pidspaces may be mergeable, unnecessary and incomplete changes rarely are. This is a fundamental change to the unix API so it will take a lot of scrutiny to get merged.
Lots of good questions. I think we need to take some of our initial, private discussions and get them out on an open list somewhere. Any suggestions? I hate creating new sourceforge projects :)
-- Dave
Quoted 10 lines
Quoted 5 lines
Many of the interesting places that deal with pids and where you want translation are not where the values are read from
current->pid, but where the values are passed between functions. Think about the return value ofdo_fork.Exactly. The next phase will focus on such places. Hubertus has some stuff working that's probably not ready for LKML, but could certainly be shared.
hmm wonder if it's not just a lot simpler to introduce a split in "kernel pid" and "userspace pid", and have current->pid and current->user_pid for that.
Using accessor macros doesn't sound like it gains much here.. (but then I've not seen the full picture and you have)
Quoted 9 lines · Arjan van de Ven
Quoted 8 lines
Quoted 4 lines
Many of the interesting places that deal with pids and where you want translation are not where the values are read from
current->pid, but where the values are passed between functions. Think about the return value ofdo_fork.Exactly. The next phase will focus on such places. Hubertus has some stuff working that's probably not ready for LKML, but could certainly be shared.
Quoted 6 lines
hmm wonder if it's not just a lot simpler to introduce a split in "kernel pid" and "userspace pid", and have
current->pidandcurrent->user_pidfor that.Using accessor macros doesn't sound like it gains much here.. (but then I've not seen the full picture and you have)
My first instinct was to introduce functions like get_user_pid() and get_kernel_pid() which would effectively introduce the same split. Doing that, we could keep from even referencing ->user_pid in normal code, and keep things small and simpler for people like the embedded folks.
For the particular application that we're thinking of, we really don't want "user pid" and "kernel pid" we want "virtualized" and "unvirtualized", or "regular old pid" and "fancy new virtualized pid".
So, like in the global pidspace (which can see all pids and appears to applications to be just like normal) you end up returning "kernel" pids to userspace. That didn't seem to make sense.
-- Dave
Quoted 5 lines
Quoted 5 lines
hmm wonder if it's not just a lot simpler to introduce a split in "kernel pid" and "userspace pid", and have
current->pidandcurrent->user_pidfor that.
Quoted 8 lines
Quoted 2 lines
Using accessor macros doesn't sound like it gains much here.. (but then I've not seen the full picture and you have)
My first instinct was to introduce functions like
get_user_pid()andget_kernel_pid()which would effectively introduce the same split. Doing that, we could keep from even referencing ->user_pid in normal code, and keep things small and simpler for people like the embedded folks.
well I don't see the point for the abstraction... get_kernel_pid() is no better or worse than using current->pid directly, unless you want to do "deep magic".
Quoted 3 lines
For the particular application that we're thinking of, we really don't want "user pid" and "kernel pid" we want "virtualized" and "unvirtualized", or "regular old pid" and "fancy new virtualized pid".
same thing, different name :)
Quoted 3 lines
So, like in the global pidspace (which can see all pids and appears to applications to be just like normal) you end up returning "kernel" pids to userspace. That didn't seem to make sense.
hmm this is scary. If you don't have "unique" pids inside the kernel a lot of stuff will subtly break. DRM for example (which has the pid inside locking to track ownership and recursion), but I'm sure there's many many cases like that. I guess the address of the task struct is the ultimate unique pid in this sense.... but I suspect the way to get there is first make a ->user_pid field, and switch all userspace visible stuff to that, and then try to get rid of ->pid users one by one by eliminating their uses...
but I'm really afraid that if you make the "fake" pid visible to normal kernel code, too much stuff will go bonkers and end up with an eternal stream of security hazards. "Magic" hurts here, and if you don't do magic I don't see a reason to add an abstraction which in itself doesn't mean anything or doesn't abstract anything....
Quoted 13 lines · Arjan van de Ven
Quoted 3 lines
So, like in the global pidspace (which can see all pids and appears to applications to be just like normal) you end up returning "kernel" pids to userspace. That didn't seem to make sense.
hmm this is scary. If you don't have "unique" pids inside the kernel a lot of stuff will subtly break. DRM for example (which has the pid inside locking to track ownership and recursion), but I'm sure there's many many cases like that. I guess the address of the task struct is the ultimate unique pid in this sense.... but I suspect the way to get there is first make a ->user_pid field, and switch all userspace visible stuff to that, and then try to get rid of ->pid users one by one by eliminating their uses...
Quoted 5 lines
but I'm really afraid that if you make the "fake" pid visible to normal kernel code, too much stuff will go bonkers and end up with an eternal stream of security hazards. "Magic" hurts here, and if you don't do magic I don't see a reason to add an abstraction which in itself doesn't mean anything or doesn't abstract anything....
Thanks, you said that better that I did :)
Eric
Quoted 4 lines · Arjan van de Ven
Quoted 3 lines
So, like in the global pidspace (which can see all pids and appears to applications to be just like normal) you end up returning "kernel" pids to userspace. That didn't seem to make sense.
Quoted 8 lines
hmm this is scary. If you don't have "unique" pids inside the kernel a lot of stuff will subtly break. DRM for example (which has the pid inside locking to track ownership and recursion), but I'm sure there's many many cases like that. I guess the address of the task struct is the ultimate unique pid in this sense.... but I suspect the way to get there is first make a ->user_pid field, and switch all userspace visible stuff to that, and then try to get rid of ->pid users one by one by eliminating their uses...
OK, what I'm talking about here is the way that it is done now with existing code. It seems to work and make people happy, but it certainly isn't the only possible way to do it. I'm very open to suggestions. :)
There really are two distinct pid spaces. Instead of vservers, we tend to call the different partitioned areas containers.
Each container can only see processes in its own container. The exception is the "global container", which has a view of all of the system processes. Having the global container allows you to do things like see all of the processes on the whole system with top.
So, the current tsk->pid is still unique. However, there is also a tsk->virtual_pid (or some name) that is unique _inside_ of a container. These two pids are completely unrelated. Having this virtualized pid allows you to have the real tsk->pid change without userspace ever knowing.
For example, that tsk->pid might change if you checkpointed a process, it crashed, and you restarted it later from the checkpoint.
Quoted 5 lines
but I'm really afraid that if you make the "fake" pid visible to normal kernel code, too much stuff will go bonkers and end up with an eternal stream of security hazards. "Magic" hurts here, and if you don't do magic I don't see a reason to add an abstraction which in itself doesn't mean anything or doesn't abstract anything....
99% of the time, the kernel can deal with the same old tsk->pid that it's always dealt with. Generally, the only times the kernel has to worry about the virtualized one is where (as Eric noted) it cross the user<->kernel boundary.
-- Dave
Quoted 5 lines
99% of the time, the kernel can deal with the same old
tsk->pidthat it's always dealt with. Generally, the only times the kernel has to worry about the virtualized one is where (as Eric noted) it cross the user<->kernel boundary.
that's fair enough. I don't see the need for the macro abstractions though; a current->pid and current->user_pid (or visible_pid or any other good name) split makes sense. no need for macro abstractions at all, just add ->user_pid in patch 1, in patch 2 assign it default to ->pid as well and patch 3 converts the places where ->pid is now given to userspace ;)
again the DRM layer needs an audit, I'm not entirely sure if it doesn't get pids from userspace. THe rest of the kernel mostly ought to cope just fine.
Quoted 5 lines
again the DRM layer needs an audit, I'm not entirely sure if it doesn't get pids from userspace. THe rest of the kernel mostly ought to cope just fine.
Yes yet again, if you can think of it, the drm will have found a way to do it :-)
the drmGetClient ioctl passes pids across the user/kernel boundary, its the only place I can see in a quick look at the interfaces.... but it isn't used for anything as far as I can see except for the dristat testing utility..
Dave.
Quoted 6 lines · Dave Airlie
Quoted 5 lines
again the DRM layer needs an audit, I'm not entirely sure if it doesn't get pids from userspace. THe rest of the kernel mostly ought to cope just fine.
Quoted 7 lines
Yes yet again, if you can think of it, the drm will have found a way to do it :-)
the drmGetClient ioctl passes pids across the user/kernel boundary, its the only place I can see in a quick look at the interfaces.... but it isn't used for anything as far as I can see except for the dristat testing utility..
There are crazier cases in the kernel. Netlink is my favorite example it's default ports are the process pid and some locations in the kernel even assume you are using the default port.
Eric
Quoted 7 lines · Dave Hansen
Quoted 2 lines · Eric W. Biederman
There are also a lot of cases you haven't even tried to address. You haven't touched process groups, or sessions.
I preferred to keep the number of patches at 13, rather than 130. Those are in the pipeline, but pids are the most important first step which gets the most functionality.
Process groups are also pids, and there are direct relationships between pids and process group ids and session ids. I agree keeping the focus tight make sense but not so tight that you miss pieces.
Quoted 8 lines
Quoted 5 lines
At the current time the patch definitely fails the no in kernel users test because it doesn't go as far as taking advantage of the abstraction it attempts to introduce. Which means other people can't read through the code and make sense of what you are trying to do or to see if there is a better way.
This isn't excatly a new feature, nor does it add any appreciable code or complexity. I'm not sure that test even applies.
A very common comment on the thread up to now is that people haven't seen the big picture so they can't comment.
Quoted 8 lines
Quoted 3 lines
I will also contend that walking down a path that does not cause compilation to fail when the subtle things like which flavor of pid you want to see is a problem.
I agree. I'm trying to figure out which way is best to go about this. I have the feeling that using sparse tags like
__userand__kernelis the way to go, but we might also want to take the embedded struct approach likeatomic_t.
You can also make the kernel functions that take a pidspace argument and you will have instant compile failures :)
Quoted 4 lines
Quoted 1 line
Another question is how do your pid spaces nest.
They don't, and thankfully there is anybody asking for it. It adds loads of complexity, and nobody apparently needs it.
So only very special pids can generate a pidspace. That will tend to reduce the generality of the solution. What do you do if I am running your code in a vserver?
There enough possibilities to the solution space a few extra constraints I think would help in this case.
Quoted 8 lines
Quoted 4 lines
Currently
it sounds like you are taking the vserver model and allowing everyone outside your pid space to see all of your internal pids. Is this really what you want?For our application, yes. For vserver, maybe not. We'd like things like 'top' to still work like normal, even though there are processes in their own pidspace around.
I can see the desire. But top is already strongly challenged if you are talking hpc computing. It only works on one node. Anything that teaches proc about multiple node mounts ought to work just as well for an internal checkpoint restart implementation.
Quoted 5 lines
Quoted 1 line
Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good answer. Can you explain the mechanics of how you would go about doing this?
Look at siginfo_t si_pid....
Quoted 5 lines
Quoted 2 lines
What pid does waitpid return when the parent of your pidspace exits? What pid does waitpid return when both processes are in the same pidspace?
The pids coming out of system calls are always in the context of the process doing the call.
This is of course the definition. But how you implement those cases is interesting.
Quoted 4 lines
Quoted 1 line
How does /proc handle multiple pid spaces?
I'm working on it :)
Quoted 8 lines
Right now, there's basically a hack in
d_hash()to get new dentries for each pidspace. It is horrible and causes a 50x decrease in performance on some benchmarks like dbench.I think the long-term solution is to make multiple, independent proc mounts, and give each pidspace a separate filesystem view. That requires some of the nifty new bind mount functionality and a chroot when a new pidspace is created, but I think it works.
I think you will ultimately want a new filesystem namespace not just a chroot, so you can ``virtualize'' your filesystem namespace as well.
Quoted 8 lines
Quoted 4 lines
While something allowing multiple pidspaces may be mergeable, unnecessary and incomplete changes rarely are. This is a fundamental change to the unix API so it will take a lot of scrutiny to get merged.
Lots of good questions. I think we need to take some of our initial, private discussions and get them out on an open list somewhere. Any suggestions? I hate creating new sourceforge projects :)
I wonder if you could hook up with the linux vserver project. The requirements are strongly similar, and making a solution that would work for everyone has a better chance of getting in.
Eric
Quoted 3 lines · Eric W. Biederman
Process groups are also pids, and there are direct relationships between pids and process group ids and session ids. I agree keeping the focus tight make sense but not so tight that you miss pieces.
There's a "reference implementation" that the kernel community hasn't seen which is certainly not mergeable, but shows all of the pieces. Personally, I really want to share it, and I hope that we can soon.
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
At the current time the patch definitely fails the no in kernel users test because it doesn't go as far as taking advantage of the abstraction it attempts to introduce. Which means other people can't read through the code and make sense of what you are trying to do or to see if there is a better way.
This isn't excatly a new feature, nor does it add any appreciable code or complexity. I'm not sure that test even applies.
A very common comment on the thread up to now is that people haven't seen the big picture so they can't comment.
Yup, this is a big issue. I think getting that "other code" out there is part of filling you guys in. The other part is discussions like this. :)
Quoted 1 line
From your comments, I can see that you have a much bigger piece of the
picture in your head than you think.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Another question is how do your pid spaces nest.
They don't, and thankfully there is anybody asking for it. It adds loads of complexity, and nobody apparently needs it.
So only very special pids can generate a pidspace. That will tend to reduce the generality of the solution. What do you do if I am running your code in a vserver?
I don't think it would be a good idea to stack these containers within vservers, either. vserver uses different pidspaces, and will use the same infrastructure. The only difference is that they only have a very small change to the different pidspaces for init.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good answer. Can you explain the mechanics of how you would go about doing this?
Look at
siginfo_tsi_pid....
Are those things that are exported outside of the kernel? It's not immediately obvious.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
While something allowing multiple pidspaces may be mergeable, unnecessary and incomplete changes rarely are. This is a fundamental change to the unix API so it will take a lot of scrutiny to get merged.
Quoted 7 lines
Quoted 3 lines
Lots of good questions. I think we need to take some of our initial, private discussions and get them out on an open list somewhere. Any suggestions? I hate creating new sourceforge projects :)
I wonder if you could hook up with the linux vserver project. The requirements are strongly similar, and making a solution that would work for everyone has a better chance of getting in.
Already hooked up. They need the same stuff we want, just in smaller quantities. They can easily stack on top of whatever we do.
-- Dave
Quoted 6 lines · Dave Hansen
Quoted 5 lines · Eric W. Biederman
Quoted 4 lines
Quoted 1 line
Another question is how do your pid spaces nest.
They don't, and thankfully there is anybody asking for it. It adds loads of complexity, and nobody apparently needs it.
Quoted 8 lines
Quoted 3 lines
So only very special pids can generate a pidspace. That will tend to reduce the generality of the solution. What do you do if I am running your code in a vserver?
I don't think it would be a good idea to stack these containers within vservers, either. vserver uses different pidspaces, and will use the same infrastructure. The only difference is that they only have a very small change to the different pidspaces for init.
Well that depends on the implementation. The first concern with the implementation is of course maintainability.
But beyond that a general test to see if you have done a good job of virtualizing something is to see if you can recurse.
One of my wish list items would be to run my things like my web browser in a container with only access to a subset of the things I can normally access. That way I could be less concerned about the latest browser security bug.
Although I do expect that just like private namespaces it will take a while to figure out how to allow non-privileged access to these kinds of powerful concepts.
In the bsdjail paper the point is made that as systems grow more complex creating minimal privilege containers is easy and simple compared to what it takes to get a complex system up and going today. (I expressed that badly)
And then of course there is the other pipe dream if you can consider the whole system in a container then you can implement the equivalent of swsuspend by checkpointing the top level container.
At least this should solve the classic complaint about job control. That it wasn't transparent to processes.
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good answer. Can you explain the mechanics of how you would go about doing this?
Look at
siginfo_tsi_pid....Are those things that are exported outside of the kernel? It's not immediately obvious.
Sorry do a man sigaction. Basically the signal handler needs to be configured with SA_SIGINFO but it should get that information.
I believe you have to
Eric
Quoted 2 lines · Eric W. Biederman
But beyond that a general test to see if you have done a good job of virtualizing something is to see if you can recurse.
I admit it would be interesting at the very least. But, using that definition, we haven't done any good virtualization in Linux that I can think of. Besides some vague ranting I heard about zSeries (the real IBM mainframes) I can't think of anything that does this today.
I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or vservers can recurse.
Can you think of any?
-- Dave
Quoted 9 lines · Dave Hansen
Quoted 2 lines · Eric W. Biederman
But beyond that a general test to see if you have done a good job of virtualizing something is to see if you can recurse.
I admit it would be interesting at the very least. But, using that definition, we haven't done any good virtualization in Linux that I can think of. Besides some vague ranting I heard about zSeries (the real IBM mainframes) I can't think of anything that does this today.
Quoted 4 lines
I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or vservers can recurse.
Can you think of any?
There is Xnest that allows X to run on X.
There are process groups and sessions that while they may not strictly nest you don't loose the ability to create new ones.
There is the CLONE_NEWNS and just about any of the other clone flags in linux.
There is bochs that emulates the whole machine.
I am actually a little surprised that UML can't run UML. I suspect it is an address space conflict and not something fundamental.
With pidspaces as long as the parent isn't required to send signals to arbitrary children I don't think nesting pids spaces is hard. Or more properly have a process in one pidspace be the parent of a process in another. Although I grant there are a few boundary issues, that have to be handled carefully.
Eric
Quoted 2 lines · Dave Hansen
I don think any of Solaris containers, ppc64 LPARs, Xen, UML, or vservers can recurse.
UML can, but it's not a heavily exercised option, and it needs some fixes in order to recurse in the currently favored mode of operation.
Jeff
Quoted 2 lines · Dave Hansen
Can you think of any?
qemu can afaik. I've also heard about simnow in qemu and Xen in qemu, although that's not true recursion. And VMware/qemu/ simnow/UML/... will all probably run fine in Xen native guests. I wouldn't be surprised if UML supported true recursion too.
But then for what do you really need recursion? It might be nice theory, but in practice it's probably not too relevant. I guess it was useful long ago for debugging VM itself when mainframes were really expensive so you couldn't just buy a development machine and test your VM on raw iron. But that's not really true today anymore.
Ok one weak reason to still use it might be if your test machine takes too long to reboot. But then Hypervisor hackers are a pretty narrow target group for features like this.
-Andi
Hi!
Quoted 4 lines
One of my wish list items would be to run my things like my web browser in a container with only access to a subset of the things I can normally access. That way I could be less concerned about the latest browser security bug.
subterfugue.sf.net (using ptrace), but yes, nicer solution would be welcome.
Signature · 1 line
Thanks, Sharp!
Quoted 9 lines · Pavel Machek
Hi!
Quoted 4 lines
One of my wish list items would be to run my things like my web browser in a container with only access to a subset of the things I can normally access. That way I could be less concerned about the latest browser security bug.
subterfugue.sf.net (using ptrace), but yes, nicer solution would be welcome.
selinux too, as well as andrea's syscall filter thing and many others.
the hardest is the balance between security and usability. You don't want your browser to be able to read files in your home dir (Except maybe a few selected ones in the browsers own dir)... until you want to upload a file via a webform.
Quoted 11 lines · Arjan van de Ven
Quoted 9 lines · Pavel Machek
Hi!
Quoted 4 lines
One of my wish list items would be to run my things like my web browser in a container with only access to a subset of the things I can normally access. That way I could be less concerned about the latest browser security bug.
subterfugue.sf.net (using ptrace), but yes, nicer solution would be welcome.
Quoted 6 lines
selinux too, as well as andrea's syscall filter thing and many others.
the hardest is the balance between security and usability. You don't want your browser to be able to read files in your home dir (Except maybe a few selected ones in the browsers own dir)... until you want to upload a file via a webform.
Yup, right now I use a separate account (not in wheel) for web browsing, which using Janak's unshare() patch and a small pam library gets its own namespace which can't see my dmcrypted home partition and has private /tmp. File sharing is done through a non-standard tmp, just to prevent scripts from using it.
Pretty convenient, but it really wants some stronger isolation. You'd think I'd at least use my bsdjail to keep unix sockets and such safe...
Anyway, real containers would indeed be far more convenient, or at least prettier.
-serge
Quoted 7 lines · Eric W. Biederman
Quoted 5 lines
Quoted 1 line
Who do you report as the source of your signal.
I've never dealt with signal enough from userspace to give you a good answer. Can you explain the mechanics of how you would go about doing this?
Look at
siginfo_tsi_pid....
the siginfo is queued when a process is killed and si_pid is updated using the pidspace of the killing process. Processes parent of a pidspace are of a special kind : the init kind.
Quoted 1 line
Quoted 1 line
Quoted 1 line
What pid does waitpid return when the parent of your pidspace exits?
Well, a process doing waitpid on a parent of a pidspace, is not part of that pidspace so waitpid would return the 'real pid'.
Am i getting your point correctly ?
Quoted 1 line
Quoted 1 line
Quoted 1 line
What pid does waitpid return when both processes are in the same pidspace?
hmm, please elaborate.
There are indeed issues when a process is the parent of different namespaces. This case that should be avoided.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
How does /proc handle multiple pid spaces?
I'm working on it :)
Right now, there's basically a hack in
d_hash()to get new dentries for each pidspace. It is horrible and causes a 50x decrease in performance on some benchmarks like dbench.
Quoted 8 lines
Quoted 4 lines
I think the long-term solution is to make multiple, independent proc mounts, and give each pidspace a separate filesystem view. That requires some of the nifty new bind mount functionality and a chroot when a new pidspace is created, but I think it works.
I think you will ultimately want a new filesystem namespace not just a chroot, so you can ``virtualize'' your filesystem namespace as well.
"virtualize" the mount points but not necessarily the whole filesystem.
Quoted 3 lines
I wonder if you could hook up with the linux vserver project. The requirements are strongly similar, and making a solution that would work for everyone has a better chance of getting in.
We feel the same.
C.