mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
linux-user: Add FIFREEZE and FITHAW ioctls
linux-user: Implement PR_*_{CHILD_SUBREAPER,SPECULATION_CTRL,TID_ADDRESS} linux-user/elfload: Fixes for two Coverity CIDs tcg/aarch64: Fixes for two TCG_COND_TST{EQ,NE} bugs -----BEGIN PGP SIGNATURE----- iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmXwoYwdHHJpY2hhcmQu aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV99KwgAlUxbn0dPTXKmCkIE X+FAUllPYCZJwpTCa1h3P8taczLLeAocI4/iJxUudBE77I0HY7jv4FRnWrrdHr/V rQXjNkpQUByWr0Y4MB6Gl1+AKYo2SNqVHNP5AI4DdgDeSASXhP1aSlT5h4V4gdeX 1OwSnTQfONInJaoOQ7QQRf3JShKSYZSO7/sjMlJrubgGJBP8ivPxyPKiGbX3zUBS 6fI/ICLewC/g1fLPKaMHmqdrPK30ubPSGtnKdcz0q5NsT3hy6QWgtrQs5WAf3Liz 9WKGbq/y+qaFyLHat2tBpDnzT1Jso1SlIMkxL8kau3g6Pvk91E/pZjF5K3JOG8By PR4uQA== =FckT -----END PGP SIGNATURE----- Merge tag 'pull-tcg-20240312' of https://gitlab.com/rth7680/qemu into staging linux-user: Add FIFREEZE and FITHAW ioctls linux-user: Implement PR_*_{CHILD_SUBREAPER,SPECULATION_CTRL,TID_ADDRESS} linux-user/elfload: Fixes for two Coverity CIDs tcg/aarch64: Fixes for two TCG_COND_TST{EQ,NE} bugs # -----BEGIN PGP SIGNATURE----- # # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmXwoYwdHHJpY2hhcmQu # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV99KwgAlUxbn0dPTXKmCkIE # X+FAUllPYCZJwpTCa1h3P8taczLLeAocI4/iJxUudBE77I0HY7jv4FRnWrrdHr/V # rQXjNkpQUByWr0Y4MB6Gl1+AKYo2SNqVHNP5AI4DdgDeSASXhP1aSlT5h4V4gdeX # 1OwSnTQfONInJaoOQ7QQRf3JShKSYZSO7/sjMlJrubgGJBP8ivPxyPKiGbX3zUBS # 6fI/ICLewC/g1fLPKaMHmqdrPK30ubPSGtnKdcz0q5NsT3hy6QWgtrQs5WAf3Liz # 9WKGbq/y+qaFyLHat2tBpDnzT1Jso1SlIMkxL8kau3g6Pvk91E/pZjF5K3JOG8By # PR4uQA== # =FckT # -----END PGP SIGNATURE----- # gpg: Signature made Tue 12 Mar 2024 18:40:12 GMT # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * tag 'pull-tcg-20240312' of https://gitlab.com/rth7680/qemu: tcg/aarch64: Fix tcg_out_brcond for test comparisons tcg/aarch64: Fix tcg_out_cmp for test comparisons linux-user/elfload: Fully initialize struct target_elf_prpsinfo linux-user/elfload: Don't close an unopened file descriptor linux-user: Implement PR_GET_TID_ADDRESS linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER linux-user: Add FIFREEZE and FITHAW ioctls Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
a1932d7cd6
|
@ -4204,7 +4204,14 @@ static void fill_prpsinfo_note(void *data, const TaskState *ts)
|
|||
* may well have higher alignment requirements, fill locally and
|
||||
* memcpy to the destination afterward.
|
||||
*/
|
||||
struct target_elf_prpsinfo psinfo;
|
||||
struct target_elf_prpsinfo psinfo = {
|
||||
.pr_pid = getpid(),
|
||||
.pr_ppid = getppid(),
|
||||
.pr_pgrp = getpgrp(),
|
||||
.pr_sid = getsid(0),
|
||||
.pr_uid = getuid(),
|
||||
.pr_gid = getgid(),
|
||||
};
|
||||
char *base_filename;
|
||||
size_t len;
|
||||
|
||||
|
@ -4217,13 +4224,6 @@ static void fill_prpsinfo_note(void *data, const TaskState *ts)
|
|||
}
|
||||
}
|
||||
|
||||
psinfo.pr_pid = getpid();
|
||||
psinfo.pr_ppid = getppid();
|
||||
psinfo.pr_pgrp = getpgrp();
|
||||
psinfo.pr_sid = getsid(0);
|
||||
psinfo.pr_uid = getuid();
|
||||
psinfo.pr_gid = getgid();
|
||||
|
||||
base_filename = g_path_get_basename(ts->bprm->filename);
|
||||
/*
|
||||
* Using strncpy here is fine: at max-length,
|
||||
|
@ -4522,7 +4522,9 @@ static int elf_core_dump(int signr, const CPUArchState *env)
|
|||
ret = -errno;
|
||||
mmap_unlock();
|
||||
cpu_list_unlock();
|
||||
close(fd);
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* USE_ELF_CORE_DUMP */
|
||||
|
|
|
@ -134,6 +134,12 @@
|
|||
IOCTL(FICLONE, IOC_W, TYPE_INT)
|
||||
IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
|
||||
#endif
|
||||
#ifdef FIFREEZE
|
||||
IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT)
|
||||
#endif
|
||||
#ifdef FITHAW
|
||||
IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT)
|
||||
#endif
|
||||
|
||||
IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
|
||||
#ifdef CONFIG_FIEMAP
|
||||
|
|
|
@ -6450,16 +6450,28 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
|
|||
case PR_SET_NO_NEW_PRIVS:
|
||||
case PR_GET_IO_FLUSHER:
|
||||
case PR_SET_IO_FLUSHER:
|
||||
case PR_SET_CHILD_SUBREAPER:
|
||||
case PR_GET_SPECULATION_CTRL:
|
||||
case PR_SET_SPECULATION_CTRL:
|
||||
/* Some prctl options have no pointer arguments and we can pass on. */
|
||||
return get_errno(prctl(option, arg2, arg3, arg4, arg5));
|
||||
|
||||
case PR_GET_CHILD_SUBREAPER:
|
||||
case PR_SET_CHILD_SUBREAPER:
|
||||
case PR_GET_SPECULATION_CTRL:
|
||||
case PR_SET_SPECULATION_CTRL:
|
||||
{
|
||||
int val;
|
||||
ret = get_errno(prctl(PR_GET_CHILD_SUBREAPER, &val,
|
||||
arg3, arg4, arg5));
|
||||
if (!is_error(ret) && put_user_s32(val, arg2)) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
case PR_GET_TID_ADDRESS:
|
||||
/* TODO */
|
||||
return -TARGET_EINVAL;
|
||||
{
|
||||
TaskState *ts = env_cpu(env)->opaque;
|
||||
return put_user_ual(ts->child_tidptr, arg2);
|
||||
}
|
||||
|
||||
case PR_GET_FPEXC:
|
||||
case PR_SET_FPEXC:
|
||||
|
|
|
@ -943,6 +943,9 @@ struct target_rtc_pll_info {
|
|||
#define TARGET_FICLONE TARGET_IOW(0x94, 9, abi_int)
|
||||
#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
|
||||
|
||||
#define TARGET_FIFREEZE TARGET_IOWR('X', 119, abi_int)
|
||||
#define TARGET_FITHAW TARGET_IOWR('X', 120, abi_int)
|
||||
|
||||
/*
|
||||
* Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION>
|
||||
* claim type "long" but the actual type used by the kernel is "int".
|
||||
|
|
|
@ -1388,8 +1388,7 @@ static void tcg_out_cmp(TCGContext *s, TCGType ext, TCGCond cond, TCGReg a,
|
|||
if (!const_b) {
|
||||
tcg_out_insn(s, 3510, ANDS, ext, TCG_REG_XZR, a, b);
|
||||
} else {
|
||||
tcg_debug_assert(is_limm(b));
|
||||
tcg_out_logicali(s, I3404_ANDSI, 0, TCG_REG_XZR, a, b);
|
||||
tcg_out_logicali(s, I3404_ANDSI, ext, TCG_REG_XZR, a, b);
|
||||
}
|
||||
} else {
|
||||
if (!const_b) {
|
||||
|
@ -1465,6 +1464,7 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a,
|
|||
case TCG_COND_TSTNE:
|
||||
/* tst xN,0xffffffff; b.ne L -> cbnz wN,L */
|
||||
if (b_const && b == UINT32_MAX) {
|
||||
c = tcg_tst_eqne_cond(c);
|
||||
ext = TCG_TYPE_I32;
|
||||
need_cmp = false;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue