* [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap()
2019-11-16 11:41 [PATCH 1/3] clone.2: Fix typos Christian Brauner
@ 2019-11-16 11:41 ` Christian Brauner
2019-11-17 18:01 ` Michael Kerrisk (man-pages)
2019-11-16 11:41 ` [PATCH 3/3] clone.2: Use pid_t for clone3() {child,parent}_tid Christian Brauner
2019-11-17 18:00 ` [PATCH 1/3] clone.2: Fix typos Michael Kerrisk (man-pages)
2 siblings, 1 reply; 6+ messages in thread
From: Christian Brauner @ 2019-11-16 11:41 UTC (permalink / raw)
To: mtk.manpages
Cc: adrian, akpm, arnd, avagin, christian.brauner, dhowells, fweimer,
jannh, keescook, linux-api, linux-kernel, linux-man, mingo, oleg,
xemul
From: Christian Brauner <christian.brauner@ubuntu.com>
If mmap() fails it will return MAP_FAILED which according to the manpage
is (void *)-1 not NULL.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
man2/clone.2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man2/clone.2 b/man2/clone.2
index 57a9eaba7..faff2ada6 100644
--- a/man2/clone.2
+++ b/man2/clone.2
@@ -1628,7 +1628,7 @@ main(int argc, char *argv[])
stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, \-1, 0);
- if (stack == NULL)
+ if (stack == MAP_FAILED)
errExit("mmap");
stackTop = stack + STACK_SIZE; /* Assume stack grows downward */
--
2.24.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap()
2019-11-16 11:41 ` [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap() Christian Brauner
@ 2019-11-17 18:01 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-11-17 18:01 UTC (permalink / raw)
To: Christian Brauner
Cc: mtk.manpages, adrian, akpm, arnd, avagin, christian.brauner,
dhowells, fweimer, jannh, keescook, linux-api, linux-kernel,
linux-man, mingo, oleg, xemul
On 11/16/19 12:41 PM, Christian Brauner wrote:
> From: Christian Brauner <christian.brauner@ubuntu.com>
>
> If mmap() fails it will return MAP_FAILED which according to the manpage
> is (void *)-1 not NULL.
Sigh! Bad editing on my part.
Thanks, Christian.
Patch applied.
Cheers,
Michael
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
> ---
> man2/clone.2 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man2/clone.2 b/man2/clone.2
> index 57a9eaba7..faff2ada6 100644
> --- a/man2/clone.2
> +++ b/man2/clone.2
> @@ -1628,7 +1628,7 @@ main(int argc, char *argv[])
>
> stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
> MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, \-1, 0);
> - if (stack == NULL)
> + if (stack == MAP_FAILED)
> errExit("mmap");
>
> stackTop = stack + STACK_SIZE; /* Assume stack grows downward */
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] clone.2: Use pid_t for clone3() {child,parent}_tid
2019-11-16 11:41 [PATCH 1/3] clone.2: Fix typos Christian Brauner
2019-11-16 11:41 ` [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap() Christian Brauner
@ 2019-11-16 11:41 ` Christian Brauner
2019-11-17 18:02 ` Michael Kerrisk (man-pages)
2019-11-17 18:00 ` [PATCH 1/3] clone.2: Fix typos Michael Kerrisk (man-pages)
2 siblings, 1 reply; 6+ messages in thread
From: Christian Brauner @ 2019-11-16 11:41 UTC (permalink / raw)
To: mtk.manpages
Cc: adrian, akpm, arnd, avagin, christian.brauner, dhowells, fweimer,
jannh, keescook, linux-api, linux-kernel, linux-man, mingo, oleg,
xemul
From: Christian Brauner <christian.brauner@ubuntu.com>
Advertise to userspace that they should use proper pid_t types for
arguments returning a pid.
The kernel-internal struct kernel_clone_args currently uses int as type
and since POSIX mandates that pid_t is a signed integer type and glibc
and friends use int this is not an issue. After the merge window for
v5.5 closes we can switch struct kernel_clone_args over to using pid_t
as well without any danger in regressing current userspace.
Also note, that the new set tid feature which will be merged for v5.5
uses pid_t types as well.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
man2/clone.2 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/man2/clone.2 b/man2/clone.2
index faff2ada6..bf2d7c731 100644
--- a/man2/clone.2
+++ b/man2/clone.2
@@ -183,9 +183,9 @@ is a structure of the following form:
struct clone_args {
u64 flags; /* Flags bit mask */
u64 pidfd; /* Where to store PID file descriptor
- (\fIint *\fP) */
+ (\fIpid_t *\fP) */
u64 child_tid; /* Where to store child TID,
- in child's memory (\fIint *\fP) */
+ in child's memory (\fIpid_t *\fP) */
u64 parent_tid; /* Where to store child TID,
in parent's memory (\fIint *\fP) */
u64 exit_signal; /* Signal to deliver to parent on
--
2.24.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] clone.2: Use pid_t for clone3() {child,parent}_tid
2019-11-16 11:41 ` [PATCH 3/3] clone.2: Use pid_t for clone3() {child,parent}_tid Christian Brauner
@ 2019-11-17 18:02 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-11-17 18:02 UTC (permalink / raw)
To: Christian Brauner
Cc: mtk.manpages, adrian, akpm, arnd, avagin, christian.brauner,
dhowells, fweimer, jannh, keescook, linux-api, linux-kernel,
linux-man, mingo, oleg, xemul
On 11/16/19 12:41 PM, Christian Brauner wrote:
> From: Christian Brauner <christian.brauner@ubuntu.com>
>
> Advertise to userspace that they should use proper pid_t types for
> arguments returning a pid.
> The kernel-internal struct kernel_clone_args currently uses int as type
> and since POSIX mandates that pid_t is a signed integer type and glibc
> and friends use int this is not an issue. After the merge window for
> v5.5 closes we can switch struct kernel_clone_args over to using pid_t
> as well without any danger in regressing current userspace.
> Also note, that the new set tid feature which will be merged for v5.5
> uses pid_t types as well.
Thanks taking a further pass throuh this page, Christian,
Patch applied.
Cheers,
Michael
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
> ---
> man2/clone.2 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/man2/clone.2 b/man2/clone.2
> index faff2ada6..bf2d7c731 100644
> --- a/man2/clone.2
> +++ b/man2/clone.2
> @@ -183,9 +183,9 @@ is a structure of the following form:
> struct clone_args {
> u64 flags; /* Flags bit mask */
> u64 pidfd; /* Where to store PID file descriptor
> - (\fIint *\fP) */
> + (\fIpid_t *\fP) */
> u64 child_tid; /* Where to store child TID,
> - in child's memory (\fIint *\fP) */
> + in child's memory (\fIpid_t *\fP) */
> u64 parent_tid; /* Where to store child TID,
> in parent's memory (\fIint *\fP) */
> u64 exit_signal; /* Signal to deliver to parent on
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] clone.2: Fix typos
2019-11-16 11:41 [PATCH 1/3] clone.2: Fix typos Christian Brauner
2019-11-16 11:41 ` [PATCH 2/3] clone.2: Check for MAP_FAILED not NULL on mmap() Christian Brauner
2019-11-16 11:41 ` [PATCH 3/3] clone.2: Use pid_t for clone3() {child,parent}_tid Christian Brauner
@ 2019-11-17 18:00 ` Michael Kerrisk (man-pages)
2 siblings, 0 replies; 6+ messages in thread
From: Michael Kerrisk (man-pages) @ 2019-11-17 18:00 UTC (permalink / raw)
To: Christian Brauner
Cc: mtk.manpages, adrian, akpm, arnd, avagin, christian.brauner,
dhowells, fweimer, jannh, keescook, linux-api, linux-kernel,
linux-man, mingo, oleg, xemul
On 11/16/19 12:41 PM, Christian Brauner wrote:
> From: Christian Brauner <christian.brauner@ubuntu.com>
Thanks, Christian,
Patch applied.
Cheers,
Michael
> Fix two spelling mistakes in manpage describing the clone{2,3}()
> syscalls/syscall wrappers.
>
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
> ---
> man2/clone.2 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/man2/clone.2 b/man2/clone.2
> index f67a60067..57a9eaba7 100644
> --- a/man2/clone.2
> +++ b/man2/clone.2
> @@ -70,12 +70,12 @@ create a new ("child") process, in a manner similar to
> .PP
> By contrast with
> .BR fork (2),
> -these system cals provide more precise control over what pieces of execution
> +these system calls provide more precise control over what pieces of execution
> context are shared between the calling process and the child process.
> For example, using these system calls, the caller can control whether
> or not the two processes share the virtual address space,
> the table of file descriptors, and the table of signal handlers.
> -These system calls also allow the new child process to placed
> +These system calls also allow the new child process to be placed
> in separate
> .BR namespaces (7).
> .PP
>
> base-commit: 91243dad42a7a62df73e3b1dfbb810adc1b8b654
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 6+ messages in thread