2 * Copyright (c) 1993, David Greenman
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.15 2002/07/30 15:40:46 nectar Exp $
27 * $DragonFly: src/sys/kern/kern_exec.c,v 1.17 2003/11/18 01:15:42 dillon Exp $
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/sysproto.h>
33 #include <sys/kernel.h>
34 #include <sys/mount.h>
35 #include <sys/filedesc.h>
36 #include <sys/fcntl.h>
39 #include <sys/imgact.h>
40 #include <sys/imgact_elf.h>
41 #include <sys/kern_syscall.h>
43 #include <sys/malloc.h>
45 #include <sys/signalvar.h>
46 #include <sys/pioctl.h>
47 #include <sys/namei.h>
48 #include <sys/sysent.h>
50 #include <sys/sysctl.h>
51 #include <sys/vnode.h>
55 #include <vm/vm_param.h>
58 #include <vm/vm_page.h>
59 #include <vm/vm_map.h>
60 #include <vm/vm_kern.h>
61 #include <vm/vm_extern.h>
62 #include <vm/vm_object.h>
63 #include <vm/vm_pager.h>
66 #include <machine/reg.h>
68 MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments");
70 static register_t *exec_copyout_strings (struct image_params *);
72 /* XXX This should be vm_size_t. */
73 static u_long ps_strings = PS_STRINGS;
74 SYSCTL_ULONG(_kern, KERN_PS_STRINGS, ps_strings, CTLFLAG_RD, &ps_strings, 0, "");
76 /* XXX This should be vm_size_t. */
77 static u_long usrstack = USRSTACK;
78 SYSCTL_ULONG(_kern, KERN_USRSTACK, usrstack, CTLFLAG_RD, &usrstack, 0, "");
80 u_long ps_arg_cache_limit = PAGE_SIZE / 16;
81 SYSCTL_LONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW,
82 &ps_arg_cache_limit, 0, "");
85 SYSCTL_INT(_kern, OID_AUTO, ps_argsopen, CTLFLAG_RW, &ps_argsopen, 0, "");
87 void print_execve_args(struct image_args *args);
88 int debug_execve_args = 0;
89 SYSCTL_INT(_kern, OID_AUTO, debug_execve_args, CTLFLAG_RW, &debug_execve_args,
93 print_execve_args(struct image_args *args)
98 cp = args->begin_argv;
99 for (ndx = 0; ndx < args->argc; ndx++) {
100 printf("\targv[%d]: %s\n", ndx, cp);
101 while (*cp++ != '\0');
103 for (ndx = 0; ndx < args->envc; ndx++) {
104 printf("\tenvv[%d]: %s\n", ndx, cp);
105 while (*cp++ != '\0');
110 * Each of the items is a pointer to a `const struct execsw', hence the
111 * double pointer here.
113 static const struct execsw **execsw;
116 kern_execve(struct nameidata *ndp, struct image_args *args)
118 struct thread *td = curthread;
119 struct proc *p = td->td_proc;
120 register_t *stack_base;
122 struct image_params image_params, *imgp;
124 int (*img_first) (struct image_params *);
126 if (debug_execve_args) {
127 printf("%s()\n", __func__);
128 print_execve_args(args);
132 imgp = &image_params;
135 * Lock the process and set the P_INEXEC flag to indicate that
136 * it should be left alone until we're done here. This is
137 * necessary to avoid race conditions - e.g. in ptrace() -
138 * that might allow a local user to illicitly obtain elevated
141 p->p_flag |= P_INEXEC;
144 * Initialize part of the common data
149 imgp->entry_addr = 0;
150 imgp->vmspace_destroyed = 0;
151 imgp->interpreted = 0;
152 imgp->interpreter_name[0] = 0;
153 imgp->auxargs = NULL;
155 imgp->firstpage = NULL;
156 imgp->ps_strings = 0;
159 * Allocate temporary demand zeroed space for argument and
160 * environment strings
162 imgp->image_header = (char *)kmem_alloc_wait(exec_map, PAGE_SIZE);
163 if (imgp->image_header == NULL) {
171 * Translate the file name. namei() returns a vnode pointer
172 * in ni_vp amoung other things.
176 kmem_free_wakeup(exec_map, (vm_offset_t)imgp->image_header,
181 imgp->vp = ndp->ni_vp;
184 * Check file permissions (also 'opens' file)
186 error = exec_check_permissions(imgp);
188 VOP_UNLOCK(imgp->vp, 0, td);
189 goto exec_fail_dealloc;
192 error = exec_map_first_page(imgp);
193 VOP_UNLOCK(imgp->vp, 0, td);
195 goto exec_fail_dealloc;
197 if (debug_execve_args && imgp->interpreted) {
198 printf(" target is interpreted -- recursive pass\n");
199 printf(" interpreter: %s\n", imgp->interpreter_name);
200 print_execve_args(args);
204 * If the current process has a special image activator it
205 * wants to try first, call it. For example, emulating shell
206 * scripts differently.
209 if ((img_first = imgp->proc->p_sysent->sv_imgact_try) != NULL)
210 error = img_first(imgp);
213 * Loop through the list of image activators, calling each one.
214 * An activator returns -1 if there is no match, 0 on success,
215 * and an error otherwise.
217 for (i = 0; error == -1 && execsw[i]; ++i) {
218 if (execsw[i]->ex_imgact == NULL ||
219 execsw[i]->ex_imgact == img_first) {
222 error = (*execsw[i]->ex_imgact)(imgp);
228 goto exec_fail_dealloc;
232 * Special interpreter operation, cleanup and loop up to try to
233 * activate the interpreter.
235 if (imgp->interpreted) {
236 exec_unmap_first_page(imgp);
237 /* free name buffer and old vnode */
238 NDFREE(ndp, NDF_ONLY_PNBUF);
240 /* set new name to that of the interpreter */
241 NDINIT(ndp, NAMEI_LOOKUP,
242 CNP_LOCKLEAF | CNP_FOLLOW | CNP_SAVENAME,
243 UIO_SYSSPACE, imgp->interpreter_name, td);
248 * Copy out strings (args and env) and initialize stack base
250 stack_base = exec_copyout_strings(imgp);
251 p->p_vmspace->vm_minsaddr = (char *)stack_base;
254 * If custom stack fixup routine present for this process
255 * let it do the stack setup.
256 * Else stuff argument count as first item on stack
258 if (p->p_sysent->sv_fixup)
259 (*p->p_sysent->sv_fixup)(&stack_base, imgp);
261 suword(--stack_base, imgp->args->argc);
264 * For security and other reasons, the file descriptor table cannot
265 * be shared after an exec.
267 if (p->p_fd->fd_refcnt > 1) {
268 struct filedesc *tmp;
276 * For security and other reasons, signal handlers cannot
277 * be shared after an exec. The new proces gets a copy of the old
278 * handlers. In execsigs(), the new process will have its signals
281 if (p->p_procsig->ps_refcnt > 1) {
282 struct procsig *newprocsig;
284 MALLOC(newprocsig, struct procsig *, sizeof(struct procsig),
285 M_SUBPROC, M_WAITOK);
286 bcopy(p->p_procsig, newprocsig, sizeof(*newprocsig));
287 p->p_procsig->ps_refcnt--;
288 p->p_procsig = newprocsig;
289 p->p_procsig->ps_refcnt = 1;
290 if (p->p_sigacts == &p->p_addr->u_sigacts)
291 panic("shared procsig but private sigacts?");
293 p->p_addr->u_sigacts = *p->p_sigacts;
294 p->p_sigacts = &p->p_addr->u_sigacts;
300 /* close files on exec */
303 /* reset caught signals */
306 /* name this process - nameiexec(p, ndp) */
307 len = min(ndp->ni_cnd.cn_namelen,MAXCOMLEN);
308 bcopy(ndp->ni_cnd.cn_nameptr, p->p_comm, len);
312 * mark as execed, wakeup the process that vforked (if any) and tell
313 * it that it now has its own resources back
316 if (p->p_pptr && (p->p_flag & P_PPWAIT)) {
317 p->p_flag &= ~P_PPWAIT;
318 wakeup((caddr_t)p->p_pptr);
322 * Implement image setuid/setgid.
324 * Don't honor setuid/setgid if the filesystem prohibits it or if
325 * the process is being traced.
327 if ((((attr.va_mode & VSUID) && p->p_ucred->cr_uid != attr.va_uid) ||
328 ((attr.va_mode & VSGID) && p->p_ucred->cr_gid != attr.va_gid)) &&
329 (imgp->vp->v_mount->mnt_flag & MNT_NOSUID) == 0 &&
330 (p->p_flag & P_TRACED) == 0) {
332 * Turn off syscall tracing for set-id programs, except for
333 * root. Record any set-id flags first to make sure that
334 * we do not regain any tracing during a possible block.
337 if (p->p_tracep && suser(td)) {
340 if ((vtmp = p->p_tracep) != NULL) {
346 /* Close any file descriptors 0..2 that reference procfs */
348 /* Make sure file descriptors 0..2 are in use. */
349 error = fdcheckstd(p);
351 goto exec_fail_dealloc;
353 * Set the new credentials.
356 if (attr.va_mode & VSUID)
357 change_euid(attr.va_uid);
358 if (attr.va_mode & VSGID)
359 p->p_ucred->cr_gid = attr.va_gid;
362 * Clear local varsym variables
364 varsymset_clean(&p->p_varsymset);
366 if (p->p_ucred->cr_uid == p->p_ucred->cr_ruid &&
367 p->p_ucred->cr_gid == p->p_ucred->cr_rgid)
368 p->p_flag &= ~P_SUGID;
372 * Implement correct POSIX saved-id behavior.
374 if (p->p_ucred->cr_svuid != p->p_ucred->cr_uid ||
375 p->p_ucred->cr_svgid != p->p_ucred->cr_gid) {
377 p->p_ucred->cr_svuid = p->p_ucred->cr_uid;
378 p->p_ucred->cr_svgid = p->p_ucred->cr_gid;
382 * Store the vp for use in procfs
384 if (p->p_textvp) /* release old reference */
387 p->p_textvp = ndp->ni_vp;
390 * Notify others that we exec'd, and clear the P_INEXEC flag
391 * as we're now a bona fide freshly-execed process.
393 KNOTE(&p->p_klist, NOTE_EXEC);
394 p->p_flag &= ~P_INEXEC;
397 * If tracing the process, trap to debugger so breakpoints
398 * can be set before the program executes.
400 STOPEVENT(p, S_EXEC, 0);
402 if (p->p_flag & P_TRACED)
405 /* clear "fork but no exec" flag, as we _are_ execing */
406 p->p_acflag &= ~AFORK;
408 /* Set values passed into the program in registers. */
409 setregs(p, imgp->entry_addr, (u_long)(uintptr_t)stack_base,
412 /* Free any previous argument cache */
413 if (p->p_args && --p->p_args->ar_ref == 0)
414 FREE(p->p_args, M_PARGS);
417 /* Cache arguments if they fit inside our allowance */
418 i = imgp->args->begin_envv - imgp->args->begin_argv;
419 if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
420 MALLOC(p->p_args, struct pargs *, sizeof(struct pargs) + i,
422 p->p_args->ar_ref = 1;
423 p->p_args->ar_length = i;
424 bcopy(imgp->args->begin_argv, p->p_args->ar_args, i);
430 * free various allocated resources
433 exec_unmap_first_page(imgp);
435 if (imgp->image_header != NULL)
436 kmem_free_wakeup(exec_map, (vm_offset_t)imgp->image_header,
440 NDFREE(ndp, NDF_ONLY_PNBUF);
448 /* we're done here, clear P_INEXEC */
449 p->p_flag &= ~P_INEXEC;
450 if (imgp->vmspace_destroyed) {
451 /* sorry, no more process anymore. exit gracefully */
452 exit1(W_EXITCODE(0, SIGABRT));
461 * execve() system call.
464 execve(struct execve_args *uap)
466 struct thread *td = curthread;
468 struct image_args args;
471 NDINIT(&nd, NAMEI_LOOKUP, CNP_LOCKLEAF | CNP_FOLLOW | CNP_SAVENAME,
472 UIO_USERSPACE, uap->fname, td);
474 error = exec_copyin_args(&args, uap->fname, PATH_USERSPACE,
475 uap->argv, uap->envv);
477 error = kern_execve(&nd, &args);
479 exec_free_args(&args);
482 * The syscall result is returned in registers to the new program.
483 * Linux will register %edx as an atexit function and we must be
484 * sure to set it to 0. XXX
487 uap->sysmsg_result64 = 0;
493 exec_map_first_page(struct image_params *imgp)
497 vm_page_t ma[VM_INITIAL_PAGEIN];
501 if (imgp->firstpage) {
502 exec_unmap_first_page(imgp);
505 VOP_GETVOBJECT(imgp->vp, &object);
508 ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
510 if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) {
511 initial_pagein = VM_INITIAL_PAGEIN;
512 if (initial_pagein > object->size)
513 initial_pagein = object->size;
514 for (i = 1; i < initial_pagein; i++) {
515 if ((ma[i] = vm_page_lookup(object, i)) != NULL) {
516 if ((ma[i]->flags & PG_BUSY) || ma[i]->busy)
522 ma[i] = vm_page_alloc(object, i, VM_ALLOC_NORMAL);
529 rv = vm_pager_get_pages(object, ma, initial_pagein, 0);
530 ma[0] = vm_page_lookup(object, 0);
532 if ((rv != VM_PAGER_OK) || (ma[0] == NULL) || (ma[0]->valid == 0)) {
534 vm_page_protect(ma[0], VM_PROT_NONE);
543 vm_page_wakeup(ma[0]);
546 pmap_kenter((vm_offset_t) imgp->image_header, VM_PAGE_TO_PHYS(ma[0]));
547 imgp->firstpage = ma[0];
553 exec_unmap_first_page(imgp)
554 struct image_params *imgp;
556 if (imgp->firstpage) {
557 pmap_kremove((vm_offset_t) imgp->image_header);
558 vm_page_unwire(imgp->firstpage, 1);
559 imgp->firstpage = NULL;
564 * Destroy old address space, and allocate a new stack
565 * The new stack is only SGROWSIZ large because it is grown
566 * automatically in trap.c.
569 exec_new_vmspace(imgp)
570 struct image_params *imgp;
573 struct vmspace *vmspace = imgp->proc->p_vmspace;
574 vm_offset_t stack_addr = USRSTACK - maxssiz;
575 vm_map_t map = &vmspace->vm_map;
577 imgp->vmspace_destroyed = 1;
580 * Prevent a pending AIO from modifying the new address space.
582 aio_proc_rundown(imgp->proc);
585 * Blow away entire process VM, if address space not shared,
586 * otherwise, create a new VM space so that other threads are
589 if (vmspace->vm_refcnt == 1) {
591 pmap_remove_pages(vmspace_pmap(vmspace), 0, VM_MAXUSER_ADDRESS);
592 vm_map_remove(map, 0, VM_MAXUSER_ADDRESS);
594 vmspace_exec(imgp->proc);
595 vmspace = imgp->proc->p_vmspace;
596 map = &vmspace->vm_map;
599 /* Allocate a new stack */
600 error = vm_map_stack(&vmspace->vm_map, stack_addr, (vm_size_t)maxssiz,
601 VM_PROT_ALL, VM_PROT_ALL, 0);
605 /* vm_ssize and vm_maxsaddr are somewhat antiquated concepts in the
606 * VM_STACK case, but they are still used to monitor the size of the
607 * process stack so we can check the stack rlimit.
609 vmspace->vm_ssize = sgrowsiz >> PAGE_SHIFT;
610 vmspace->vm_maxsaddr = (char *)USRSTACK - maxssiz;
616 * Copy out argument and environment strings from the old process
617 * address space into the temporary string buffer.
620 exec_copyin_args(struct image_args *args, char *fname,
621 enum exec_path_segflg segflg, char **argv, char **envv)
627 bzero(args, sizeof(*args));
628 args->buf = (char *) kmem_alloc_wait(exec_map, PATH_MAX + ARG_MAX);
629 if (args->buf == NULL)
631 args->begin_argv = args->buf;
632 args->endp = args->begin_argv;
633 args->space = ARG_MAX;
635 args->fname = args->buf + ARG_MAX;
638 * Copy the file name.
640 if (segflg == PATH_SYSSPACE) {
641 error = copystr(fname, args->fname, PATH_MAX, &length);
642 } else if (segflg == PATH_USERSPACE) {
643 error = copyinstr(fname, args->fname, PATH_MAX, &length);
647 * extract argument strings
650 if (argv && error == 0) {
652 * The argv0 argument for execv() is allowed to be NULL,
653 * in which case we use our filename as argv[0].
654 * This guarantees that
655 * the interpreter knows what file to open in the case
656 * that we exec an interpreted file.
658 argp = (caddr_t) (intptr_t) fuword(argv);
660 length = strlen(args->fname) + 1;
661 KKASSERT(length <= args->space);
662 bcopy(args->fname, args->endp, length);
663 args->space -= length;
664 args->endp += length;
668 while ((argp = (caddr_t) (intptr_t) fuword(argv++))) {
669 if (argp == (caddr_t) -1) {
673 error = copyinstr(argp, args->endp,
674 args->space, &length);
675 if (error == ENAMETOOLONG)
679 args->space -= length;
680 args->endp += length;
685 args->begin_envv = args->endp;
688 * extract environment strings
690 if (envv && error == 0) {
691 while ((envp = (caddr_t) (intptr_t) fuword(envv++))) {
692 if (envp == (caddr_t) -1) {
696 error = copyinstr(envp, args->endp, args->space,
698 if (error == ENAMETOOLONG)
702 args->space -= length;
703 args->endp += length;
713 exec_free_args(struct image_args *args)
716 kmem_free_wakeup(exec_map,
717 (vm_offset_t)args->buf, PATH_MAX + ARG_MAX);
723 * Copy strings out to the new process address space, constructing
724 * new arg and env vector tables. Return a pointer to the base
725 * so that it can be used as the initial stack pointer.
728 exec_copyout_strings(struct image_params *imgp)
732 char *stringp, *destp;
733 register_t *stack_base;
734 struct ps_strings *arginfo;
738 * Calculate string base and vector table pointers.
739 * Also deal with signal trampoline code for this exec type.
741 arginfo = (struct ps_strings *)PS_STRINGS;
742 szsigcode = *(imgp->proc->p_sysent->sv_szsigcode);
743 destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE -
744 roundup((ARG_MAX - imgp->args->space), sizeof(char *));
750 copyout(imgp->proc->p_sysent->sv_sigcode,
751 ((caddr_t)arginfo - szsigcode), szsigcode);
754 * If we have a valid auxargs ptr, prepare some room
757 * The '+ 2' is for the null pointers at the end of each of the
758 * arg and env vector sets, and 'AT_COUNT*2' is room for the
762 vectp = (char **)(destp - (imgp->args->argc +
763 imgp->args->envc + 2 + AT_COUNT * 2) * sizeof(char*));
765 vectp = (char **)(destp - (imgp->args->argc +
766 imgp->args->envc + 2) * sizeof(char*));
770 * NOTE: don't bother aligning the stack here for GCC 2.x, it will
771 * be done in crt1.o. Note that GCC 3.x aligns the stack in main.
775 * vectp also becomes our initial stack base
777 stack_base = (register_t *)vectp;
779 stringp = imgp->args->begin_argv;
780 argc = imgp->args->argc;
781 envc = imgp->args->envc;
784 * Copy out strings - arguments and environment.
786 copyout(stringp, destp, ARG_MAX - imgp->args->space);
789 * Fill in "ps_strings" struct for ps, w, etc.
791 suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp);
792 suword(&arginfo->ps_nargvstr, argc);
795 * Fill in argument portion of vector table.
797 for (; argc > 0; --argc) {
798 suword(vectp++, (long)(intptr_t)destp);
799 while (*stringp++ != 0)
804 /* a null vector table pointer seperates the argp's from the envp's */
807 suword(&arginfo->ps_envstr, (long)(intptr_t)vectp);
808 suword(&arginfo->ps_nenvstr, envc);
811 * Fill in environment portion of vector table.
813 for (; envc > 0; --envc) {
814 suword(vectp++, (long)(intptr_t)destp);
815 while (*stringp++ != 0)
820 /* end of vector table is a null pointer */
827 * Check permissions of file to execute.
828 * Return 0 for success or error code on failure.
831 exec_check_permissions(imgp)
832 struct image_params *imgp;
834 struct proc *p = imgp->proc;
835 struct vnode *vp = imgp->vp;
836 struct vattr *attr = imgp->attr;
837 struct thread *td = p->p_thread;
840 /* Get file attributes */
841 error = VOP_GETATTR(vp, attr, td);
846 * 1) Check if file execution is disabled for the filesystem that this
848 * 2) Insure that at least one execute bit is on - otherwise root
849 * will always succeed, and we don't want to happen unless the
850 * file really is executable.
851 * 3) Insure that the file is a regular file.
853 if ((vp->v_mount->mnt_flag & MNT_NOEXEC) ||
854 ((attr->va_mode & 0111) == 0) ||
855 (attr->va_type != VREG)) {
860 * Zero length files can't be exec'd
862 if (attr->va_size == 0)
866 * Check for execute permission to file based on current credentials.
868 error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td);
873 * Check number of open-for-writes on the file and deny execution
876 if (vp->v_writecount)
880 * Call filesystem specific open routine (which does nothing in the
883 error = VOP_OPEN(vp, FREAD, p->p_ucred, td);
891 * Exec handler registration
894 exec_register(execsw_arg)
895 const struct execsw *execsw_arg;
897 const struct execsw **es, **xs, **newexecsw;
898 int count = 2; /* New slot and trailing NULL */
901 for (es = execsw; *es; es++)
903 newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK);
904 if (newexecsw == NULL)
908 for (es = execsw; *es; es++)
913 free(execsw, M_TEMP);
919 exec_unregister(execsw_arg)
920 const struct execsw *execsw_arg;
922 const struct execsw **es, **xs, **newexecsw;
926 panic("unregister with no handlers left?\n");
928 for (es = execsw; *es; es++) {
929 if (*es == execsw_arg)
934 for (es = execsw; *es; es++)
935 if (*es != execsw_arg)
937 newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK);
938 if (newexecsw == NULL)
941 for (es = execsw; *es; es++)
942 if (*es != execsw_arg)
946 free(execsw, M_TEMP);