mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
OpenZFS 6314 - buffer overflow in dsl_dataset_name
Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Prakash Surya <prakash.surya@delphix.com> Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/6314 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/d6160ee
This commit is contained in:
committed by
Brian Behlendorf
parent
43e52eddb1
commit
eca7b76001
+1
-1
@@ -816,7 +816,7 @@ typedef struct dmu_objset_stats {
|
||||
dmu_objset_type_t dds_type;
|
||||
uint8_t dds_is_snapshot;
|
||||
uint8_t dds_inconsistent;
|
||||
char dds_origin[MAXNAMELEN];
|
||||
char dds_origin[ZFS_MAX_DATASET_NAME_LEN];
|
||||
} dmu_objset_stats_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -227,7 +227,7 @@ typedef struct dsl_dataset {
|
||||
uint8_t ds_feature_activation_needed[SPA_FEATURES];
|
||||
|
||||
/* Protected by ds_lock; keep at end of struct for better locality */
|
||||
char ds_snapname[MAXNAMELEN];
|
||||
char ds_snapname[ZFS_MAX_DATASET_NAME_LEN];
|
||||
} dsl_dataset_t;
|
||||
|
||||
static inline dsl_dataset_phys_t *
|
||||
@@ -262,6 +262,7 @@ int dsl_dataset_own_obj(struct dsl_pool *dp, uint64_t dsobj,
|
||||
void dsl_dataset_disown(dsl_dataset_t *ds, void *tag);
|
||||
void dsl_dataset_name(dsl_dataset_t *ds, char *name);
|
||||
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, void *tag);
|
||||
int dsl_dataset_namelen(dsl_dataset_t *ds);
|
||||
boolean_t dsl_dataset_has_owner(dsl_dataset_t *ds);
|
||||
uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
|
||||
dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
|
||||
@@ -353,10 +354,10 @@ void dsl_dataset_deactivate_feature(uint64_t dsobj,
|
||||
#ifdef ZFS_DEBUG
|
||||
#define dprintf_ds(ds, fmt, ...) do { \
|
||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
||||
char *__ds_name = kmem_alloc(MAXNAMELEN, KM_SLEEP); \
|
||||
char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \
|
||||
dsl_dataset_name(ds, __ds_name); \
|
||||
dprintf("ds=%s " fmt, __ds_name, __VA_ARGS__); \
|
||||
kmem_free(__ds_name, MAXNAMELEN); \
|
||||
kmem_free(__ds_name, ZFS_MAX_DATASET_NAME_LEN); \
|
||||
} \
|
||||
_NOTE(CONSTCOND) } while (0)
|
||||
#else
|
||||
|
||||
@@ -112,7 +112,7 @@ struct dsl_dir {
|
||||
int64_t dd_space_towrite[TXG_SIZE];
|
||||
|
||||
/* protected by dd_lock; keep at end of struct for better locality */
|
||||
char dd_myname[MAXNAMELEN];
|
||||
char dd_myname[ZFS_MAX_DATASET_NAME_LEN];
|
||||
};
|
||||
|
||||
static inline dsl_dir_phys_t *
|
||||
@@ -176,11 +176,10 @@ boolean_t dsl_dir_is_zapified(dsl_dir_t *dd);
|
||||
#ifdef ZFS_DEBUG
|
||||
#define dprintf_dd(dd, fmt, ...) do { \
|
||||
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
|
||||
char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \
|
||||
KM_SLEEP); \
|
||||
char *__ds_name = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); \
|
||||
dsl_dir_name(dd, __ds_name); \
|
||||
dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \
|
||||
kmem_free(__ds_name, MAXNAMELEN + strlen(MOS_DIR_NAME) + 1); \
|
||||
kmem_free(__ds_name, ZFS_MAX_DATASET_NAME_LEN); \
|
||||
} \
|
||||
_NOTE(CONSTCOND) } while (0)
|
||||
#else
|
||||
|
||||
@@ -67,9 +67,13 @@ typedef enum dmu_objset_type {
|
||||
#define ZFS_TYPE_DATASET \
|
||||
(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
|
||||
|
||||
/*
|
||||
* All of these include the terminating NUL byte.
|
||||
*/
|
||||
#define ZAP_MAXNAMELEN 256
|
||||
#define ZAP_MAXVALUELEN (1024 * 8)
|
||||
#define ZAP_OLDMAXVALUELEN 1024
|
||||
#define ZFS_MAX_DATASET_NAME_LEN 256
|
||||
|
||||
/*
|
||||
* Dataset properties are identified by these constants and must be added to
|
||||
@@ -1019,7 +1023,7 @@ typedef enum zfs_ioc {
|
||||
/*
|
||||
* zvol ioctl to get dataset name
|
||||
*/
|
||||
#define BLKZNAME _IOR(0x12, 125, char[ZFS_MAXNAMELEN])
|
||||
#define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
|
||||
|
||||
/*
|
||||
* Internal SPA load state. Used by FMA diagnosis engine.
|
||||
|
||||
@@ -126,7 +126,7 @@ struct spa {
|
||||
/*
|
||||
* Fields protected by spa_namespace_lock.
|
||||
*/
|
||||
char spa_name[MAXNAMELEN]; /* pool name */
|
||||
char spa_name[ZFS_MAX_DATASET_NAME_LEN]; /* pool name */
|
||||
char *spa_comment; /* comment */
|
||||
avl_node_t spa_avl; /* node in spa_namespace_avl */
|
||||
nvlist_t *spa_config; /* last synced config */
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ typedef struct {
|
||||
boolean_t za_normalization_conflict;
|
||||
uint64_t za_num_integers;
|
||||
uint64_t za_first_integer; /* no sign extension for <8byte ints */
|
||||
char za_name[MAXNAMELEN];
|
||||
char za_name[ZAP_MAXNAMELEN];
|
||||
} zap_attribute_t;
|
||||
|
||||
/*
|
||||
|
||||
+1
-12
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_ZNODE_H
|
||||
@@ -138,17 +138,6 @@ extern "C" {
|
||||
#define ZFS_SHARES_DIR "SHARES"
|
||||
#define ZFS_SA_ATTRS "SA_ATTRS"
|
||||
|
||||
/*
|
||||
* Path component length
|
||||
*
|
||||
* The generic fs code uses MAXNAMELEN to represent
|
||||
* what the largest component length is. Unfortunately,
|
||||
* this length includes the terminating NULL. ZFS needs
|
||||
* to tell the users via pathconf() and statvfs() what the
|
||||
* true maximum length of a component is, excluding the NULL.
|
||||
*/
|
||||
#define ZFS_MAXNAMELEN (MAXNAMELEN - 1)
|
||||
|
||||
/*
|
||||
* Convert mode bits (zp_mode) to BSD-style DT_* values for storing in
|
||||
* the directory entries. On Linux systems this value is already
|
||||
|
||||
Reference in New Issue
Block a user