Linux Security Modules development
 help / color / mirror / Atom feed
* Tomoyo build warnings
@ 2019-05-08 22:54 James Morris
  2019-05-09  3:56 ` Tetsuo Handa
  0 siblings, 1 reply; 2+ messages in thread
From: James Morris @ 2019-05-08 22:54 UTC (permalink / raw)
  To: Tetsuo Handa; +Cc: linux-security-module

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

I'm seeing these during a kernel build in my tree:

In file included from security/tomoyo/util.c:11:
security/tomoyo/common.h: In function ‘tomoyo_put_name’:
security/tomoyo/common.h:1183:14: warning: taking address of packed member 
of ‘struct tomoyo_shared_acl_head’ may result in an unaligned pointer 
value [-Waddress-of-packed-member]
 1183 |   atomic_dec(&ptr->head.users);
      |              ^~~~~~~~~~~~~~~~
security/tomoyo/common.h: In function ‘tomoyo_put_condition’:
security/tomoyo/common.h:1197:14: warning: taking address of packed member 
of ‘struct tomoyo_shared_acl_head’ may result in an unaligned pointer 
value [-Waddress-of-packed-member]
 1197 |   atomic_dec(&cond->head.users);
      |              ^~~~~~~~~~~~~~~~~
security/tomoyo/common.h: In function ‘tomoyo_put_group’:
security/tomoyo/common.h:1210:14: warning: taking address of packed member 
of ‘struct tomoyo_shared_acl_head’ may result in an unaligned pointer 
value [-Waddress-of-packed-member]
 1210 |   atomic_dec(&group->head.users);
      |              ^~~~~~~~~~~~~~~~~~
  AR      security/tomoyo/built-in.a
  AR      security/built-in.a
  Building modules, stage 2.


Please check.


-- 
James Morris
<jmorris@namei.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tomoyo build warnings
  2019-05-08 22:54 Tomoyo build warnings James Morris
@ 2019-05-09  3:56 ` Tetsuo Handa
  0 siblings, 0 replies; 2+ messages in thread
From: Tetsuo Handa @ 2019-05-09  3:56 UTC (permalink / raw)
  To: James Morris; +Cc: linux-security-module

On 2019/05/09 7:54, James Morris wrote:
> I'm seeing these during a kernel build in my tree:

Well, it seems that clang-4 and gcc-9 got this new warning, and
Linus Torvalds recently silenced this warning...

  commit 6f303d60534c46aa1a239f29c321f95c83dda748
  Author: Linus Torvalds <torvalds@linux-foundation.org>
  Date:   Wed May 1 11:05:41 2019 -0700

      gcc-9: silence 'address-of-packed-member' warning

      We already did this for clang, but now gcc has that warning too.  Yes,
      yes, the address may be unaligned.  And that's kind of the point.

      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Since "struct list_head" consists of aligned two pointers, I wonder
how a member next to "struct list_head" can fail to be aligned...

  struct tomoyo_shared_acl_head {
      struct list_head list;
      atomic_t users;
  } __packed;

But since this structure is not visible from userspace, I can accept
dropping __packed and wasting a few bytes if that commit doesn't go upstream.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-09  3:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-08 22:54 Tomoyo build warnings James Morris
2019-05-09  3:56 ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox