All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
@ 2022-02-01 20:52 Warner Losh
  2022-02-01 20:57 ` Warner Losh
  2022-02-01 21:06 ` Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Warner Losh @ 2022-02-01 20:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kyle Evans, richard.henderson, alex.bennee, Warner Losh, Peter Maydell

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 <imp@bsdimp.com>
---
 bsd-user/signal.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index ad22ba9d90d..b43266e6e06 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -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();
-- 
2.33.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
  2022-02-01 20:52 [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026 Warner Losh
@ 2022-02-01 20:57 ` Warner Losh
  2022-02-01 21:06 ` Richard Henderson
  1 sibling, 0 replies; 4+ messages in thread
From: Warner Losh @ 2022-02-01 20:57 UTC (permalink / raw)
  To: QEMU Developers
  Cc: Kyle Evans, Richard Henderson, Alex Bennée, Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]

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

On Tue, Feb 1, 2022 at 1:52 PM Warner Losh <imp@bsdimp.com> wrote:

> 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 <imp@bsdimp.com>
> ---
>  bsd-user/signal.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> index ad22ba9d90d..b43266e6e06 100644
> --- a/bsd-user/signal.c
> +++ b/bsd-user/signal.c
> @@ -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();
> --
> 2.33.1
>
>

[-- Attachment #2: Type: text/html, Size: 2220 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
  2022-02-01 20:52 [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026 Warner Losh
  2022-02-01 20:57 ` Warner Losh
@ 2022-02-01 21:06 ` Richard Henderson
  2022-02-01 21:23   ` Warner Losh
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2022-02-01 21:06 UTC (permalink / raw)
  To: Warner Losh, qemu-devel; +Cc: Kyle Evans, alex.bennee, Peter Maydell

On 2/2/22 07:52, Warner Losh wrote:
> 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 <imp@bsdimp.com>
> ---
>   bsd-user/signal.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> index ad22ba9d90d..b43266e6e06 100644
> --- a/bsd-user/signal.c
> +++ b/bsd-user/signal.c
> @@ -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~

>           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();



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026
  2022-02-01 21:06 ` Richard Henderson
@ 2022-02-01 21:23   ` Warner Losh
  0 siblings, 0 replies; 4+ messages in thread
From: Warner Losh @ 2022-02-01 21:23 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Kyle Evans, Alex Bennée, QEMU Developers, Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]

On Tue, Feb 1, 2022 at 2:06 PM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 2/2/22 07:52, Warner Losh wrote:
> > 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 <imp@bsdimp.com>
> > ---
> >   bsd-user/signal.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> > index ad22ba9d90d..b43266e6e06 100644
> > --- a/bsd-user/signal.c
> > +++ b/bsd-user/signal.c
> > @@ -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...
>

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


>
> r~
>
> >           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();
>
>

[-- Attachment #2: Type: text/html, Size: 2976 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-02  2:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 20:52 [PATCH] bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026 Warner Losh
2022-02-01 20:57 ` Warner Losh
2022-02-01 21:06 ` Richard Henderson
2022-02-01 21:23   ` Warner Losh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.