const poison the new pointer of __sysctl.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18444
This commit is contained in:
Brooks Davis 2018-12-18 12:44:38 +00:00
parent 12df38ad62
commit 10f7b12c13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342190
4 changed files with 8 additions and 8 deletions

View File

@ -388,7 +388,7 @@
uint32_t length1, uint32_t length2); }
202 AUE_SYSCTL STD { int freebsd32___sysctl(int *name, \
u_int namelen, void *old, \
uint32_t *oldlenp, void *new, \
uint32_t *oldlenp, const void *new, \
uint32_t newlen); }
203 AUE_MLOCK NOPROTO { int mlock(const void *addr, \
size_t len); }

View File

@ -1772,7 +1772,7 @@ sysctl_new_kernel(struct sysctl_req *req, void *p, size_t l)
return (0);
if (req->newlen - req->newidx < l)
return (EINVAL);
bcopy((char *)req->newptr + req->newidx, p, l);
bcopy((const char *)req->newptr + req->newidx, p, l);
req->newidx += l;
return (0);
}
@ -1898,7 +1898,7 @@ sysctl_new_user(struct sysctl_req *req, void *p, size_t l)
return (EINVAL);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"sysctl_new_user()");
error = copyin((char *)req->newptr + req->newidx, p, l);
error = copyin((const char *)req->newptr + req->newidx, p, l);
req->newidx += l;
return (error);
}
@ -2126,8 +2126,8 @@ sys___sysctl(struct thread *td, struct sysctl_args *uap)
*/
int
userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval,
int flags)
size_t *oldlenp, int inkernel, const void *new, size_t newlen,
size_t *retval, int flags)
{
int error = 0, memlocked;
struct sysctl_req req;

View File

@ -1209,7 +1209,7 @@
u_int namelen,
_Out_writes_bytes_opt_(*oldlenp) void *old,
_Inout_opt_ size_t *oldlenp,
_In_reads_bytes_opt_(newlen) void *new,
_In_reads_bytes_opt_(newlen) const void *new,
size_t newlen
);
} __sysctl sysctl_args int

View File

@ -165,7 +165,7 @@ struct sysctl_req {
size_t oldlen;
size_t oldidx;
int (*oldfunc)(struct sysctl_req *, const void *, size_t);
void *newptr;
const void *newptr;
size_t newlen;
size_t newidx;
int (*newfunc)(struct sysctl_req *, void *, size_t);
@ -1083,7 +1083,7 @@ int kernel_sysctlbyname(struct thread *td, char *name, void *old,
size_t *oldlenp, void *new, size_t newlen, size_t *retval,
int flags);
int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
size_t *oldlenp, int inkernel, void *new, size_t newlen,
size_t *oldlenp, int inkernel, const void *new, size_t newlen,
size_t *retval, int flags);
int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
int *nindx, struct sysctl_req *req);