Skip to contentSkip to conversation

part_efi: fix protective_mbr struct allocation

PATCH New Hector Palacios 7 participants 21 messages Feb 12, 2014 – Feb 19, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

The calloc() call was allocating space for the sizeof the struct pointer rather than for the struct contents.

---
 disk/part_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +1 -1
index 5dfaf490c89a..7fabec059d7a 100644
@@ -232,7 +232,7 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc)
 	legacy_mbr *p_mbr;
 
 	/* Setup the Protective MBR */
-	p_mbr = calloc(1, sizeof(p_mbr));
+	p_mbr = calloc(1, sizeof(legacy_mbr));
 	if (p_mbr == NULL) {
 		printf("%s: calloc failed!\n", __func__);
 		return -1;
#1 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Quoted 13 lines · Hector Palacios

The calloc() call was allocating space for the sizeof the struct pointer rather than for the struct contents.

---
 disk/part_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +0 -0
index 5dfaf490c89a..7fabec059d7a 100644

disk/part_efi.c static int set_protective_mbr(block_dev_desc_t *dev_desc) · line 235

Quoted 5 lines
disk/part_efi.c +1 -1
@@ -232,7 +232,7 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc)
        legacy_mbr *p_mbr;
 
        /* Setup the Protective MBR */
-       p_mbr = calloc(1, sizeof(p_mbr));
+       p_mbr = calloc(1, sizeof(legacy_mbr));

What about:

p_mbr = calloc(1, sizeof(*p_mbr)) ?

Regards,

Fabio Estevam

#2 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Fabio,

Quoted 17 lines · Fabio Estevam
Quoted 15 lines · Hector Palacios

The calloc() call was allocating space for the sizeof the struct pointer rather than for the struct contents.

---
 disk/part_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +0 -0
index 5dfaf490c89a..7fabec059d7a 100644
@@ -232,7 +232,7 @@ static int set_protective_mbr(block_dev_desc_t *dev_desc)
        legacy_mbr *p_mbr;
 
Quoted 7 lines

disk/part_efi.c static int set_protective_mbr(block_dev_desc_t *dev_desc) · line 235

Quoted 3 lines
disk/part_efi.c +1 -1
        /* Setup the Protective MBR */
-       p_mbr = calloc(1, sizeof(p_mbr));
+       p_mbr = calloc(1, sizeof(legacy_mbr));

What about:

p_mbr = calloc(1, sizeof(*p_mbr)) ?

I don't like the idea of setting p_mbr based on *p_mbr at a time where p_mbr is still undefined. I know that from a C standard perspective this is ok, but I'd rather simply not run any risk and pass sizeof the struct type, not a (non-existent) dereferenced 'value'.

Quoted 3 lines

Regards,

Fabio Estevam

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Albert,

Quoted 8 lines · Albert ARIBAUD
Quoted 3 lines

What about:

p_mbr = calloc(1, sizeof(*p_mbr)) ?

I don't like the idea of setting p_mbr based on *p_mbr at a time where p_mbr is still undefined. I know that from a C standard perspective this is ok, but I'd rather simply not run any risk and pass sizeof the struct type, not a (non-existent) dereferenced 'value'.

At least in kernel this is the preferred way.

According to Documentation/CodingStyle:

"Chapter 14: Allocating memory

The preferred form for passing a size of a struct is the following:

    p = kmalloc(sizeof(*p), ...);

The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not."

Regards,

Fabio Estevam

#4 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Fabio,

Quoted 20 lines · Fabio Estevam

Hi Albert,

Quoted 8 lines · Albert ARIBAUD
Quoted 3 lines

What about:

p_mbr = calloc(1, sizeof(*p_mbr)) ?

I don't like the idea of setting p_mbr based on *p_mbr at a time where p_mbr is still undefined. I know that from a C standard perspective this is ok, but I'd rather simply not run any risk and pass sizeof the struct type, not a (non-existent) dereferenced 'value'.

At least in kernel this is the preferred way.

According to Documentation/CodingStyle:

"Chapter 14: Allocating memory

