Skip to content

Commit 212252e

Browse files
committed
Merge sudo 1.9.11p1 from tip.
--HG-- branch : 1.9
2 parents c14bc3a + d2bf3aa commit 212252e

17 files changed

Lines changed: 117 additions & 89 deletions

File tree

NEWS

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
What's new in Sudo 1.9.11p1
2+
3+
* Correctly handle EAGAIN in the I/O read/right events. This fixes
4+
a hang seen on some systems when piping a large amount of data
5+
through sudo, such as via rsync. Bug #963.
6+
7+
* Changes to avoid implementation or unspecified behavior when
8+
bit shifting signed values in the protobuf library.
9+
10+
* Fixed a compilation error on Linux/aarch64.
11+
12+
* Fixed the configure check for seccomp(2) support on Linux.
13+
14+
* Corrected the EBNF specification for tags in the sudoers manual
15+
page. GitHub issue #153.
16+
117
What's new in Sudo 1.9.11
218

319
* Fixed a crash in the Python module with Python 3.9.10 on some

config.h.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@
175175
don't. */
176176
#undef HAVE_DECL_QUAD_MIN
177177

178-
/* Define to 1 if you have the declaration of `SECCOMP_SET_MODE_FILTER', and
179-
to 0 if you don't. */
180-
#undef HAVE_DECL_SECCOMP_SET_MODE_FILTER
178+
/* Define to 1 if you have the declaration of `SECCOMP_MODE_FILTER', and to 0
179+
if you don't. */
180+
#undef HAVE_DECL_SECCOMP_MODE_FILTER
181181

182182
/* Define to 1 if you have the declaration of `setauthdb', and to 0 if you
183183
don't. */

configure

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for sudo 1.9.11.
3+
# Generated by GNU Autoconf 2.71 for sudo 1.9.11p1.
44
#
55
# Report bugs to <https://bugzilla.sudo.ws/>.
66
#
@@ -621,8 +621,8 @@ MAKEFLAGS=
621621
# Identity of this package.
622622
PACKAGE_NAME='sudo'
623623
PACKAGE_TARNAME='sudo'
624-
PACKAGE_VERSION='1.9.11'
625-
PACKAGE_STRING='sudo 1.9.11'
624+
PACKAGE_VERSION='1.9.11p1'
625+
PACKAGE_STRING='sudo 1.9.11p1'
626626
PACKAGE_BUGREPORT='https://bugzilla.sudo.ws/'
627627
PACKAGE_URL=''
628628

