bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
PATCH 1/1 bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
The capsicum signal stuff is new with FreeBSD 14, rev 1400026, so only copy them on a new enough system.
--- bsd-user/signal.c | 4 ++++ 1 file changed, 4 insertions(+)
bsd-user/signal.c +4 -0
@@ -242,8 +242,10 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,* one, then we know what to save. */ if (sig ==TARGET_SIGTRAP ) { +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 tinfo->_reason._capsicum._syscall = info->_reason._capsicum._syscall; +#endif si_type =QEMU_SI_CAPSICUM ; }break ;
@@ -296,8 +298,10 @@ static void tswap_siginfo(target_siginfo_t *tinfo, const target_siginfo_t *info)__put_user (info->_reason._poll._band, &tinfo->_reason._poll._band);break ;case QEMU_SI_CAPSICUM : +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 __put_user (info->_reason._capsicum._syscall, &tinfo->_reason._capsicum._syscall); +#endif break ;default :g_assert_not_reached ();
Signature · 1 line
2.33.1
Quoted 13 lines · Warner Losh
The capsicum signal stuff is new with FreeBSD 14, rev 1400026, so only copy them on a new enough system.
Signed-off-by Warner Losh <[email protected]>--- bsd-user/signal.c | 4 ++++ 1 file changed, 4 insertions(+)bsd-user/signal.c +0
-0
bsd-user/signal.c static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, · line 250
Quoted 9 lines
bsd-user/signal.c +2
-0@@ -242,8 +242,10 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,* one, then we know what to save. */ if (sig ==TARGET_SIGTRAP ) { +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 tinfo->_reason._capsicum._syscall = info->_reason._capsicum._syscall; +#endif si_type =QEMU_SI_CAPSICUM ; }
Do you really want the entire IF inside the ifdef? Setting QEMU_SI_CAPSICUM doesn't make sense for earlier versions...
r~
Quoted 12 lines
bsd-user/signal.c +2
-0break ;@@ -296,8 +298,10 @@ static void tswap_siginfo(target_siginfo_t *tinfo, const target_siginfo_t *info)__put_user (info->_reason._poll._band, &tinfo->_reason._poll._band);break ;case QEMU_SI_CAPSICUM : +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 __put_user (info->_reason._capsicum._syscall, &tinfo->_reason._capsicum._syscall); +#endif break ;default :g_assert_not_reached ();
Quoted 15 lines · Richard Henderson
bsd-user/signal.c static inline void
Quoted 13 lines · Warner Losh
The capsicum signal stuff is new with FreeBSD 14, rev 1400026, so only copy them on a new enough system.
Signed-off-by Warner Losh <[email protected]>--- bsd-user/signal.c | 4 ++++ 1 file changed, 4 insertions(+)bsd-user/signal.c +0
-0@@ -242,8 +242,10 @@ static inline voidhost_to_target_siginfo_noswap(target_siginfo_t *tinfo,
Quoted 13 lines
bsd-user/signal.c static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo, · line 250
Quoted 9 lines
bsd-user/signal.c +2
-0* one, then we know what to save. */ if (sig ==TARGET_SIGTRAP ) { +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 tinfo->_reason._capsicum._syscall = info->_reason._capsicum._syscall; +#endif si_type =QEMU_SI_CAPSICUM ; }Do you really want the entire IF inside the ifdef? Setting
QEMU_SI_CAPSICUMdoesn't make sense for earlier versions...
True. In fact, not defining it at all on earlier versions would be safer to ensure
all the places where we might want to touch this we'll get a compiler warning
as well as to communicate this is only for earlier versions w/o sprinkling the
version through the code. I'll update with this suggestion.
Warner
Quoted 19 lines
r~
bsd-user/signal.c static void tswap_siginfo(target_siginfo_t *tinfo,
Quoted 2 lines
bsd-user/signal.c +0
-0break ;@@ -296,8 +298,10 @@ static void tswap_siginfo(target_siginfo_t *tinfo,const
target_siginfo_t*info)bsd-user/signal.c static void tswap_siginfo(target_siginfo_t *tinfo, · line 298
Quoted 1 line
bsd-user/signal.c +0
-0__put_user(info->_reason._poll._band,
&tinfo->_reason._poll._band);Quoted 9 lines
bsd-user/signal.c +2
-0break ;case QEMU_SI_CAPSICUM : +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 __put_user (info->_reason._capsicum._syscall, &tinfo->_reason._capsicum._syscall); +#endif break ;default :g_assert_not_reached ();
This fixes a build regression. The _capsicum member was added on -current recently, and isn't in FreeBSD 12 or 13. This fixes the build regression there.
My apologies...
Warner
Quoted 41 lines · Warner Losh
The capsicum signal stuff is new with FreeBSD 14, rev 1400026, so only copy them on a new enough system.
Signed-off-by Warner Losh <[email protected]>--- bsd-user/signal.c | 4 ++++ 1 file changed, 4 insertions(+)bsd-user/signal.c +2
-0@@ -242,8 +242,10 @@ static inline voidhost_to_target_siginfo_noswap(target_siginfo_t *tinfo, * one, then we know what to save. */ if (sig ==TARGET_SIGTRAP ) { +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 tinfo->_reason._capsicum._syscall = info->_reason._capsicum._syscall; +#endif si_type =QEMU_SI_CAPSICUM ; }break;bsd-user/signal.c +2
-0@@ -296,8 +298,10 @@ static void tswap_siginfo(target_siginfo_t *tinfo, const target_siginfo_t *info) __put_user(info->_reason._poll._band, &tinfo->_reason._poll._band);break ;case QEMU_SI_CAPSICUM : +#if defined(__FreeBSD_version) && __FreeBSD_version >=1400026 __put_user (info->_reason._capsicum._syscall, &tinfo->_reason._capsicum._syscall); +#endif break ;default: g_assert_not_reached();--
2.33.1