Quoted 7 lines

The preferred form for passing a size of a struct is the following:

    p = kmalloc(sizeof(*p), ...);

The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not."

I still don't like it, but it makes sense indeed.

Quoted 3 lines

Regards,

Fabio Estevam

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

In reply to Hector Palacios

Hi Hector,

Quoted 13 lines

The calloc() call was allocating space for the sizeof the struct pointer rather than for the struct contents.

---
 disk/part_efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +0 -0
index 5dfaf490c89a..7fabec059d7a 100644

disk/part_efi.c static int set_protective_mbr(block_dev_desc_t · line 235

Quoted 5 lines
disk/part_efi.c +1 -1
@@ -232,7 +232,7 @@ static int set_protective_mbr(block_dev_desc_t
 *dev_desc) legacy_mbr *p_mbr;
 
 	/* Setup the Protective MBR */
-	p_mbr = calloc(1, sizeof(p_mbr));
+	p_mbr = calloc(1, sizeof(legacy_mbr));

Thanks for spotting the error. _Damn_

However, this is not enough.

Since this buffer is passed to mmc for writing (and some targets may use cache) the legacy_mbr shall be defined as:

ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, p_mbr, sizeof(legacy_mbr)); memset(p_mbr, 0, sizeof(legacy_mbr));

Would you like to prepare v2 of this patch or shall I prepare the fix?

