Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F97530184
D36717.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36717.diff
View Options
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -85,6 +85,7 @@
GPT_STATE_MISSING, /* No signature found. */
GPT_STATE_CORRUPT, /* Checksum mismatch. */
GPT_STATE_INVALID, /* Nonconformant/invalid. */
+ GPT_STATE_UNSUPPORTED, /* Not supported. */
GPT_STATE_OK /* Perfectly fine. */
};
@@ -148,6 +149,8 @@
{ 0, 0 }
};
+#define MAXENTSIZE 1024
+
static struct g_part_scheme g_part_gpt_scheme = {
"GPT",
g_part_gpt_methods,
@@ -548,6 +551,11 @@
if (hdr == NULL)
return (NULL);
+ if (hdr->hdr_entries > g_part_gpt_scheme.gps_maxent ||
+ hdr->hdr_entsz > MAXENTSIZE) {
+ table->state[elt] = GPT_STATE_UNSUPPORTED;
+ return (NULL);
+ }
pp = cp->provider;
table->lba[elt] = hdr->hdr_lba_table;
@@ -961,10 +969,25 @@
/* Fail if we haven't got any good tables at all. */
if (table->state[GPT_ELT_PRITBL] != GPT_STATE_OK &&
table->state[GPT_ELT_SECTBL] != GPT_STATE_OK) {
- printf("GEOM: %s: corrupt or invalid GPT detected.\n",
- pp->name);
- printf("GEOM: %s: GPT rejected -- may not be recoverable.\n",
- pp->name);
+ if (table->state[GPT_ELT_PRITBL] == GPT_STATE_UNSUPPORTED &&
+ table->state[GPT_ELT_SECTBL] == GPT_STATE_UNSUPPORTED &&
+ gpt_matched_hdrs(prihdr, sechdr)) {
+ printf("GEOM: %s: unsupported GPT detected.\n",
+ pp->name);
+ printf(
+ "GEOM: %s: number of GPT entries: %u, entry size: %uB.\n",
+ pp->name, prihdr->hdr_entries, prihdr->hdr_entsz);
+ printf(
+ "GEOM: %s: maximum supported number of GPT entries: %u, entry size: %uB.\n",
+ pp->name, g_part_gpt_scheme.gps_maxent, MAXENTSIZE);
+ printf("GEOM: %s: GPT rejected.\n", pp->name);
+ } else {
+ printf("GEOM: %s: corrupt or invalid GPT detected.\n",
+ pp->name);
+ printf(
+ "GEOM: %s: GPT rejected -- may not be recoverable.\n",
+ pp->name);
+ }
if (prihdr != NULL)
g_free(prihdr);
if (pritbl != NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 30, 10:24 PM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13208756
Default Alt Text
D36717.diff (1 KB)
Attached To
Mode
D36717: geom_part: Check number of GPT entries and size of GPT entry
Attached
Detach File
Event Timeline
Log In to Comment