diff options
author | Dan McDonald <danmcd@mnx.io> | 2022-12-16 13:29:26 -0500 |
---|---|---|
committer | Dan McDonald <danmcd@mnx.io> | 2022-12-16 13:29:26 -0500 |
commit | c2b15a66358531a6d0407d3678b210e752a0b606 (patch) | |
tree | 37db6d27eafd3b8bb0ff1c25ee6c8b98070f5444 /usr | |
parent | 3b01c8dd53b81ad475bf8152609c8c4803a9af55 (diff) | |
parent | f4d2cf74960df993f48d42d323f16867fc6b9bdf (diff) | |
download | illumos-joyent-master.tar.gz |
commit f4d2cf74960df993f48d42d323f16867fc6b9bdf
15253 14993 broke test-runner -l option
commit fb2301db8e408458b542c1f5fa07b5b8a3a95395
15258 libsmb: tautological-pointer-compare
commit abd30308264aa9ca2b1c71565b841fc94256d07b
15211 smbtorture failures in smb2.delete-on-close-perms.READONLY
commit 0663b557d8c7575927b005cab08d9f19c8b98c25
15200 libdladm: error: '&&' within '||'
commit bf7adeeaefd6f9806398f446e4b87af240a6770e
15199 libdladm: unused label
commit 92f549282aaface1e6f92329085e28edcf24054f
15207 libfmd_agent: memory leak in fmd_agent_nvl_ioctl
commit 7b5987898994d86cd20e00dbf8c305dfbfbb8bea
15135 stdalign.h is very C11-y, but perhaps disrespectful of C++
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/head/stdalign.h | 23 | ||||
-rw-r--r-- | usr/src/lib/fm/libfmd_agent/common/fmd_agent.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libdladm/Makefile.com | 2 | ||||
-rw-r--r-- | usr/src/lib/libdladm/common/libdladm.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libdladm/common/libdlbridge.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libdladm/common/libdlstat.c | 56 | ||||
-rw-r--r-- | usr/src/lib/libdladm/common/linkprop.c | 1 | ||||
-rw-r--r-- | usr/src/lib/smbsrv/libsmb/common/smb_domain.c | 2 | ||||
-rw-r--r-- | usr/src/test/libc-tests/cfg/symbols/stdalign_h.cfg | 8 | ||||
-rw-r--r-- | usr/src/test/test-runner/cmd/run | 3 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c | 16 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_common_open.c | 6 |
12 files changed, 76 insertions, 51 deletions
diff --git a/usr/src/head/stdalign.h b/usr/src/head/stdalign.h index 2577a8de92..15160d660e 100644 --- a/usr/src/head/stdalign.h +++ b/usr/src/head/stdalign.h @@ -11,30 +11,43 @@ /* * Copyright 2016 Joyent, Inc. + * Copyright 2022 Oxide Computer Company */ #ifndef _STDALIGN_H #define _STDALIGN_H /* - * ISO/IEC C11 stdalign.h + * ISO/IEC C11 stdalign.h. This header is meant to provide definitions for the + * alignas and alignof 'keywords' into the underlying compiler-understood value. + * In addition, there are two macros that are meant to define that this process + * has happened. C++11 added alignas/alignof as keywords and including this + * header is meant to cause us to still have the _is_defined macros, but not + * define this overall. + * + * Unlike other cases we don't use any symbol guards here (other than C++) and + * just allow the implementation to either have _Alignas and _Alignof or not + * have it and lead to a compiler error for the user. The main justification of + * this is that this header is only defined in C11 (and newer). It's not defined + * in other standards and just as if you include a non-standard header, in this + * case we don't try to stop that (same as if you included something like + * libdevinfo.h). */ -#include <sys/feature_tests.h> #ifdef __cplusplus extern "C" { #endif -#if !defined(_STRICT_SYMBOLS) || defined(_STDC_C11) +#ifndef __cplusplus #define alignas _Alignas #define alignof _Alignof +#endif /* !__cplusplus */ + #define __alignas_is_defined 1 #define __alignof_is_defined 1 -#endif /* !_STRICT_SYMBOLS || _STDC_C11 */ - #ifdef __cplusplus } #endif diff --git a/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c b/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c index 928978fa17..62ec7cc331 100644 --- a/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c +++ b/usr/src/lib/fm/libfmd_agent/common/fmd_agent.c @@ -129,12 +129,8 @@ fmd_agent_nvl_ioctl(fmd_agent_hdl_t *hdl, int cmd, uint32_t ver, if (errno == ENAMETOOLONG && outsz != 0 && outsz < (FM_IOC_OUT_MAXBUFSZ / 2)) { umem_free(outbuf, outsz); + outbuf = NULL; outsz *= 2; - outbuf = umem_alloc(outsz, UMEM_DEFAULT); - if (outbuf == NULL) { - err = errno; - break; - } } else { err = errno; break; diff --git a/usr/src/lib/libdladm/Makefile.com b/usr/src/lib/libdladm/Makefile.com index 72f5a06d0f..49c4d3c36f 100644 --- a/usr/src/lib/libdladm/Makefile.com +++ b/usr/src/lib/libdladm/Makefile.com @@ -43,8 +43,6 @@ LDLIBS += -ldevinfo -lc -linetutil -lsocket -lscf -lrcm -lnvpair \ SRCDIR = ../common CFLAGS += $(CCVERBOSE) -CERRWARN += -_gcc=-Wno-parentheses -CERRWARN += -_gcc=-Wno-unused-label CERRWARN += $(CNOWARN_UNINIT) CPPFLAGS += -I$(SRCDIR) -D_REENTRANT diff --git a/usr/src/lib/libdladm/common/libdladm.c b/usr/src/lib/libdladm/common/libdladm.c index eec92e09ba..d0600d64f5 100644 --- a/usr/src/lib/libdladm/common/libdladm.c +++ b/usr/src/lib/libdladm/common/libdladm.c @@ -1182,7 +1182,7 @@ dladm_strs2range(char **prop_val, uint_t val_cnt, if (*endp++ != '-') return (DLADM_STATUS_BADRANGE); ur->mpur_max = strtol(endp, &endp, 10); - if (endp != NULL && *endp != '\0' || + if ((endp != NULL && *endp != '\0') || ur->mpur_max < ur->mpur_min) return (DLADM_STATUS_BADRANGE); } diff --git a/usr/src/lib/libdladm/common/libdlbridge.c b/usr/src/lib/libdladm/common/libdlbridge.c index aaf2fede13..1c759aa98b 100644 --- a/usr/src/lib/libdladm/common/libdlbridge.c +++ b/usr/src/lib/libdladm/common/libdlbridge.c @@ -933,7 +933,7 @@ dladm_bridge_configure(dladm_handle_t handle, const char *name, if ((tran = scf_transaction_create(sstate.ss_handle)) == NULL) goto out; - if (cfg->field_mask & BR_CFG_ALL) { + if (cfg->field_mask & (BR_CFG_ALL)) { if ((sstate.ss_pg = scf_pg_create(sstate.ss_handle)) == NULL) goto out; if (scf_instance_add_pg(sstate.ss_inst, "config", diff --git a/usr/src/lib/libdladm/common/libdlstat.c b/usr/src/lib/libdladm/common/libdlstat.c index 9f7625f9b2..11a36b2173 100644 --- a/usr/src/lib/libdladm/common/libdlstat.c +++ b/usr/src/lib/libdladm/common/libdlstat.c @@ -54,7 +54,7 @@ struct flowlist { uint64_t ifspeed; boolean_t first; boolean_t display; - pktsum_t prevstats; + pktsum_t prevstats; pktsum_t diffstats; }; @@ -175,7 +175,7 @@ dladm_get_single_mac_stat(dladm_handle_t handle, datalink_id_t linkid, { char module[DLPI_LINKNAME_MAX]; uint_t instance; - char link[DLPI_LINKNAME_MAX]; + char link[DLPI_LINKNAME_MAX]; dladm_status_t status; uint32_t flags, media; kstat_t *ksp; @@ -283,8 +283,8 @@ static stat_info_t rx_hwlane_stats_list[] = { {"pollbytes", RL_OFF(rl_pollbytes)}, {"rxsdrops", RL_OFF(rl_sdrops)}, {"chainunder10", RL_OFF(rl_chl10)}, - {"chain10to50", RL_OFF(rl_ch10_50)}, - {"chainover50", RL_OFF(rl_chg50)} + {"chain10to50", RL_OFF(rl_ch10_50)}, + {"chainover50", RL_OFF(rl_chg50)} }; #define RX_HWLANE_STAT_SIZE A_CNT(rx_hwlane_stats_list) @@ -310,8 +310,8 @@ static stat_info_t rx_lane_stats_list[] = { {"rxsdrops", RL_OFF(rl_sdrops)}, {"pollbytes", RL_OFF(rl_pollbytes)}, {"chainunder10", RL_OFF(rl_chl10)}, - {"chain10to50", RL_OFF(rl_ch10_50)}, - {"chainover50", RL_OFF(rl_chg50)} + {"chain10to50", RL_OFF(rl_ch10_50)}, + {"chainover50", RL_OFF(rl_chg50)} }; #define RX_LANE_STAT_SIZE A_CNT(rx_lane_stats_list) @@ -710,7 +710,7 @@ typedef enum { void dladm_sort_index_list(uint_t idlist[], uint_t size) { - int i, j; + int i, j; for (j = 1; j < size; j++) { int key = idlist[j]; @@ -929,8 +929,8 @@ i_dlstat_query_stats(dladm_handle_t handle, const char *modname, { kstat_t *ksp; char statname[MAXLINKNAMELEN]; - int i = 0; - dladm_stat_chain_t *head = NULL, *prev = NULL; + int i = 0; + dladm_stat_chain_t *head = NULL, *prev = NULL; dladm_stat_chain_t *curr; if (dladm_dld_kcp(handle) == NULL) { @@ -939,7 +939,7 @@ i_dlstat_query_stats(dladm_handle_t handle, const char *modname, } for (i = 0; i < idlist_size; i++) { - uint_t index = idlist[i]; + uint_t index = idlist[i]; (void) snprintf(statname, sizeof (statname), "%s%d", prefix, index); @@ -970,7 +970,6 @@ i_dlstat_query_stats(dladm_handle_t handle, const char *modname, prev = curr; } -done: return (head); } @@ -978,7 +977,7 @@ static misc_stat_entry_t * i_dlstat_misc_stats(dladm_handle_t handle, const char *linkname) { kstat_t *ksp; - misc_stat_entry_t *misc_stat_entry = NULL; + misc_stat_entry_t *misc_stat_entry = NULL; if (dladm_dld_kcp(handle) == NULL) return (NULL); @@ -1240,11 +1239,11 @@ void * dlstat_rx_lane_stats(dladm_handle_t dh, datalink_id_t linkid) { dladm_stat_chain_t *head = NULL; - dladm_stat_chain_t *local_stats = NULL; - dladm_stat_chain_t *bcast_stats = NULL; - dladm_stat_chain_t *defunctlane_stats = NULL; - dladm_stat_chain_t *lane_stats = NULL; - char linkname[MAXLINKNAMELEN]; + dladm_stat_chain_t *local_stats = NULL; + dladm_stat_chain_t *bcast_stats = NULL; + dladm_stat_chain_t *defunctlane_stats = NULL; + dladm_stat_chain_t *lane_stats = NULL; + char linkname[MAXLINKNAMELEN]; boolean_t is_legacy_driver; if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname, @@ -1454,10 +1453,10 @@ void * dlstat_tx_lane_stats(dladm_handle_t dh, datalink_id_t linkid) { dladm_stat_chain_t *head = NULL; - dladm_stat_chain_t *bcast_stats = NULL; - dladm_stat_chain_t *defunctlane_stats = NULL; - dladm_stat_chain_t *lane_stats; - char linkname[MAXLINKNAMELEN]; + dladm_stat_chain_t *bcast_stats = NULL; + dladm_stat_chain_t *defunctlane_stats = NULL; + dladm_stat_chain_t *lane_stats; + char linkname[MAXLINKNAMELEN]; boolean_t is_legacy_driver; if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname, @@ -1643,8 +1642,8 @@ i_dlstat_query_fanout_stats(dladm_handle_t dh, datalink_id_t linkid, char linkname[MAXLINKNAMELEN]; dladm_stat_chain_t *curr, *curr_head; dladm_stat_chain_t *head = NULL, *prev = NULL; - uint_t fanout_idlist[MAX_RINGS_PER_GROUP]; - uint_t fanout_idlist_size; + uint_t fanout_idlist[MAX_RINGS_PER_GROUP]; + uint_t fanout_idlist_size; if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname, DLPI_LINKNAME_MAX) != DLADM_STATUS_OK) { @@ -1720,7 +1719,7 @@ dlstat_fanout_stats(dladm_handle_t dh, datalink_id_t linkid) dladm_stat_chain_t *fout_hwlane_stats; dladm_stat_chain_t *fout_swlane_and_local_stats; fanout_stat_entry_t *fout_stats; - char linkname[MAXLINKNAMELEN]; + char linkname[MAXLINKNAMELEN]; if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname, DLPI_LINKNAME_MAX) != DLADM_STATUS_OK) { @@ -1766,9 +1765,9 @@ i_dlstat_rx_ring_match(void *arg1, void *arg2) static void * i_dlstat_rx_ring_stat_entry_diff(void *arg1, void *arg2) { - ring_stat_entry_t *s1 = arg1; - ring_stat_entry_t *s2 = arg2; - ring_stat_entry_t *diff_entry; + ring_stat_entry_t *s1 = arg1; + ring_stat_entry_t *s2 = arg2; + ring_stat_entry_t *diff_entry; diff_entry = malloc(sizeof (ring_stat_entry_t)); if (diff_entry == NULL) @@ -2272,7 +2271,7 @@ dlstat_misc_stats(dladm_handle_t dh, datalink_id_t linkid) { misc_stat_entry_t *misc_stat_entry; dladm_stat_chain_t *head = NULL; - char linkname[MAXLINKNAMELEN]; + char linkname[MAXLINKNAMELEN]; if (dladm_datalink_id2info(dh, linkid, NULL, NULL, NULL, linkname, DLPI_LINKNAME_MAX) != DLADM_STATUS_OK) { @@ -2461,7 +2460,6 @@ i_walk_dlstat_chain(dladm_stat_chain_t *stat_head, dladm_stat_type_t stattype) nvstat_prev = nvstat_curr; } -done: return (nvstat_head); } diff --git a/usr/src/lib/libdladm/common/linkprop.c b/usr/src/lib/libdladm/common/linkprop.c index 3e6e8e0912..0544a880ca 100644 --- a/usr/src/lib/libdladm/common/linkprop.c +++ b/usr/src/lib/libdladm/common/linkprop.c @@ -3995,7 +3995,6 @@ set_public_prop(dladm_handle_t handle, prop_desc_t *pdp, status = i_dladm_macprop(handle, dip, B_TRUE); -done: free(dip); return (status); } diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_domain.c b/usr/src/lib/smbsrv/libsmb/common/smb_domain.c index 5b4a15a08f..e1c5109871 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_domain.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_domain.c @@ -144,7 +144,7 @@ smb_domain_add(smb_domain_type_t type, smb_domain_t *di) { uint32_t res; - if ((di == NULL) || (di->di_sid == NULL)) + if (di == NULL || di->di_sid[0] == '\0') return (SMB_DOMAIN_INVALID_ARG); if ((res = smb_dcache_lock(SMB_DCACHE_WRLOCK)) == SMB_DOMAIN_SUCCESS) { diff --git a/usr/src/test/libc-tests/cfg/symbols/stdalign_h.cfg b/usr/src/test/libc-tests/cfg/symbols/stdalign_h.cfg index 81b7419e31..aa2c517bb6 100644 --- a/usr/src/test/libc-tests/cfg/symbols/stdalign_h.cfg +++ b/usr/src/test/libc-tests/cfg/symbols/stdalign_h.cfg @@ -20,7 +20,7 @@ # # Defines # -define | alignas | | stdalign.h | -ALL +C11 -define | alignof | | stdalign.h | -ALL +C11 -define | __alignas_is_defined | 1 | stdalign.h | -ALL +C11 -define | __alignof_is_defined | 1 | stdalign.h | -ALL +C11 +define | alignas | | stdalign.h | +ALL +define | alignof | | stdalign.h | +ALL +define | __alignas_is_defined | 1 | stdalign.h | +ALL +define | __alignof_is_defined | 1 | stdalign.h | +ALL diff --git a/usr/src/test/test-runner/cmd/run b/usr/src/test/test-runner/cmd/run index 189be04d4d..ce1bf1419c 100644 --- a/usr/src/test/test-runner/cmd/run +++ b/usr/src/test/test-runner/cmd/run @@ -973,6 +973,9 @@ def filter_tests(testrun, options): if not m: continue group, test = m.group(1, 2) + m = re.match(re.escape(options.testdir) + r'(.*)', group) + if m: + group = m.group(1) try: failed[group].append(test) except KeyError: diff --git a/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c b/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c index 1b9ed07060..c5369eae4f 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c +++ b/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c @@ -231,8 +231,9 @@ smb_set_alloc_info(smb_request_t *sr, smb_setinfo_t *si) uint32_t smb_set_disposition_info(smb_request_t *sr, smb_setinfo_t *si) { - smb_node_t *node = si->si_node; - smb_ofile_t *of = sr->fid_ofile; + smb_attr_t *attr = &si->si_attr; + smb_node_t *node = si->si_node; + smb_ofile_t *of = sr->fid_ofile; uint8_t mark_delete; uint32_t status; uint32_t flags = 0; @@ -249,6 +250,17 @@ smb_set_disposition_info(smb_request_t *sr, smb_setinfo_t *si) } /* + * MS-FSA 2.1.5.14.3 FileDispositionInformation + * If dosattr READONLY, STATUS_CANNOT_DELETE. + */ + attr->sa_mask = SMB_AT_DOSATTR; + status = smb2_ofile_getattr(sr, of, attr); + if (status != 0) + return (status); + if ((attr->sa_dosattr & FILE_ATTRIBUTE_READONLY) != 0) + return (NT_STATUS_CANNOT_DELETE); + + /* * Break any oplock handle caching. */ status = smb_oplock_break_SETINFO(node, of, diff --git a/usr/src/uts/common/fs/smbsrv/smb_common_open.c b/usr/src/uts/common/fs/smbsrv/smb_common_open.c index 688bac53d8..894affa2a5 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_common_open.c +++ b/usr/src/uts/common/fs/smbsrv/smb_common_open.c @@ -945,6 +945,12 @@ create: goto errout; } + if ((op->dattr & FILE_ATTRIBUTE_READONLY) != 0 && + (op->create_options & FILE_DELETE_ON_CLOSE) != 0) { + status = NT_STATUS_CANNOT_DELETE; + goto errout; + } + if ((op->desired_access & ACCESS_SYSTEM_SECURITY) != 0 && !smb_user_has_security_priv(sr->uid_user, sr->user_cr)) { status = NT_STATUS_ACCESS_DENIED; |