Quoted 3 lines
disk/part_efi.c +0 -0
 	if (p_mbr == NULL) {
 		printf("%s: calloc failed!\n", __func__);
 		return -1;
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#6 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Lukasz,

Quoted 23 lines · Lukasz Majewski

Hi Hector,

Quoted 13 lines

The calloc() call was allocating space for the sizeof the struct pointer rather than for the struct contents.

---
  disk/part_efi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +0 -0
index 5dfaf490c89a..7fabec059d7a 100644

disk/part_efi.c static int set_protective_mbr(block_dev_desc_t · line 235

Quoted 5 lines
disk/part_efi.c +1 -1
@@ -232,7 +232,7 @@ static int set_protective_mbr(block_dev_desc_t
 *dev_desc) legacy_mbr *p_mbr;
 
  	/* Setup the Protective MBR */
-	p_mbr = calloc(1, sizeof(p_mbr));
+	p_mbr = calloc(1, sizeof(legacy_mbr));

Thanks for spotting the error. _Damn_

Quoted 7 lines

However, this is not enough.

Since this buffer is passed to mmc for writing (and some targets may use cache) the legacy_mbr shall be defined as:

ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, p_mbr, sizeof(legacy_mbr)); memset(p_mbr, 0, sizeof(legacy_mbr));

Unfortunately this is causing unaligned access in my i.MX6.
I'm specifically passing the -mno-unaligned-access when building this file so I guess it has to do with the macro and the packed structure.

Quoted 9 lines

Would you like to prepare v2 of this patch or shall I prepare the fix?

Quoted 3 lines
disk/part_efi.c +0 -0
  	if (p_mbr == NULL) {
  		printf("%s: calloc failed!\n", __func__);
  		return -1;
#7 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Hector,

Quoted 3 lines · Hector

Unfortunately this is causing unaligned access in my i.MX6.
I'm specifically passing the -mno-unaligned-access when building this file so I guess it has to do with the macro and the packed structure.

I don't think this is due to packed structures, because -mno-unaligned-access tells the compiler that unaligned fields in packed structures should be accesses by breaking the unaligned access into smaller aligned ones, so this would not cause an alignment abort.

What can cause an alignment abort despite -mno-unaligned-access is dereferencing a badly aligned pointer, and this is probably what happens here.

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Albert,

Quoted 9 lines · Albert ARIBAUD

Hi Hector,

Quoted 3 lines · Hector

Unfortunately this is causing unaligned access in my i.MX6.
I'm specifically passing the -mno-unaligned-access when building this file so I guess it has to do with the macro and the packed structure.

Quoted 8 lines

I don't think this is due to packed structures, because -mno-unaligned-access tells the compiler that unaligned fields in packed structures should be accesses by breaking the unaligned access into smaller aligned ones, so this would not cause an alignment abort.

What can cause an alignment abort despite -mno-unaligned-access is dereferencing a badly aligned pointer, and this is probably what happens here.

Oh, the macro ALLOC_CACHE_ALIGN_BUFFER is returning a correctly aligned value for the
pointer: 0x4FD33BA0
The problem is we don't have to free() the pointer anymore at the end of the function.

I'll repost the patch

Signature · 1 line
H?ctor Palacios
#9 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Hector,

Quoted 23 lines

Hi Albert,

Quoted 16 lines · Albert ARIBAUD

Hi Hector,

Quoted 4 lines · Hector

Unfortunately this is causing unaligned access in my i.MX6. I'm specifically passing the -mno-unaligned-access when building this file so I guess it has to do with the macro and the packed structure.

I don't think this is due to packed structures, because -mno-unaligned-access tells the compiler that unaligned fields in packed structures should be accesses by breaking the unaligned access into smaller aligned ones, so this would not cause an alignment abort.

Quoted 3 lines

What can cause an alignment abort despite -mno-unaligned-access is dereferencing a badly aligned pointer, and this is probably what happens here.

Quoted 6 lines

Oh, the macro ALLOC_CACHE_ALIGN_BUFFER is returning a correctly aligned value for the pointer: 0x4FD33BA0
The problem is we don't have to free() the pointer anymore at the end of the function.

I'll repost the patch

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Best regards,
Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140212/3b2b8e7f/attachment.pgp>

#10 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Lukasz,

Quoted 11 lines · Lukasz Majewski

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Neither V1 nor V2 have disappeared from patchwork. A "filter" on the subject, selecting "any" state and "both" archived and non-archived patches will return both:

V1: http://patchwork.ozlabs.org/patch/282753/ (New)
V2: http://patchwork.ozlabs.org/patch/314717/ (Deferred)

(I think that the patchwork web interface does not make it possible at all to remove a patch anyway)

Quoted 6 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 2 lines

Best regards,
Lukasz Majewski

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Albert, Tom

Quoted 21 lines

Hi Lukasz,

Quoted 11 lines · Lukasz Majewski

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Neither V1 nor V2 have disappeared from patchwork. A "filter" on the subject, selecting "any" state and "both" archived and non-archived patches will return both:

Quoted 5 lines

V1: http://patchwork.ozlabs.org/patch/282753/ (New)
V2: http://patchwork.ozlabs.org/patch/314717/ (Deferred)

(I think that the patchwork web interface does not make it possible at all to remove a patch anyway)

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 10 lines
Quoted 7 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Quoted 5 lines
Quoted 3 lines

Best regards,
Lukasz Majewski

Amicalement,

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#12 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Lukasz,

Quoted 39 lines · Lukasz Majewski

Hi Albert, Tom

Quoted 21 lines

Hi Lukasz,

Quoted 11 lines · Lukasz Majewski

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Neither V1 nor V2 have disappeared from patchwork. A "filter" on the subject, selecting "any" state and "both" archived and non-archived patches will return both:

Quoted 5 lines

V1: http://patchwork.ozlabs.org/patch/282753/ (New)
V2: http://patchwork.ozlabs.org/patch/314717/ (Deferred)

(I think that the patchwork web interface does not make it possible at all to remove a patch anyway)

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 8 lines
Quoted 7 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Quoted 8 lines
Quoted 2 lines

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Amicalement,

Signature · 1 line
Albert.
#13 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 13 lines
Quoted 13 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 10 lines
Quoted 7 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

Amicalement,

Signature · 1 line
Albert.
#14 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Quoted 23 lines · Albert ARIBAUD

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 13 lines
Quoted 13 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 10 lines
Quoted 7 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Quoted 7 lines

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

I tested Piotr's patch on i.MX6 (armv7) custom board and it is working fine without the -mno-unaligned-access flag.

Signature · 1 line
H?ctor Palacios
#15 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Hector,

Quoted 32 lines · Hector
Quoted 23 lines · Albert ARIBAUD

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 13 lines
Quoted 13 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 10 lines
Quoted 7 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Quoted 7 lines

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

Quoted 4 lines

I tested Piotr's patch on i.MX6 (armv7) custom board and it is working fine without the -mno-unaligned-access flag.

You've just Tested-By-ed your own patch, I think.

... but I am the one to blame, and should not have discussed Piotr's patch in this thread.

Amicalement,

Signature · 1 line
Albert.
#16 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Albert,

Quoted 40 lines

Hi Hector,

Quoted 35 lines · Hector
Quoted 33 lines · Albert ARIBAUD

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 15 lines
Quoted 15 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 12 lines
Quoted 8 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

Quoted 6 lines
Quoted 4 lines

I tested Piotr's patch on i.MX6 (armv7) custom board and it is working fine without the -mno-unaligned-access flag.

You've just Tested-By-ed your own patch, I think.

Nope.

Patch prepared by Piotr is orthogonal to the one prepared by Hector.

Hector has spotted other mistake at GPT code (made by me). Fix for it has been posted a few days ago:

http://patchwork.ozlabs.org/patch/319914/

Quoted 5 lines

... but I am the one to blame, and should not have discussed Piotr's patch in this thread.

Amicalement,

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#17 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Lukasz,

Quoted 49 lines · Lukasz Majewski

Hi Albert,

Quoted 40 lines

Hi Hector,

Quoted 35 lines · Hector
Quoted 33 lines · Albert ARIBAUD

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 15 lines
Quoted 15 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 12 lines
Quoted 8 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

Quoted 6 lines
Quoted 4 lines

I tested Piotr's patch on i.MX6 (armv7) custom board and it is working fine without the -mno-unaligned-access flag.

You've just Tested-By-ed your own patch, I think.

Quoted 8 lines

Nope.

Patch prepared by Piotr is orthogonal to the one prepared by Hector.

Hector has spotted other mistake at GPT code (made by me). Fix for it has been posted a few days ago:

http://patchwork.ozlabs.org/patch/319914/

I did not comment on the relationship between patches, I only commented on the fact that Hector said he has tested Piotr's patch but sent his Tested-by on his own patch thread, not on Piotr's. To verify this, look up

http://patchwork.ozlabs.org/patch/319649/

... which is Hector's patchwork entry and has his own Tested-by, and

http://patchwork.ozlabs.org/patch/314717/

... which is Piotr's patch and does not have Hector's (or anyone's) Tested-by.

Amicalement,

Signature · 1 line
Albert.
#18 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Albert,

Quoted 69 lines

Hi Lukasz,

Quoted 50 lines · Lukasz Majewski

Hi Albert,

Quoted 41 lines

Hi Hector,

Quoted 36 lines · Hector
Quoted 34 lines · Albert ARIBAUD

On Wed, 19 Feb 2014 11:08:03 +0100, Albert ARIBAUD

Quoted 16 lines
Quoted 16 lines

Thanks for pointing out. Now it is perfectly visible :-)

Quoted 13 lines
Quoted 9 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Quoted 7 lines
Quoted 5 lines

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Does not seem to be, so I will apply V2.

Correction: I would like it to be applied as per current ARM alignment policy, but this patch is not ARM per se and is in Tom's hands.

Tom, can you apply http://patchwork.ozlabs.org/patch/314717/ ? This would by no means close the discussion I opened, and in the event of a policy change, the patch could always be reverted; meanwhile, it matches our current policy.

Quoted 6 lines
Quoted 4 lines

I tested Piotr's patch on i.MX6 (armv7) custom board and it is working fine without the -mno-unaligned-access flag.

You've just Tested-By-ed your own patch, I think.

Quoted 8 lines

Nope.

Patch prepared by Piotr is orthogonal to the one prepared by Hector.

Hector has spotted other mistake at GPT code (made by me). Fix for it has been posted a few days ago:

http://patchwork.ozlabs.org/patch/319914/

I did not comment on the relationship between patches, I only commented on the fact that Hector said he has tested Piotr's patch but sent his Tested-by on his own patch thread, not on Piotr's. To verify this, look up

Quoted 8 lines

http://patchwork.ozlabs.org/patch/319649/

... which is Hector's patchwork entry and has his own Tested-by, and

http://patchwork.ozlabs.org/patch/314717/

... which is Piotr's patch and does not have Hector's (or anyone's) Tested-by.

Hmm. I've misunderstood you a bit.

Anyway thanks for clarification :-).

Quoted 2 lines

Amicalement,

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#19 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

In reply to Lukasz Majewski
Quoted 23 lines · Lukasz Majewski

Hi Albert, Tom

Quoted 21 lines

Hi Lukasz,

Quoted 11 lines · Lukasz Majewski

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Neither V1 nor V2 have disappeared from patchwork. A "filter" on the subject, selecting "any" state and "both" archived and non-archived patches will return both:

Quoted 7 lines
Quoted 5 lines

V1: http://patchwork.ozlabs.org/patch/282753/ (New)
V2: http://patchwork.ozlabs.org/patch/314717/ (Deferred)

(I think that the patchwork web interface does not make it possible at all to remove a patch anyway)

Thanks for pointing out. Now it is perfectly visible :-)

I've also un-deferred, for now, the patch as well.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Quoted 8 lines
Quoted 2 lines

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Any comments?

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Can you give me some steps on how to hit this bug? I believe it's a bug and I believe we need to fix it, I just want to investigate a few things while we've got a trigger case right now. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140219/bc247027/attachment.pgp>
#20 lore raw

PATCH 1/1 part_efi: fix protective_mbr struct allocation

Hi Tom,

Quoted 46 lines · Lukasz Majewski
Quoted 23 lines

Hi Albert, Tom

Quoted 21 lines

Hi Lukasz,

Quoted 11 lines · Lukasz Majewski

I think, that the patch for fixing the unaligned access in this function has already been posted by Piotr Wilczek. We have experienced similar issues with Samsung's Exynos4 based targets.

[PATCH V2] disk:efi: avoid unaligned access on efi partition

Despite its disappearance from patchwork it shall be available at mailing list archive.

The v1 can be found at the following link:
http://patchwork.ozlabs.org/patch/282753/

Neither V1 nor V2 have disappeared from patchwork. A "filter" on the subject, selecting "any" state and "both" archived and non-archived patches will return both:

Quoted 7 lines
Quoted 5 lines

V1: http://patchwork.ozlabs.org/patch/282753/ (New)
V2: http://patchwork.ozlabs.org/patch/314717/ (Deferred)

(I think that the patchwork web interface does not make it possible at all to remove a patch anyway)

Thanks for pointing out. Now it is perfectly visible :-)

