SMAP-detected direct userspace access
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);
Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in stac() and clac() (which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 11 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);
Quoted 9 lines
Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in
stac()andclac()(which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.
As far as 3.x is concerned, I don't think this direct access pattern is used there, this would have likely caused me some headaches for supporting the 32/64 mixed ABI models, and I don't remember of any such headache. At any rate, I don't see any reason to do this in 3.x.
Signature · 1 line
Philippe.
Quoted 7 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
Quoted 7 lines
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Since the user-space is copied from user-space a couple of lines above, This looks like a typo. Replacing umx->shadow_mutex with mx.shadow_mutex should avoid the issue.
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 11 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);
Quoted 8 lines
Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in
stac()andclac()(which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.
BTW, I believe most RTnet ioctls have this issue.
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 16 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Quoted 7 lines
Quoted 4 lines
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in
stac()andclac()(which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.BTW, I believe most RTnet ioctls have this issue.
Correct, long-pending deficit that will now start to bite back more seriously. I was always postponing this until some potential userspace ABI overhaul.
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://xenomai.org/pipermail/xenomai/attachments/20151227/f642dd2d/attachment.sig>
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in
stac()andclac()(which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.
Quoted 6 lines
Quoted 2 lines
BTW, I believe most RTnet ioctls have this issue.
Correct, long-pending deficit that will now start to bite back more seriously. I was always postponing this until some potential userspace ABI overhaul.
The ABI overhaul should happen in the 3.1 branch, hopefully real soon now (tm).
Signature · 2 lines
Gilles. https://click-hack.org
Quoted 26 lines · Gilles Chanteperdrix
Quoted 25 lines · Jan Kiszka
Quoted 23 lines · Gilles Chanteperdrix
Quoted 11 lines · Jan Kiszka
Hi all,
I know this is legacy code, but this is where we currently stumbled into it, and maybe the same pattern also exists in 3.x:
http://git.xenomai.org/xenomai-2.6.git/tree/ksrc/skins/posix/syscall.c#n1182
more precisely:
return pse51_mutex_check_init(&umx->shadow_mutex, attr);Quoted 8 lines
Here we pass the userspace object for initialization to the core instead of handing over the kernel shadow and then copying over the result. Is there a reason for this? Could we have more of such cases?
Background: SMAP detects and prevents any direct userspace memory access on x86 except or those that are wrapped in
stac()andclac()(which toggle a bit in eflags). Generally a useful feature we should allow to be enabled for robustness reasons.BTW, I believe most RTnet ioctls have this issue.
Quoted 7 lines
Quoted 3 lines
Correct, long-pending deficit that will now start to bite back more seriously. I was always postponing this until some potential userspace ABI overhaul.
The ABI overhaul should happen in the 3.1 branch, hopefully real soon now (tm).
Cool!
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://xenomai.org/pipermail/xenomai/attachments/20151227/3f2c07a0/attachment.sig>