sparc_pipe(2)
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 00:12:24 +0000
Quoted 2 lines
Am I missing something here, or is it simply that the thing predates
current_pt_regs()?
It probably just predates current_pt_regs(), yes.
Quoted 7 lines · David Miller
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 00:12:24 +0000Quoted 2 lines
Am I missing something here, or is it simply that the thing predates
current_pt_regs()?It probably just predates
current_pt_regs(), yes.
OK... Another fun question in the same area:
asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
{
if ((int)high < 0)
return -EINVAL;
else
return sys_ftruncate(fd, (high << 32) | low);
}Is there any reason we want to check high right there? After all, sys_ftruncate() will produce exactly that on MSB of its second argument set... The same goes for sys32_truncate() - sys_truncate() will yield -EINVAL on negative loff_t.
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 03:42:00 +0000
Quoted 18 lines · David Miller
Quoted 7 lines
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 00:12:24 +0000Quoted 2 lines
Am I missing something here, or is it simply that the thing predates
current_pt_regs()?It probably just predates
current_pt_regs(), yes.OK... Another fun question in the same area:
asmlinkage longsys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low){ if ((int)high < 0) return -EINVAL; else return sys_ftruncate(fd, (high << 32) | low); }
Quoted 4 lines
Is there any reason we want to check high right there? After all,
sys_ftruncate()will produce exactly that on MSB of its second argument set... The same goes forsys32_truncate()-sys_truncate()will yield-EINVALon negativeloff_t.
Indeed, both checks look like they are extraneous.
Quoted 6 lines · David Miller
Quoted 4 lines
Is there any reason we want to check high right there? After all,
sys_ftruncate()will produce exactly that on MSB of its second argument set... The same goes forsys32_truncate()-sys_truncate()will yield-EINVALon negativeloff_t.Indeed, both checks look like they are extraneous.
While looking through the syscall wrappers there:sys_sigreturn:
call do_sigreturn
add %sp, STACKFRAME_SZ, %o0
ld [%curptr + TI_FLAGS], %l5
andcc %l5, _TIF_SYSCALL_TRACE, %g0
be 1f
nop
call syscall_trace
mov 1, %o1
which seems to rely upon do_sigreturn() leaving its %i0 alone, while sys_rt_sigreturn:
call do_rt_sigreturn
add %sp, STACKFRAME_SZ, %o0
ld [%curptr + TI_FLAGS], %l5
andcc %l5, _TIF_SYSCALL_TRACE, %g0
be 1f
nop
add %sp, STACKFRAME_SZ, %o0
call syscall_trace
mov 1, %o1
doesn't count upon the same for do_rt_sigreturn(). I'm not saying that any of that is in any way critical (sparc32 kernel, for fsck sake...), just curious about the difference here. IIRC, there's nothing to prevent void foo(void *p) stomping on its %i0; it's unlikely to happen in either case, but why the difference in callers?
Anyway, I've put together some cleanups ({COMPAT_,}SYSCALL_DEFINE conversions, getting rid of SIGN... wrappers) in git.kernel.org:/pub/scm/linux/kernel/git/viro/vfs.git misc.sparc Do you see any obviour problems with the stuff in there? It's not urgent - the real fun with compat wrappers will be on mips and s390, anyway; sparc is fairly benign in that respect...
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 17:02:26 +0000
Quoted 22 lines
While looking through the syscall wrappers there:
sys_sigreturn:
calldo_sigreturn
add %sp,STACKFRAME_SZ, %o0ld [%curptr +
TI_FLAGS], %l5
andcc %l5,_TIF_SYSCALL_TRACE, %g0
be 1f
nopcall
syscall_trace
mov 1, %o1
which seems to rely upondo_sigreturn()leaving its %i0 alone, whilesys_rt_sigreturn:
calldo_rt_sigreturn
add %sp,STACKFRAME_SZ, %o0ld [%curptr +
TI_FLAGS], %l5
andcc %l5,_TIF_SYSCALL_TRACE, %g0
be 1f
nop
Quoted 8 lines
add %sp,
STACKFRAME_SZ, %o0
callsyscall_trace
mov 1, %o1
doesn't count upon the same fordo_rt_sigreturn(). I'm not saying that any of that is in any way critical (sparc32 kernel, for fsck sake...), just curious about the difference here. IIRC, there's nothing to prevent voidfoo(void *p)stomping on its %i0; it's unlikely to happen in either case, but why the difference in callers?
Good catch, I think %o0 has to be reloaded in the do_sigreturn case.
Quoted 6 lines
Anyway, I've put together some cleanups ({COMPAT_,}SYSCALL_DEFINE conversions, getting rid of SIGN... wrappers) in git.kernel.org:/pub/scm/linux/kernel/git/viro/vfs.git misc.sparc Do you see any obviour problems with the stuff in there? It's not urgent - the real fun with compat wrappers will be on mips and s390, anyway; sparc is fairly benign in that respect...
Nothing in there seems objectionable to me.
Thanks Al!
Quoted 8 lines · David Miller
Quoted 6 lines
Anyway, I've put together some cleanups ({COMPAT_,}SYSCALL_DEFINE conversions, getting rid of SIGN... wrappers) in git.kernel.org:/pub/scm/linux/kernel/git/viro/vfs.git misc.sparc Do you see any obviour problems with the stuff in there? It's not urgent - the real fun with compat wrappers will be on mips and s390, anyway; sparc is fairly benign in that respect...
Nothing in there seems objectionable to me.
More oddities: in commit b340b81a6554facb1b2fbe68691e254d53315d20
Author: David S. Miller <[email protected]>
Date: Sun Nov 3 09:24:46 2002 -0800
[SPARC]: Add sys_remap_file_pages syscalls.
we have
int sparc_remap_file_pages(unsigned long start, unsigned long size,
unsigned long prot, unsigned long pgoff, unsigned long flags)
{
/* This works on an existing mmap so we don't need to validate
* the range as that was done at the original mmap call.
*/
return sys_remap_file_pages(start, size, prot,
(pgoff >> (PAGE_SHIFT - 12)), flags);
}put into native 32bit syscall table and plain sys_remap_file_pages() into 64bit ones - both native and compat. AFAICS, that would have remap_file_pages() in 32bit binary operate in units of 4Kb on 32bit host and PAGE_SIZE - on 64bit one.
Confused...
Other interesting differences:
* no getpeername() or getsockname() in compat table; AFAICS,
for both the native syscall should work...
* #254 is ni_syscall() on native an nis_syscall() on compat,
#267 is the other way round. Huh? What are the rules for ni vs. nis, anyway? I understand that the former is quiet and the latter reports attempts to issue the syscall in question, but how do we choose which one to use for given unimplemented syscall?
From: Al Viro <[email protected]>
Date: Tue, 20 Mar 2018 23:02:12 +0000
Quoted 14 lines
[SPARC]: Add
sys_remap_file_pagessyscalls.we have
int sparc_remap_file_pages(unsigned long start, unsigned long size,
unsigned long prot, unsigned long pgoff, unsigned long flags){ /* This works on an existing mmap so we don't need to validate * the range as that was done at the original mmap call. */ return sys_remap_file_pages(start, size, prot, (pgoff >> (PAGE_SHIFT - 12)), flags); }
Quoted 4 lines
put into native 32bit syscall table and plain
sys_remap_file_pages()into 64bit ones - both native and compat. AFAICS, that would haveremap_file_pages()in 32bit binary operate in units of 4Kb on 32bit host andPAGE_SIZE- on 64bit one.
That's bogus, 32-bit binary should use system page size, rather than a fixed 4K value.
Quoted 3 lines
Other interesting differences:
* nogetpeername()orgetsockname()in compat table; AFAICS,
for both the native syscall should work...
The 32-bit userspace never used these and instead went through socketcall(), so I simply never added them to the syscall table.
Quoted 5 lines
* #254 is
ni_syscall()on native annis_syscall()on compat,
#267 is the other way round. Huh? What are the rules for ni vs. nis, anyway? I understand that the former is quiet and the latter reports attempts to issue the syscall in question, but how do we choose which one to use for given unimplemented syscall?
I think they should all be quiet, and the warning is of limited to no value these days.