I've also un-deferred, for now, the patch as well.

Quoted 12 lines
Quoted 9 lines
Quoted 6 lines

Inclusion of v2 has been postponed since there was a discussion if we shall allow unaligned access (-mno-unaligned-access flag) at armv7 (after patches posted by Tom).

As fair as I can tell, we will keep the current approach so, I think that Tom will be willing to pull this patch (v2) now.

Agreed, but then we should make sure no one has comments on V2 that they might have withheld due to the initial rejection of V2.

Any comments?

Quoted 7 lines
Quoted 3 lines

This patch do fix unaligned access problem on Trats2 (Exynos4412), when we restore/create GPT, so I would like to know if there are any new inquires regarding this patch.

Can you give me some steps on how to hit this bug? I believe it's a bug and I believe we need to fix it, I just want to investigate a few things while we've got a trigger case right now. Thanks!

The easiest way is to type:

gpt write mmc 0 $partitions

before that you shall define several uuid's.

For reference please look into the Trats2/Trats code and ./doc/README.gpt

As a side note - I'm using following toolchain:
CROSS_COMPILE=/opt/eldk-5.4/armv7a/sysroots/i686-eldk-linux/usr/bin/armv7a-vfp-neon-linux-gnueabi/arm-linux-gnueabi-

It is 4.7.2 from denx.de.

Quoted 1 line
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group