[RFC PATCH 07/13] um: nommu: configure fs register on host syscall invocation

Johannes Berg johannes at sipsolutions.net
Fri Oct 25 02:28:01 PDT 2024


On Thu, 2024-10-24 at 21:09 +0900, Hajime Tazaki wrote:
> 
> +static void sigill(int sig, siginfo_t *si, void *ctx_void)
> +{
> +	longjmp(jmpbuf, 1);
> +}

Should this code use sigsetjmp/siglongjmp?

> +int os_has_fsgsbase(void)
> +{
> +	return has_fsgsbase;
> +}

Why should this be a function rather than just exposing the variable?

> +++ b/arch/um/os-Linux/time.c
> @@ -89,7 +89,8 @@ long long os_nsecs(void)
>  {
>  	struct timespec ts;
>  
> -	clock_gettime(CLOCK_MONOTONIC,&ts);
> +	clock_gettime(CLOCK_MONOTONIC, &ts);
> +
>  	return timespec_to_ns(&ts);

unrelated changes

>  #ifndef CONFIG_MMU
>  
> +static int os_x86_arch_prctl(int pid, int option, unsigned long *arg2)
> +{
> +	if (os_has_fsgsbase()) {
> +		switch (option) {
> +		case ARCH_SET_FS:
> +			wrfsbase(*arg2);
> +			break;
> +		case ARCH_SET_GS:
> +			wrgsbase(*arg2);
> +			break;
> +		case ARCH_GET_FS:
> +			*arg2 = rdfsbase();
> +			break;
> +		case ARCH_GET_GS:
> +			*arg2 = rdgsbase();
> +			break;
> +		}
> +		return 0;
> +	} else
> +		return os_arch_prctl(pid, option, arg2);

please use (or don't) {} on all branches


> @@ -39,4 +73,5 @@ __visible void do_syscall_64(struct pt_regs *regs)
>  			current_thread_info()->aux_fp_regs);
>  	}
>  }
> +
>  #endif

unrelated

johannes



More information about the linux-um mailing list