Re: git: b7fd86118fb5 - main - syscalls: sprinkle in const values

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Wed, 17 Nov 2021 22:04:42 UTC
On Wed, Nov 17, 2021 at 08:22:03PM +0000, Brooks Davis wrote:
> The branch main has been updated by brooks:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=b7fd86118fb5d41f61fdfa003d11e9367770ff0a
> 
> commit b7fd86118fb5d41f61fdfa003d11e9367770ff0a
> Author:     Brooks Davis <brooks@FreeBSD.org>
> AuthorDate: 2021-11-17 20:12:21 +0000
> Commit:     Brooks Davis <brooks@FreeBSD.org>
> CommitDate: 2021-11-17 20:12:21 +0000
> 
>     syscalls: sprinkle in const values
>     
>     Add missing const qualifiers to a number of syscall arguments.
>     
>     Obtained from:  CheriBSD
>     
>     Reviewed by:    kevans
> ---
>  sys/kern/syscalls.master | 32 ++++++++++++------------
>  sys/kern/systrace_args.c | 64 ++++++++++++++++++++++++------------------------
>  sys/kern/vfs_syscalls.c  | 10 ++++----
>  sys/sys/syscallsubr.h    | 13 +++++-----
>  sys/sys/sysproto.h       | 32 ++++++++++++------------
:(

> @@ -501,7 +501,7 @@
>  	}
>  74	AUE_MPROTECT	STD|CAPENABLED {
>  		int mprotect(
> -		    _In_ void *addr,
> +		    _In_ const void *addr,
>  		    size_t len,
>  		    int prot
>  		);
You did not marked addr for munmap(2) as const, but did this for mprotect(2).
I believe that this is the right interpretation for munmap, but not for
mprotect due to PROT_NONE.

Or at least it should be consistent WRT allowed side effects on access.