From 488a4384c64f98f9f25f7a50cc4a83258d14d1cc Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 27 Jan 2021 07:21:52 +0000 Subject: [PATCH] these programs (with common ancestry) had a -fno-common problem related to privsep_procid. ok mortimer --- usr.sbin/httpd/httpd.c | 4 +++- usr.sbin/httpd/httpd.h | 9 +++++---- usr.sbin/httpd/logger.c | 4 +++- usr.sbin/iscsid/iscsid.c | 4 ++-- usr.sbin/ldapd/ldapd.h | 4 ++-- usr.sbin/relayd/relayd.c | 4 +++- usr.sbin/relayd/relayd.h | 7 ++++--- usr.sbin/snmpd/snmpd.c | 4 +++- usr.sbin/snmpd/snmpd.h | 4 ++-- usr.sbin/switchd/switchd.c | 4 +++- usr.sbin/switchd/types.h | 5 +++-- usr.sbin/vmd/proc.h | 5 +++-- usr.sbin/vmd/vmd.c | 4 +++- usr.sbin/ypldap/ypldap.c | 4 +++- usr.sbin/ypldap/ypldap.h | 7 ++++--- 15 files changed, 46 insertions(+), 27 deletions(-) diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index 0e3d7b52d98..99687a18939 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.70 2020/08/03 11:05:24 benno Exp $ */ +/* $OpenBSD: httpd.c,v 1.71 2021/01/27 07:21:52 deraadt Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -67,6 +67,8 @@ static struct privsep_proc procs[] = { { "logger", PROC_LOGGER, parent_dispatch_logger, logger } }; +enum privsep_procid privsep_process; + void parent_sig_handler(int sig, short event, void *arg) { diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 4b57e8d3381..67c385157b6 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.153 2020/10/29 12:30:52 denis Exp $ */ +/* $OpenBSD: httpd.h,v 1.154 2021/01/27 07:21:52 deraadt Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter @@ -168,7 +168,7 @@ struct control_sock { }; TAILQ_HEAD(control_socks, control_sock); -struct { +extern struct { struct event ev; int fd; } control_state; @@ -230,7 +230,8 @@ enum privsep_procid { PROC_SERVER, PROC_LOGGER, PROC_MAX -} privsep_process; +}; +extern enum privsep_procid privsep_process; /* Attach the control socket to the following process */ #define PROC_CONTROL PROC_LOGGER @@ -438,7 +439,7 @@ struct log_file { uint32_t log_id; TAILQ_ENTRY(log_file) log_entry; }; -TAILQ_HEAD(log_files, log_file) log_files; +extern TAILQ_HEAD(log_files, log_file) log_files; struct media_type { char media_name[MEDIATYPE_NAMEMAX]; diff --git a/usr.sbin/httpd/logger.c b/usr.sbin/httpd/logger.c index 0c0ea9659a0..9c62485e022 100644 --- a/usr.sbin/httpd/logger.c +++ b/usr.sbin/httpd/logger.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logger.c,v 1.23 2020/12/31 14:15:40 tb Exp $ */ +/* $OpenBSD: logger.c,v 1.24 2021/01/27 07:21:53 deraadt Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -45,6 +45,8 @@ int logger_log(struct imsg *); static uint32_t last_log_id = 0; +struct log_files log_files; + static struct privsep_proc procs[] = { { "parent", PROC_PARENT, logger_dispatch_parent }, { "server", PROC_SERVER, logger_dispatch_server } diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index c100ef3dc5a..d3526e96363 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.c,v 1.20 2017/01/23 08:40:07 benno Exp $ */ +/* $OpenBSD: iscsid.c,v 1.21 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2009 Claudio Jeker @@ -38,7 +38,7 @@ void main_sig_handler(int, short, void *); __dead void usage(void); void shutdown_cb(int, short, void *); -struct initiator *initiator; +extern struct initiator *initiator; struct event exit_ev; int exit_rounds; #define ISCSI_EXIT_WAIT 5 diff --git a/usr.sbin/ldapd/ldapd.h b/usr.sbin/ldapd/ldapd.h index 556d447317d..257995e3b56 100644 --- a/usr.sbin/ldapd/ldapd.h +++ b/usr.sbin/ldapd/ldapd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.h,v 1.33 2021/01/09 14:51:45 rob Exp $ */ +/* $OpenBSD: ldapd.h,v 1.34 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk @@ -229,7 +229,7 @@ struct conn { struct buffertls buftls; unsigned int s_flags; }; -TAILQ_HEAD(conn_list, conn) conn_list; +extern TAILQ_HEAD(conn_list, conn) conn_list; struct ssl { SPLAY_ENTRY(ssl) ssl_nodes; diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index aa21afbe515..46f31306eab 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.185 2021/01/11 10:24:08 mestre Exp $ */ +/* $OpenBSD: relayd.c,v 1.186 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2007 - 2016 Reyk Floeter @@ -75,6 +75,8 @@ static struct privsep_proc procs[] = { { "ca", PROC_CA, parent_dispatch_ca, ca } }; +enum privsep_procid privsep_process; + void parent_sig_handler(int sig, short event, void *arg) { diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 5cc3dcdbe5e..9a58a86ff90 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.263 2021/01/09 08:53:58 denis Exp $ */ +/* $OpenBSD: relayd.h,v 1.264 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2006 - 2016 Reyk Floeter @@ -914,7 +914,7 @@ struct control_sock { }; TAILQ_HEAD(control_socks, control_sock); -struct { +extern struct { struct event ev; int fd; } control_state; @@ -1019,7 +1019,8 @@ enum privsep_procid { PROC_PFE, PROC_CA, PROC_MAX -} privsep_process; +}; +extern enum privsep_procid privsep_process; /* Attach the control socket to the following process */ #define PROC_CONTROL PROC_PFE diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c index 88005374dac..f8cafb6263d 100644 --- a/usr.sbin/snmpd/snmpd.c +++ b/usr.sbin/snmpd/snmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.c,v 1.43 2021/01/22 06:33:26 martijn Exp $ */ +/* $OpenBSD: snmpd.c,v 1.44 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -54,6 +54,8 @@ static struct privsep_proc procs[] = { { "snmpe", PROC_SNMPE, snmpd_dispatch_snmpe, snmpe, snmpe_shutdown }, }; +enum privsep_procid privsep_process; + void snmpd_sig_handler(int sig, short event, void *arg) { diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index b08a5173bab..994089c10c3 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.91 2021/01/22 06:33:26 martijn Exp $ */ +/* $OpenBSD: snmpd.h,v 1.92 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -113,7 +113,7 @@ enum privsep_procid { PROC_MAX }; -enum privsep_procid privsep_process; +extern enum privsep_procid privsep_process; /* Attach the control socket to the following process */ #define PROC_CONTROL PROC_SNMPE diff --git a/usr.sbin/switchd/switchd.c b/usr.sbin/switchd/switchd.c index 8877dcafe30..99085578716 100644 --- a/usr.sbin/switchd/switchd.c +++ b/usr.sbin/switchd/switchd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: switchd.c,v 1.18 2019/07/23 00:31:31 schwarze Exp $ */ +/* $OpenBSD: switchd.c,v 1.19 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter @@ -58,6 +58,8 @@ static struct privsep_proc procs[] = { { "ofcconn", PROC_OFCCONN, NULL, ofcconn } }; +enum privsep_procid privsep_process; + __dead void usage(void) { diff --git a/usr.sbin/switchd/types.h b/usr.sbin/switchd/types.h index 4976e4cff1e..569c0709ba1 100644 --- a/usr.sbin/switchd/types.h +++ b/usr.sbin/switchd/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.11 2018/11/08 17:12:12 akoshibe Exp $ */ +/* $OpenBSD: types.h,v 1.12 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2013-2016 Reyk Floeter @@ -72,7 +72,8 @@ enum privsep_procid { PROC_CONTROL, PROC_OFCCONN, PROC_MAX -} privsep_process; +}; +extern enum privsep_procid privsep_process; enum blockmodes { BM_NORMAL, diff --git a/usr.sbin/vmd/proc.h b/usr.sbin/vmd/proc.h index 5dfccb9cf09..b14ca9f5d92 100644 --- a/usr.sbin/vmd/proc.h +++ b/usr.sbin/vmd/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.16 2018/09/10 10:36:01 bluhm Exp $ */ +/* $OpenBSD: proc.h,v 1.17 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2010-2015 Reyk Floeter @@ -88,7 +88,8 @@ enum privsep_procid { PROC_VMM, PROC_PRIV, PROC_MAX, -} privsep_process; +}; +extern enum privsep_procid privsep_process; #define CONFIG_RELOAD 0x00 #define CONFIG_VMS 0x01 diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index e4835d6bb3d..3bceb5c0593 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.119 2020/09/23 19:18:18 martijn Exp $ */ +/* $OpenBSD: vmd.c,v 1.120 2021/01/27 07:21:54 deraadt Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -75,6 +75,8 @@ static struct privsep_proc procs[] = { { "vmm", PROC_VMM, vmd_dispatch_vmm, vmm, vmm_shutdown }, }; +enum privsep_procid privsep_process; + struct event staggered_start_timer; /* For the privileged process */ diff --git a/usr.sbin/ypldap/ypldap.c b/usr.sbin/ypldap/ypldap.c index aa7bc6fe9c9..1ee6b516442 100644 --- a/usr.sbin/ypldap/ypldap.c +++ b/usr.sbin/ypldap/ypldap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap.c,v 1.21 2017/01/20 12:39:36 benno Exp $ */ +/* $OpenBSD: ypldap.c,v 1.22 2021/01/27 07:21:55 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -59,6 +59,8 @@ pid_t client_pid = 0; char *conffile = YPLDAP_CONF_FILE; int opts = 0; +enum privsep_procid ypldap_process; + void usage(void) { diff --git a/usr.sbin/ypldap/ypldap.h b/usr.sbin/ypldap/ypldap.h index db4632cd43b..08359a76de4 100644 --- a/usr.sbin/ypldap/ypldap.h +++ b/usr.sbin/ypldap/ypldap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap.h,v 1.20 2018/11/06 20:42:03 jsing Exp $ */ +/* $OpenBSD: ypldap.h,v 1.21 2021/01/27 07:21:55 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -47,10 +47,11 @@ struct ypldap_addr { }; TAILQ_HEAD(ypldap_addr_list, ypldap_addr); -enum { +enum privsep_procid { PROC_MAIN, PROC_CLIENT -} ypldap_process; +}; +extern enum privsep_procid ypldap_process; static const char * const log_procnames[] = { "parent", -- 2.20.1