@@ -1640,7 +1640,7 @@ if test "$ac_init_help" = "long"; then
16401640
# Omit some internal or obsolete options to make the list less imposing.
16411641
# This message is too long to be a string in the A/UX 3.1 sh.
16421642
cat <<_ACEOF
1643-
\`configure' configures sudo 1.9.11 to adapt to many kinds of systems.
1643+
\`configure' configures sudo 1.9.11p1 to adapt to many kinds of systems.
16441644

16451645
Usage: $0 [OPTION]... [VAR=VALUE]...
16461646

@@ -1706,7 +1706,7 @@ fi
17061706

17071707
if test -n "$ac_init_help"; then
17081708
case $ac_init_help in
1709-
short | recursive ) echo "Configuration of sudo 1.9.11:";;
1709+
short | recursive ) echo "Configuration of sudo 1.9.11p1:";;
17101710
esac
17111711
cat <<\_ACEOF
17121712

@@ -1996,7 +1996,7 @@ fi
19961996
test -n "$ac_init_help" && exit $ac_status
19971997
if $ac_init_version; then
19981998
cat <<\_ACEOF
1999-
sudo configure 1.9.11
1999+
sudo configure 1.9.11p1
20002000
generated by GNU Autoconf 2.71
20012001

20022002
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2653,7 +2653,7 @@ cat >config.log <<_ACEOF
26532653
This file contains any messages produced by compilers while
26542654
running configure, to aid debugging if configure makes a mistake.
26552655

2656-
It was created by sudo $as_me 1.9.11, which was
2656+
It was created by sudo $as_me 1.9.11p1, which was
26572657
generated by GNU Autoconf 2.71. Invocation command line was
26582658

26592659
$ $0$ac_configure_args_raw
@@ -17821,22 +17821,22 @@ fi
1782117821
*-*-linux*|*-*-k*bsd*-gnu)
1782217822
shadow_funcs="getspnam"
1782317823
test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
17824-
# Check for SECCOMP_SET_MODE_FILTER in linux/seccomp.h
17825-
ac_fn_check_decl "$LINENO" "SECCOMP_SET_MODE_FILTER" "ac_cv_have_decl_SECCOMP_SET_MODE_FILTER" "
17824+
# Check for SECCOMP_MODE_FILTER in linux/seccomp.h
17825+
ac_fn_check_decl "$LINENO" "SECCOMP_MODE_FILTER" "ac_cv_have_decl_SECCOMP_MODE_FILTER" "
1782617826
#include <sys/types.h>
1782717827
#include <sys/prctl.h>
1782817828
#include <asm/unistd.h>
1782917829
#include <linux/seccomp.h>
1783017830
#include <linux/filter.h>
1783117831

1783217832
" "$ac_c_undeclared_builtin_options" "CFLAGS"
17833-
if test "x$ac_cv_have_decl_SECCOMP_SET_MODE_FILTER" = xyes
17833+
if test "x$ac_cv_have_decl_SECCOMP_MODE_FILTER" = xyes
1783417834
then :
1783517835
ac_have_decl=1
1783617836
else $as_nop
1783717837
ac_have_decl=0
1783817838
fi
17839-
printf "%s\n" "#define HAVE_DECL_SECCOMP_SET_MODE_FILTER $ac_have_decl" >>confdefs.h
17839+
printf "%s\n" "#define HAVE_DECL_SECCOMP_MODE_FILTER $ac_have_decl" >>confdefs.h
1784017840

1784117841
# We call getrandom via syscall(3) in case it is not in libc
1784217842
ac_fn_c_check_header_compile "$LINENO" "linux/random.h" "ac_cv_header_linux_random_h" "$ac_includes_default"
@@ -33050,7 +33050,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
3305033050
# report actual input values of CONFIG_FILES etc. instead of their
3305133051
# values after options handling.
3305233052
ac_log="
33053-
This file was extended by sudo $as_me 1.9.11, which was
33053+
This file was extended by sudo $as_me 1.9.11p1, which was
3305433054
generated by GNU Autoconf 2.71. Invocation command line was
3305533055

3305633056
CONFIG_FILES = $CONFIG_FILES
@@ -33118,7 +33118,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
3311833118
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
3311933119
ac_cs_config='$ac_cs_config_escaped'
3312033120
ac_cs_version="\\
33121-
sudo config.status 1.9.11
33121+
sudo config.status 1.9.11p1
3312233122
configured by $0, generated by GNU Autoconf 2.71,
3312333123
with options \\"\$ac_cs_config\\"
3312433124

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1818
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1919
dnl
2020
AC_PREREQ([2.70])
21-
AC_INIT([sudo], [1.9.11], [https://bugzilla.sudo.ws/], [sudo])
21+
AC_INIT([sudo], [1.9.11p1], [https://bugzilla.sudo.ws/], [sudo])
2222
AC_CONFIG_HEADERS([config.h pathnames.h])
2323
AC_CONFIG_SRCDIR([src/sudo.c])
2424
AC_CONFIG_AUX_DIR([scripts])
@@ -2065,8 +2065,8 @@ case "$host" in
20652065
*-*-linux*|*-*-k*bsd*-gnu)
20662066
shadow_funcs="getspnam"
20672067
test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
2068-
# Check for SECCOMP_SET_MODE_FILTER in linux/seccomp.h
2069-
AC_CHECK_DECLS([SECCOMP_SET_MODE_FILTER], [], [], [
2068+
# Check for SECCOMP_MODE_FILTER in linux/seccomp.h
2069+
AC_CHECK_DECLS([SECCOMP_MODE_FILTER], [], [], [
20702070
#include <sys/types.h>
20712071
#include <sys/prctl.h>
20722072
#include <asm/unistd.h>

docs/sudoers.man.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \e
12731273
Cmnd_Spec_List ::= Cmnd_Spec |
12741274
Cmnd_Spec ',' Cmnd_Spec_List
12751275

1276-
Cmnd_Spec ::= Runas_Spec? Option_Spec* Tag_Spec* Cmnd
1276+
Cmnd_Spec ::= Runas_Spec? Option_Spec* (Tag_Spec ':')* Cmnd
12771277

12781278
Runas_Spec ::= '(' Runas_List? (':' Runas_List)? ')'
12791279

@@ -1304,11 +1304,11 @@ Chdir_Spec ::= 'CWD=directory'
13041304

13051305
Chroot_Spec ::= 'CHROOT=directory'
13061306

1307-
Tag_Spec ::= ('EXEC:' | 'NOEXEC:' | 'FOLLOW:' | 'NOFOLLOW' |
1308-
'LOG_INPUT:' | 'NOLOG_INPUT:' | 'LOG_OUTPUT:' |
1309-
'NOLOG_OUTPUT:' | 'MAIL:' | 'NOMAIL:' | 'INTERCEPT:' |
1310-
'NOINTERCEPT:' | 'PASSWD:' | 'NOPASSWD:' | 'SETENV:' |
1311-
'NOSETENV:')
1307+
Tag_Spec ::= ('EXEC' | 'NOEXEC' | 'FOLLOW' | 'NOFOLLOW' |
1308+
'LOG_INPUT' | 'NOLOG_INPUT' | 'LOG_OUTPUT' |
1309+
'NOLOG_OUTPUT' | 'MAIL' | 'NOMAIL' | 'INTERCEPT' |
1310+
'NOINTERCEPT' | 'PASSWD' | 'NOPASSWD' | 'SETENV' |
1311+
'NOSETENV')
13121312
.RE
13131313
.fi
13141314
.PP

docs/sudoers.mdoc.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \e
12231223
Cmnd_Spec_List ::= Cmnd_Spec |
12241224
Cmnd_Spec ',' Cmnd_Spec_List
12251225

1226-
Cmnd_Spec ::= Runas_Spec? Option_Spec* Tag_Spec* Cmnd
1226+
Cmnd_Spec ::= Runas_Spec? Option_Spec* (Tag_Spec ':')* Cmnd
12271227

12281228
Runas_Spec ::= '(' Runas_List? (':' Runas_List)? ')'
12291229

@@ -1262,11 +1262,11 @@ Chdir_Spec ::= 'CWD=directory'
12621262

12631263
Chroot_Spec ::= 'CHROOT=directory'
12641264

1265-
Tag_Spec ::= ('EXEC:' | 'NOEXEC:' | 'FOLLOW:' | 'NOFOLLOW' |
1266-
'LOG_INPUT:' | 'NOLOG_INPUT:' | 'LOG_OUTPUT:' |
1267-
'NOLOG_OUTPUT:' | 'MAIL:' | 'NOMAIL:' | 'INTERCEPT:' |
1268-
'NOINTERCEPT:' | 'PASSWD:' | 'NOPASSWD:' | 'SETENV:' |
1269-
'NOSETENV:')
1265+
Tag_Spec ::= ('EXEC' | 'NOEXEC' | 'FOLLOW' | 'NOFOLLOW' |
1266+
'LOG_INPUT' | 'NOLOG_INPUT' | 'LOG_OUTPUT' |
1267+
'NOLOG_OUTPUT' | 'MAIL' | 'NOMAIL' | 'INTERCEPT' |
1268+
'NOINTERCEPT' | 'PASSWD' | 'NOPASSWD' | 'SETENV' |
1269+
'NOSETENV')
12701270
.Ed
12711271
.Pp
12721272
A

include/sudo_event.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ struct sudo_event_base {
102102
int pfd_high; /* highest slot used */
103103
int pfd_free; /* idx of next free entry or pfd_max if full */
104104
#else
105-
fd_set *readfds_in; /* read I/O descriptor set (in) */
106-
fd_set *writefds_in; /* write I/O descriptor set (in) */
107-
fd_set *readfds_out; /* read I/O descriptor set (out) */
108-
fd_set *writefds_out; /* write I/O descriptor set (out) */
105+
void *readfds_in; /* read I/O descriptor set (in) */
106+
void *writefds_in; /* write I/O descriptor set (in) */
107+
void *readfds_out; /* read I/O descriptor set (out) */
108+
void *writefds_out; /* write I/O descriptor set (out) */
109109
int maxfd; /* max fd we can store in readfds/writefds */
110110
int highfd; /* highest fd to pass as 1st arg to select */
111111
#endif /* HAVE_POLL */

lib/protobuf-c/protobuf-c.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,8 @@ int32_size(int32_t v)
331331
static inline uint32_t
332332
zigzag32(int32_t v)
333333
{
334-
// Note: the right-shift must be arithmetic
335-
// Note: left shift must be unsigned because of overflow
336-
return ((uint32_t)(v) << 1) ^ (uint32_t)(v >> 31);
334+
// Note: Using unsigned types prevents undefined behavior
335+
return ((uint32_t)v << 1) ^ -((uint32_t)v >> 31);
337336
}
338337

339338
/**
@@ -395,9 +394,8 @@ uint64_size(uint64_t v)
395394
static inline uint64_t
396395
zigzag64(int64_t v)
397396
{
398-
// Note: the right-shift must be arithmetic
399-
// Note: left shift must be unsigned because of overflow
400-
return ((uint64_t)(v) << 1) ^ (uint64_t)(v >> 63);
397+
// Note: Using unsigned types prevents undefined behavior
398+
return ((uint64_t)v << 1) ^ -((uint64_t)v >> 63);
401399
}
402400

403401
/**
@@ -817,7 +815,8 @@ uint32_pack(uint32_t value, uint8_t *out)
817815
}
818816

819817
/**
820-
* Pack a signed 32-bit integer and return the number of bytes written.
818+
* Pack a signed 32-bit integer and return the number of bytes written,
819+
* passed as unsigned to avoid implementation-specific behavior.
821820
* Negative numbers are encoded as two's complement 64-bit integers.
822821
*
823822
* \param value
@@ -828,14 +827,14 @@ uint32_pack(uint32_t value, uint8_t *out)
828827
* Number of bytes written to `out`.
829828
*/
830829
static inline size_t
831-
int32_pack(int32_t value, uint8_t *out)
830+
int32_pack(uint32_t value, uint8_t *out)
832831
{
833-
if (value < 0) {
832+
if ((int32_t)value < 0) {
834833
out[0] = value | 0x80;
835834
out[1] = (value >> 7) | 0x80;
836835
out[2] = (value >> 14) | 0x80;
837836
out[3] = (value >> 21) | 0x80;
838-
out[4] = (value >> 28) | 0x80;
837+
out[4] = (value >> 28) | 0xf0;
839838
out[5] = out[6] = out[7] = out[8] = 0xff;
840839
out[9] = 0x01;
841840
return 10;
@@ -2440,7 +2439,7 @@ static inline int32_t
24402439
unzigzag32(uint32_t v)
24412440
{
24422441
// Note: Using unsigned types prevents undefined behavior
2443-
return (int32_t)((v >> 1) ^ (~(v & 1) + 1));
2442+
return (int32_t)((v >> 1) ^ -(v & 1));
24442443
}
24452444

24462445
static inline uint32_t
@@ -2482,7 +2481,7 @@ static inline int64_t
24822481
unzigzag64(uint64_t v)
24832482
{
24842483
// Note: Using unsigned types prevents undefined behavior
2485-
return (int64_t)((v >> 1) ^ (~(v & 1) + 1));
2484+
return (int64_t)((v >> 1) ^ -(v & 1));
24862485
}
24872486

24882487
static inline uint64_t
@@ -2619,11 +2618,14 @@ parse_required_member(ScannedMember *scanned_member,
26192618
return FALSE;
26202619

26212620
def_mess = scanned_member->field->default_value;
2622-
subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
2623-
allocator,
2624-
len - pref_len,
2625-
data + pref_len);
2626-
2621+
if (len > pref_len) {
2622+
subm = protobuf_c_message_unpack(scanned_member->field->descriptor,
2623+
allocator,
2624+
len - pref_len,
2625+
data + pref_len);
2626+
} else {
2627+
subm = NULL;
2628+
}
26272629
if (maybe_clear &&
26282630
*pmessage != NULL &&
26292631
*pmessage != def_mess)
@@ -3553,7 +3555,7 @@ protobuf_c_service_generated_init(ProtobufCService *service,
35533555
service->descriptor = descriptor;
35543556
service->destroy = destroy;
35553557
service->invoke = protobuf_c_service_invoke_internal;
3556-
memset(service + 1, 0, descriptor->n_methods * sizeof(GenericHandler));
3558+
memset(&service[1], 0, descriptor->n_methods * sizeof(GenericHandler));
35573559
}
35583560

35593561
void protobuf_c_service_destroy(ProtobufCService *service)

lib/util/event_select.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
120120
if (ISSET(ev->events, SUDO_EV_READ)) {
121121
sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: added fd %d to readfs",
122122
__func__, ev->fd);
123-
FD_SET(ev->fd, base->readfds_in);
123+
FD_SET(ev->fd, (fd_set *)base->readfds_in);
124124
}
125125
if (ISSET(ev->events, SUDO_EV_WRITE)) {
126126
sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: added fd %d to writefds",
127127
__func__, ev->fd);
128-
FD_SET(ev->fd, base->writefds_in);
128+
FD_SET(ev->fd, (fd_set *)base->writefds_in);
129129
}
130130
if (ev->fd > base->highfd)
131131
base->highfd = ev->fd;
@@ -142,17 +142,17 @@ sudo_ev_del_impl(struct sudo_event_base *base, struct sudo_event *ev)
142142
if (ISSET(ev->events, SUDO_EV_READ)) {
143143
sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: removed fd %d from readfds",
144144
__func__, ev->fd);
145-
FD_CLR(ev->fd, base->readfds_in);
145+
FD_CLR(ev->fd, (fd_set *)base->readfds_in);
146146
}
147147
if (ISSET(ev->events, SUDO_EV_WRITE)) {
148148
sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s: removed fd %d from writefds",
149149
__func__, ev->fd);
150-
FD_CLR(ev->fd, base->writefds_in);
150+
FD_CLR(ev->fd, (fd_set *)base->writefds_in);
151151
}
152152
if (base->highfd == ev->fd) {
153153
for (;;) {
154-
if (FD_ISSET(base->highfd, base->readfds_in) ||
155-
FD_ISSET(base->highfd, base->writefds_in))
154+
if (FD_ISSET(base->highfd, (fd_set *)base->readfds_in) ||
155+
FD_ISSET(base->highfd, (fd_set *)base->writefds_in))
156156
break;
157157
if (--base->highfd < 0)
158158
break;
@@ -230,9 +230,9 @@ sudo_ev_scan_impl(struct sudo_event_base *base, int flags)
230230
TAILQ_FOREACH(ev, &base->events, entries) {
231231
if (ev->fd >= 0) {
232232
int what = 0;
233-
if (FD_ISSET(ev->fd, base->readfds_out))
233+
if (FD_ISSET(ev->fd, (fd_set *)base->readfds_out))
234234
what |= (ev->events & SUDO_EV_READ);
235-
if (FD_ISSET(ev->fd, base->writefds_out))
235+
if (FD_ISSET(ev->fd, (fd_set *)base->writefds_out))
236236
what |= (ev->events & SUDO_EV_WRITE);
237237
if (what != 0) {
238238
/* Make event active. */

logsrvd/logsrvd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,8 @@ server_msg_cb(int fd, int what, void *v)
929929
}
930930

931931
if (nwritten == -1) {
932+
if (errno == EAGAIN || errno == EINTR)
933+
debug_return;
932934
sudo_warn("%s: write", closure->ipaddr);
933935
goto finished;
934936
}
@@ -1043,7 +1045,7 @@ client_msg_cb(int fd, int what, void *v)
10431045
__func__, nread, closure->ipaddr);
10441046
switch (nread) {
10451047
case -1:
1046-
if (errno == EAGAIN)
1048+
if (errno == EAGAIN || errno == EINTR)
10471049
debug_return;
10481050
sudo_warn("%s: read", closure->ipaddr);
10491051
goto close_connection;
@@ -1519,9 +1521,10 @@ listener_cb(int fd, int what, void *v)
15191521
"unable to start new connection");
15201522
}
15211523
} else {
1522-
if (errno != EAGAIN)
1523-
sudo_warn("accept");
1524+
if (errno == EAGAIN || errno == EINTR)
1525+
debug_return;
15241526
/* TODO: pause accepting on ENFILE and EMFILE */
1527+
sudo_warn("accept");
15251528
}
15261529

15271530
debug_return;

0 commit comments

Comments
 (0)