linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bug 216876] New: prototype for execveat() in the documentation appears wrong
@ 2023-01-02  3:47 bugzilla-daemon
  2023-01-02 15:26 ` [Bug 216876] " bugzilla-daemon
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: bugzilla-daemon @ 2023-01-02  3:47 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=216876

            Bug ID: 216876
           Summary: prototype for execveat() in the documentation appears
                    wrong
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: low
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages@kernel-bugs.osdl.org
          Reporter: markgaleck@gmail.com
        Regression: No

prototype for execveat() in the documentation is:

int execveat(int dirfd, const char *pathname,
                    const char *const argv[], const char *const envp[],
                    int flags);


This appears to be inconsistent with similar functions, other documentation,
and my sources (latest Ubuntu distribution). 


I think two of the "const" should be dropped so that we should have:

int execveat(int dirfd, const char *pathname,
                    char *const argv[], char *const envp[],
                    int flags);

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug 216876] prototype for execveat() in the documentation appears wrong
  2023-01-02  3:47 [Bug 216876] New: prototype for execveat() in the documentation appears wrong bugzilla-daemon
@ 2023-01-02 15:26 ` bugzilla-daemon
  2023-05-19 13:21 ` bugzilla-daemon
  2023-05-19 13:23 ` bugzilla-daemon
  2 siblings, 0 replies; 7+ messages in thread
From: bugzilla-daemon @ 2023-01-02 15:26 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=216876

--- Comment #1 from Florian Weimer (fweimer@redhat.com) ---
* Alejandro Colomar via Libc-alpha:

> It seems that glibc added a wrapper recently, and I didn't check that
> the prototype changed:
>
> alx@asus5775:~/src/gnu/glibc$ grepc execveat
> ./posix/unistd.h:300:
> extern int execveat (int __fd, const char *__path, char *const __argv[],
>                      char *const __envp[], int __flags)
>     __THROW __nonnull ((2, 3));
>
>
> ./sysdeps/unix/sysv/linux/execveat.c:25:
> int
> execveat (int dirfd, const char *path, char *const argv[], char *const
> envp[],
>           int flags)
> {
>   /* Avoid implicit array coercion in syscall macros.  */
>   return INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
>                             flags);
> }
>
>
> I CCd glibc so that they can comment.

POSIX uses these types for fexecve and execve, and it seemed right to be
consistent with that.

There are several more manual pages which do not specify the correct
prototype: open, openat, prctl.  I have received compiler bug reports
when people used function pointers modeled after the declarations of
open and prctl in the manual pages because of the ABI mismatch with the
glibc implementations.  The execveat difference is harmless in
comparison.

Thanks,
Florian

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug 216876] prototype for execveat() in the documentation appears wrong
  2023-01-02  3:47 [Bug 216876] New: prototype for execveat() in the documentation appears wrong bugzilla-daemon
  2023-01-02 15:26 ` [Bug 216876] " bugzilla-daemon
@ 2023-05-19 13:21 ` bugzilla-daemon
  2023-05-19 13:23 ` bugzilla-daemon
  2 siblings, 0 replies; 7+ messages in thread
From: bugzilla-daemon @ 2023-05-19 13:21 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=216876

--- Comment #2 from Alejandro Colomar (alx@kernel.org) ---
Fixed:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man2/execveat.2?id=0c884c2c515d20c8ecf246eef5208dc748b98e65>

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug 216876] prototype for execveat() in the documentation appears wrong
  2023-01-02  3:47 [Bug 216876] New: prototype for execveat() in the documentation appears wrong bugzilla-daemon
  2023-01-02 15:26 ` [Bug 216876] " bugzilla-daemon
  2023-05-19 13:21 ` bugzilla-daemon
@ 2023-05-19 13:23 ` bugzilla-daemon
  2 siblings, 0 replies; 7+ messages in thread
From: bugzilla-daemon @ 2023-05-19 13:23 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=216876

