Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 Feb 2018 21:51:47 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 00/25] Update for linux v4.14 and v4.15

* Rich Felker <dalias@...c.org> [2018-02-08 13:25:28 -0500]:
> On Wed, Feb 07, 2018 at 02:10:15AM +0100, Szabolcs Nagy wrote:
> > >From efd536020b2c739a843bd2eaa69697e4d896478b Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@...t70.net>
> > Date: Sun, 26 Nov 2017 23:20:38 +0000
> > Subject: [PATCH 06/25] signal.h: add missing SIGTRAP and SIGSYS si_codes
> > 
> > SYS_SECCOMP new in commit a0727e8ce513fe6890416da960181ceb10fbfae6
> > TRAP_BRANCH and TRAP_HWBKPT new in commit
> > da654b74bda14c45a7d98c731bf3c1a43b6b74e2
> > ---
> >  include/signal.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/signal.h b/include/signal.h
> > index 2c8b3d55..1db5af5f 100644
> > --- a/include/signal.h
> > +++ b/include/signal.h
> > @@ -231,6 +231,8 @@ int sigrelse(int);
> >  void (*sigset(int, void (*)(int)))(int);
> >  #define TRAP_BRKPT 1
> >  #define TRAP_TRACE 2
> > +#define TRAP_BRANCH 3
> > +#define TRAP_HWBKPT 4
> >  #define POLL_IN 1
> >  #define POLL_OUT 2
> >  #define POLL_MSG 3
> > @@ -241,6 +243,7 @@ void (*sigset(int, void (*)(int)))(int);
> >  #define SS_DISABLE    2
> >  #define SS_AUTODISARM (1U << 31)
> >  #define SS_FLAG_BITS SS_AUTODISARM
> > +#define SYS_SECCOMP 1
> >  #endif
> 
> SYS_ is not reserved namespace. This needs to go in the next
> conditional block I think. Unless other changes are needed I can just
> amend this when merging.
> 

yes this is a mistake, should be under _GNU_SOURCE or removed
(glibc does not seem to expose this macro yet nor include
asm/siginfo.h directly)

> > diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h
> > index 5eb3d91f..56e4ff83 100644
> > --- a/arch/aarch64/bits/signal.h
> > +++ b/arch/aarch64/bits/signal.h
> > @@ -25,6 +25,7 @@ typedef struct sigcontext {
> >  #define FPSIMD_MAGIC 0x46508001
> >  #define ESR_MAGIC 0x45535201
> >  #define EXTRA_MAGIC 0x45585401
> > +#define SVE_MAGIC 0x53564501
> >  struct _aarch64_ctx {
> >  	unsigned int magic;
> >  	unsigned int size;
> > @@ -45,6 +46,44 @@ struct extra_context {
> >  	unsigned int size;
> >  	unsigned int __reserved[3];
> >  };
> > +struct sve_context {
> > +	struct _aarch64_ctx head;
> > +	unsigned short vl;
> > +	unsigned short __reserved[3];
> > +};
> > +#define SVE_VQ_BYTES		16
> > +#define SVE_VQ_MIN		1
> > +#define SVE_VQ_MAX		512
> > +#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
> > +#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
> > +#define SVE_NUM_ZREGS		32
> > +#define SVE_NUM_PREGS		16
> > +#define sve_vl_valid(vl) \
> > +	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
> > +#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
> > +#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
> > +#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
> > +#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
> > +#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
> > +#define SVE_SIG_REGS_OFFSET					\
> > +	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
> > +		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
> > +#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
> > +#define SVE_SIG_ZREG_OFFSET(vq, n) \
> > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
> > +#define SVE_SIG_ZREGS_SIZE(vq) \
> > +	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
> > +#define SVE_SIG_PREGS_OFFSET(vq) \
> > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
> > +#define SVE_SIG_PREG_OFFSET(vq, n) \
> > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
> > +#define SVE_SIG_PREGS_SIZE(vq) \
> > +	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
> > +#define SVE_SIG_FFR_OFFSET(vq) \
> > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
> > +#define SVE_SIG_REGS_SIZE(vq) \
> > +	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
> > +#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
> >  #else
> >  typedef struct {
> >  	long double __regs[18+256];
> 
> This is a lot of messy code-like machinery to be adding to a header,
> but maybe it's also needed? :(
> 

glibc includes asm/sigcontext.h under _GNU_SOURCE
and all this got added to the uapi header to handle
the variable length sve registers..

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.