Skip to content

Commit

Permalink
Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master
Browse files Browse the repository at this point in the history
* freebsd/11-stable/master:
  MFC r340689:   Make multiline APPLY_MASK() macro to be function-like.
  MFC r340675: rtld: when immediate bind mode is requested, process irelocs in PLT immediately after other PLT relocs.
  • Loading branch information
opntr-auto committed Nov 27, 2018
2 parents 1119461 + 0aed75d commit ba099c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions libexec/rtld-elf/rtld.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ static int relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj,
int flags, RtldLockState *lockstate);
static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, int,
RtldLockState *);
static int resolve_object_ifunc(Obj_Entry *, bool, int, RtldLockState *);
static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now,
int flags, RtldLockState *lockstate);
static int rtld_dirname(const char *, char *);
Expand Down Expand Up @@ -2982,9 +2983,11 @@ relocate_object(Obj_Entry *obj, bool bind_now, Obj_Entry *rtldobj,
if (reloc_plt(obj) == -1)
return (-1);
/* Relocate the jump slots if we are doing immediate binding. */
if (obj->bind_now || bind_now)
if (reloc_jmpslots(obj, flags, lockstate) == -1)
if (obj->bind_now || bind_now) {
if (reloc_jmpslots(obj, flags, lockstate) == -1 ||
resolve_object_ifunc(obj, true, flags, lockstate) == -1)
return (-1);
}

/*
* Process the non-PLT IFUNC relocations. The relocations are
Expand Down
2 changes: 1 addition & 1 deletion sbin/ipfw/ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, int cblen, struct tidx *tstate)
n2mask(&d[1], masklen);
}

APPLY_MASK(d, &d[1]) /* mask base address with mask */
APPLY_MASK(d, &d[1]); /* mask base address with mask */

av = q;

Expand Down
5 changes: 3 additions & 2 deletions sys/netinet/ip_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,12 @@ typedef struct _ipfw_insn_nat {
} ipfw_insn_nat;

/* Apply ipv6 mask on ipv6 addr */
#define APPLY_MASK(addr,mask) \
#define APPLY_MASK(addr,mask) do { \
(addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \
(addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \
(addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \
(addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3];
(addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3]; \
} while (0)

/* Structure for ipv6 */
typedef struct _ipfw_insn_ip6 {
Expand Down

0 comments on commit ba099c7

Please sign in to comment.