Alejandro Colomar (alx@kernel.org) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DOCUMENTED

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Bug 216876] New: prototype for execveat() in the documentation appears wrong
  2023-01-02 15:26   ` Florian Weimer
@ 2023-01-02 16:12     ` Alejandro Colomar
  0 siblings, 0 replies; 7+ messages in thread
From: Alejandro Colomar @ 2023-01-02 16:12 UTC (permalink / raw)
  To: Florian Weimer, Alejandro Colomar via Libc-alpha
  Cc: bugzilla-daemon, markgaleck, linux-man, Konstantin Ryabitsev


[-- Attachment #1.1: Type: text/plain, Size: 1575 bytes --]

Hi Florian,

On 1/2/23 16:26, Florian Weimer wrote:
> * Alejandro Colomar via Libc-alpha:
> 
>> It seems that glibc added a wrapper recently, and I didn't check that
>> the prototype changed:
>>
>> alx@asus5775:~/src/gnu/glibc$ grepc execveat
>> ./posix/unistd.h:300:
>> extern int execveat (int __fd, const char *__path, char *const __argv[],
>>                       char *const __envp[], int __flags)
>>      __THROW __nonnull ((2, 3));
>>
>>
>> ./sysdeps/unix/sysv/linux/execveat.c:25:
>> int
>> execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
>>            int flags)
>> {
>>    /* Avoid implicit array coercion in syscall macros.  */
>>    return INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
>> 			      flags);
>> }
>>
>>
>> I CCd glibc so that they can comment.
> 
> POSIX uses these types for fexecve and execve, and it seemed right to be
> consistent with that.
> 
> There are several more manual pages which do not specify the correct
> prototype: open, openat, prctl.  I have received compiler bug reports
> when people used function pointers modeled after the declarations of
> open and prctl in the manual pages because of the ABI mismatch with the
> glibc implementations.  The execveat difference is harmless in
> comparison.

That makes sense, and is what I guessed.  I just wanted to make sure that it was 
intentional.  I've updated the page to reflect the glibc wrapper.

Cheers,

Alex

