#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#define ERFKILL 132
+#define EHWPOISON 133
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
+#define EXTPROC 0200000
#define TCOOFF 0
#define TCOON 1
#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#define ERFKILL 132
+#define EHWPOISON 133
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
+#define EXTPROC 0200000
#define TCOOFF 0
#define TCOON 1
#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#define ERFKILL 132
+#define EHWPOISON 133
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
+#define EXTPROC 0200000
#define TCOOFF 0
#define TCOON 1
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x2000
#define MAP_EXECUTABLE 0x4000
#define MAP_LOCKED 0x8000
+#define MAP_POPULATE 0x10000
+#define MAP_NONBLOCK 0x20000
+#define MAP_STACK 0x40000
+#define MAP_HUGETLB 0x80000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
#define MREMAP_MAYMOVE 1
#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#define ERFKILL 132
+#define EHWPOISON 133
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x80
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define EOWNERDEAD 130
#define ENOTRECOVERABLE 131
#define ERFKILL 132
+#define EHWPOISON 133
#define F_SETOWN_EX 15
#define F_GETOWN_EX 16
+
+#define F_GETOWNER_UIDS 17
#define MAP_DENYWRITE 0x0800
#define MAP_EXECUTABLE 0x1000
#define MAP_LOCKED 0x2000
+#define MAP_POPULATE 0x8000
+#define MAP_NONBLOCK 0x10000
+#define MAP_STACK 0x20000
+#define MAP_HUGETLB 0x40000
#define POSIX_MADV_NORMAL 0
#define POSIX_MADV_RANDOM 1
#define MADV_UNMERGEABLE 13
#define MADV_HUGEPAGE 14
#define MADV_NOHUGEPAGE 15
+#define MADV_DONTDUMP 16
+#define MADV_DODUMP 17
#define MADV_HWPOISON 100
+#define MADV_SOFT_OFFLINE 101
#define MREMAP_MAYMOVE 1
#define MREMAP_FIXED 2
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
+#define EXTPROC 0200000
#define TCOOFF 0
#define TCOON 1
extern "C" {
#endif
+#include <features.h>
+
#define __NEED_in_addr_t
#define __NEED_in_port_t
#define __NEED_sa_family_t
#define IP_ADD_SOURCE_MEMBERSHIP 39
#define IP_DROP_SOURCE_MEMBERSHIP 40
#define IP_MSFILTER 41
+#define IP_MULTICAST_ALL 49
+#define IP_UNICAST_IF 50
+
+#ifdef _GNU_SOURCE
+#define MCAST_JOIN_GROUP 42
+#define MCAST_BLOCK_SOURCE 43
+#define MCAST_UNBLOCK_SOURCE 44
+#define MCAST_LEAVE_GROUP 45
+#define MCAST_JOIN_SOURCE_GROUP 46
+#define MCAST_LEAVE_SOURCE_GROUP 47
+#define MCAST_MSFILTER 48
+
+#define MCAST_EXCLUDE 0
+#define MCAST_INCLUDE 1
+#endif
#define IP_RECVRETOPTS IP_RETOPTS
#define EPOLLERR 0x008
#define EPOLLHUP 0x010
#define EPOLLRDHUP 0x2000
+#define EPOLLWAKEUP (1U<<29)
#define EPOLLONESHOT (1U<<30)
#define EPOLLET (1U<<31)
#define IN_ONLYDIR 0x01000000
#define IN_DONT_FOLLOW 0x02000000
+#define IN_EXCL_UNLINK 0x04000000
#define IN_MASK_ADD 0x20000000
#define IN_ISDIR 0x40000000
#define MS_SYNCHRONOUS 16
#define MS_REMOUNT 32
#define MS_MANDLOCK 64
-#define S_WRITE 128
-#define S_APPEND 256
-#define S_IMMUTABLE 512
+#define MS_DIRSYNC 128
#define MS_NOATIME 1024
#define MS_NODIRATIME 2048
#define MS_BIND 4096
#define MS_MOVE 8192
+#define MS_REC 16384
#define MS_SILENT 32768
+#define MS_POSIXACL (1<<16)
+#define MS_UNBINDABLE (1<<17)
+#define MS_PRIVATE (1<<18)
+#define MS_SLAVE (1<<19)
+#define MS_SHARED (1<<20)
+#define MS_RELATIME (1<<21)
+#define MS_KERNMOUNT (1<<22)
+#define MS_I_VERSION (1<<23)
+#define MS_STRICTATIME (1<<24)
+#define MS_NOSEC (1<<28)
+#define MS_BORN (1<<29)
+#define MS_ACTIVE (1<<30)
+#define MS_NOUSER (1U<<31)
+
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
#define MS_MGC_VAL 0xc0ed0000
+#define MS_MGC_MSK 0xffff0000
-#define MNT_FORCE 1
+#define MNT_FORCE 1
+#define MNT_DETACH 2
+#define MNT_EXPIRE 4
+#define UMOUNT_NOFOLLOW 8
int mount(const char *, const char *, const char *, unsigned long, const void *);
int umount(const char *);
#define PTRACE_GETEVENTMSG 0x4201
#define PTRACE_GETSIGINFO 0x4202
#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
#define PT_READ_I PTRACE_PEEKTEXT
#define PT_READ_D PTRACE_PEEKDATA
#define PTRACE_O_TRACEEXEC 0x00000010
#define PTRACE_O_TRACEVFORKDONE 0x00000020
#define PTRACE_O_TRACEEXIT 0x00000040
-#define PTRACE_O_MASK 0x0000007f
+#define PTRACE_O_TRACESECCOMP 0x00000080
+#define PTRACE_O_EXITKILL 0x00100000
+#define PTRACE_O_MASK 0x001000ff
#define PTRACE_EVENT_FORK 1
#define PTRACE_EVENT_VFORK 2
#define PTRACE_EVENT_EXEC 4
#define PTRACE_EVENT_VFORK_DONE 5
#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
long ptrace(int, ...);
#define RB_ENABLE_CAD 0x89abcdef
#define RB_DISABLE_CAD 0
#define RB_POWER_OFF 0x4321fedc
+#define RB_SW_SUSPEND 0xd000fce2
+#define RB_KEXEC 0x45584543
int reboot(int);
#endif
#include <stdint.h>
+#include <fcntl.h>
#define __NEED_sigset_t
#include <bits/alltypes.h>
-#define SFD_CLOEXEC 02000000
-#define SFD_NONBLOCK 04000
+#define SFD_CLOEXEC O_CLOEXEC
+#define SFD_NONBLOCK O_NONBLOCK
int signalfd(int, const sigset_t *, int);
#define PF_ASH 18
#define PF_ECONET 19
#define PF_ATMSVC 20
+#define PF_RDS 21
#define PF_SNA 22
#define PF_IRDA 23
#define PF_PPPOX 24
#define PF_WANPIPE 25
+#define PF_LLC 26
+#define PF_CAN 29
+#define PF_TIPC 30
#define PF_BLUETOOTH 31
#define PF_IUCV 32
#define PF_RXRPC 33
#define PF_IEEE802154 36
#define PF_CAIF 37
#define PF_ALG 38
-#define PF_MAX 39
+#define PF_NFC 39
+#define PF_MAX 40
#define AF_UNSPEC PF_UNSPEC
#define AF_LOCAL PF_LOCAL
#define AF_ASH PF_ASH
#define AF_ECONET PF_ECONET
#define AF_ATMSVC PF_ATMSVC
+#define AF_RDS PF_RDS
#define AF_SNA PF_SNA
#define AF_IRDA PF_IRDA
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
+#define AF_LLC PF_LLC
+#define AF_CAN PF_CAN
+#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
#define AF_IUCV PF_IUCV
#define AF_RXRPC PF_RXRPC
#define AF_IEEE802154 PF_IEEE802154
#define AF_CAIF PF_CAIF
#define AF_ALG PF_ALG
+#define AF_NFC PF_NFC
#define AF_MAX PF_MAX
#ifndef SO_DEBUG
#define SWAP_FLAG_PREFER 0x8000
#define SWAP_FLAG_PRIO_MASK 0x7fff
#define SWAP_FLAG_PRIO_SHIFT 0
+#define SWAP_FLAG_DISCARD 0x10000
int swapon (const char *, int);
int swapoff (const char *);
#define MOD_TIMECONST ADJ_TIMECONST
#define MOD_CLKB ADJ_TICK
#define MOD_CLKA ADJ_OFFSET_SINGLESHOT
+#define MOD_TAI ADJ_TAI
#define MOD_MICRO ADJ_MICRO
#define MOD_NANO ADJ_NANO
#define STA_CLK 0x8000
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
- STA_PPSERROR | STA_CLOCKERR)
+ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
#define TIME_OK 0
#define TIME_INS 1
if (mode == LIO_WAIT) {
ret = lio_wait(st);
free(st);
- return 0;
+ return ret;
}
if (st) {
const unsigned char *key = (const unsigned char *)_key;
const unsigned char *setting = (const unsigned char *)_setting;
struct expanded_key ekey;
- union {
- unsigned char c[8];
- uint32_t i[2];
- } keybuf;
+ unsigned char keybuf[8];
unsigned char *p, *q;
uint32_t count, salt, l, r0, r1;
unsigned int i;
* Copy the key, shifting each character left by one bit and padding
* with zeroes.
*/
- q = keybuf.c;
- while (q <= &keybuf.c[sizeof(keybuf.c) - 1]) {
+ q = keybuf;
+ while (q <= &keybuf[sizeof(keybuf) - 1]) {
*q++ = *key << 1;
if (*key)
key++;
}
- des_setkey(keybuf.c, &ekey);
+ des_setkey(keybuf, &ekey);
if (*setting == _PASSWORD_EFMT1) {
/*
/*
* Encrypt the key with itself.
*/
- des_cipher(keybuf.c, keybuf.c, 1, 0, &ekey);
+ des_cipher(keybuf, keybuf, 1, 0, &ekey);
/*
* And XOR with the next 8 characters of the key.
*/
- q = keybuf.c;
- while (q <= &keybuf.c[sizeof(keybuf.c) - 1] && *key)
+ q = keybuf;
+ while (q <= &keybuf[sizeof(keybuf) - 1] && *key)
*q++ ^= *key++ << 1;
- des_setkey(keybuf.c, &ekey);
+ des_setkey(keybuf, &ekey);
}
memcpy(output, setting, 9);
s->h[3] = 0x10325476;
}
-static void md5_sum(struct md5 *s, uint8_t md[16])
+static void md5_sum(struct md5 *s, uint8_t *md)
{
int i;
s->h[7] = 0x5be0cd19;
}
-static void sha256_sum(struct sha256 *s, uint8_t md[20])
+static void sha256_sum(struct sha256 *s, uint8_t *md)
{
int i;
s->h[7] = 0x5be0cd19137e2179ULL;
}
-static void sha512_sum(struct sha512 *s, uint8_t md[20])
+static void sha512_sum(struct sha512 *s, uint8_t *md)
{
int i;
return p;
}
+static int invalid_dso_handle(struct dso *h)
+{
+ struct dso *p;
+ for (p=head; p; p=p->next) if (h==p) return 0;
+ snprintf(errbuf, sizeof errbuf, "Invalid library handle %p", (void *)h);
+ errflag = 1;
+ return 1;
+}
+
static void *do_dlsym(struct dso *p, const char *s, void *ra)
{
size_t i;
return __tls_get_addr((size_t []){def.dso->tls_id, def.sym->st_value});
return def.dso->base + def.sym->st_value;
}
+ if (invalid_dso_handle(p)) return 0;
if (p->ghashtab) {
gh = gnu_hash(s);
sym = gnu_lookup(s, gh, p);
return ret;
}
#else
+static int invalid_dso_handle(struct dso *h)
+{
+ snprintf(errbuf, sizeof errbuf, "Invalid library handle %p", (void *)h);
+ errflag = 1;
+ return 1;
+}
void *dlopen(const char *file, int mode)
{
return 0;
int dlclose(void *p)
{
- return 0;
+ return invalid_dso_handle(p);
}
started from. */
int next_c_start;
const char *str_byte_start;
- int pos_start = -1;
#ifdef TRE_MBSTATE
mbstate_t mbstate_start;
#endif /* TRE_MBSTATE */
}
state = NULL;
- pos = pos_start;
GET_NEXT_WCHAR();
- pos_start = pos;
next_c_start = next_c;
str_byte_start = str_byte;
#ifdef TRE_MBSTATE