> 
> Thanks,
> Florian
> 

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Bug 216876] New: prototype for execveat() in the documentation appears wrong
  2023-01-02 15:02 ` [Bug 216876] New: " Alejandro Colomar
@ 2023-01-02 15:26   ` Florian Weimer
  2023-01-02 16:12     ` Alejandro Colomar
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2023-01-02 15:26 UTC (permalink / raw)
  To: Alejandro Colomar via Libc-alpha
  Cc: bugzilla-daemon, markgaleck, linux-man, Alejandro Colomar,
	Konstantin Ryabitsev

* Alejandro Colomar via Libc-alpha:

> It seems that glibc added a wrapper recently, and I didn't check that
> the prototype changed:
>
> alx@asus5775:~/src/gnu/glibc$ grepc execveat
> ./posix/unistd.h:300:
> extern int execveat (int __fd, const char *__path, char *const __argv[],
>                      char *const __envp[], int __flags)
>     __THROW __nonnull ((2, 3));
>
>
> ./sysdeps/unix/sysv/linux/execveat.c:25:
> int
> execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
>           int flags)
> {
>   /* Avoid implicit array coercion in syscall macros.  */
>   return INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
> 			      flags);
> }
>
>
> I CCd glibc so that they can comment.

POSIX uses these types for fexecve and execve, and it seemed right to be
consistent with that.

There are several more manual pages which do not specify the correct
prototype: open, openat, prctl.  I have received compiler bug reports
when people used function pointers modeled after the declarations of
open and prctl in the manual pages because of the ABI mismatch with the
glibc implementations.  The execveat difference is harmless in
comparison.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Bug 216876] New: prototype for execveat() in the documentation appears wrong
       [not found] <bug-216876-216477@https.bugzilla.kernel.org/>
@ 2023-01-02 15:02 ` Alejandro Colomar
  2023-01-02 15:26   ` Florian Weimer
  0 siblings, 1 reply; 7+ messages in thread
From: Alejandro Colomar @ 2023-01-02 15:02 UTC (permalink / raw)
  To: bugzilla-daemon, GNU C Library, markgaleck, linux-man
  Cc: Konstantin Ryabitsev


[-- Attachment #1.1: Type: text/plain, Size: 3456 bytes --]

Hi,

On 1/2/23 04:47, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=216876
> 
>              Bug ID: 216876
>             Summary: prototype for execveat() in the documentation appears
>                      wrong
>             Product: Documentation
>             Version: unspecified
>            Hardware: All
>                  OS: Linux
>              Status: NEW
>            Severity: low
>            Priority: P1
>           Component: man-pages
>            Assignee: documentation_man-pages@kernel-bugs.osdl.org
>            Reporter: markgaleck@gmail.com
>          Regression: No
> 
> prototype for execveat() in the documentation is:
> 
> int execveat(int dirfd, const char *pathname,
>                      const char *const argv[], const char *const envp[],
>                      int flags);
> 
> 
> This appears to be inconsistent with similar functions, other documentation,
> and my sources (latest Ubuntu distribution).
> 
> 
> I think two of the "const" should be dropped so that we should have:
> 
> int execveat(int dirfd, const char *pathname,
>                      char *const argv[], char *const envp[],
>                      int flags);

Thanks for the report!

This was introduced in commit 71a25d4c79b1ccf538f6b813c834bbc4197f6370
"execveat.2: Fix prototype".

The reason is that the kernel uses the const:

alx@asus5775:~/src/linux/linux$ grepc execveat
./include/linux/compat.h:851:
asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
		     const compat_uptr_t __user *argv,
		     const compat_uptr_t __user *envp, int flags);


./include/linux/syscalls.h:1011:
asmlinkage long sys_execveat(int dfd, const char __user *filename,
			const char __user *const __user *argv,
			const char __user *const __user *envp, int flags);


./fs/exec.c:2096:
SYSCALL_DEFINE5(execveat,
		int, fd, const char __user *, filename,
		const char __user *const __user *, argv,
		const char __user *const __user *, envp,
		int, flags)
{
	return do_execveat(fd,
			   getname_uflags(filename, flags),
			   argv, envp, flags);
}


./fs/exec.c:2115:
COMPAT_SYSCALL_DEFINE5(execveat, int, fd,
		       const char __user *, filename,
		       const compat_uptr_t __user *, argv,
		       const compat_uptr_t __user *, envp,
		       int,  flags)
{
	return compat_do_execveat(fd,
				  getname_uflags(filename, flags),
				  argv, envp, flags);
}


It seems that glibc added a wrapper recently, and I didn't check that the 
prototype changed:

alx@asus5775:~/src/gnu/glibc$ grepc execveat
./posix/unistd.h:300:
extern int execveat (int __fd, const char *__path, char *const __argv[],
                      char *const __envp[], int __flags)
     __THROW __nonnull ((2, 3));


./sysdeps/unix/sysv/linux/execveat.c:25:
int
execveat (int dirfd, const char *path, char *const argv[], char *const envp[],
           int flags)
{
   /* Avoid implicit array coercion in syscall macros.  */
   return INLINE_SYSCALL_CALL (execveat, dirfd, path, &argv[0], &envp[0],
			      flags);
}


I CCd glibc so that they can comment.

Cheers,

Alex

P.S.:  There's some problem in bugzilla that it's not receiving my replies, so I 
CCed everyone involved so we can keep the discussion in the mailing list.

P.S.2:  Ping, Konstantin, please check that.

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-19 13:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02  3:47 [Bug 216876] New: prototype for execveat() in the documentation appears wrong bugzilla-daemon
2023-01-02 15:26 ` [Bug 216876] " bugzilla-daemon
2023-05-19 13:21 ` bugzilla-daemon
2023-05-19 13:23 ` bugzilla-daemon
     [not found] <bug-216876-216477@https.bugzilla.kernel.org/>
2023-01-02 15:02 ` [Bug 216876] New: " Alejandro Colomar
2023-01-02 15:26   ` Florian Weimer
2023-01-02 16:12     ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).