All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Dan Li <ashimida@linux.alibaba.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [kees:for-next/lkdtm 6/6] drivers/misc/lkdtm/cfi.c:62:37: warning: cast from pointer to integer of different size
Date: Mon, 18 Apr 2022 15:25:47 -0700	[thread overview]
Message-ID: <202204181515.FC6649DC81@keescook> (raw)
In-Reply-To: <202204170710.LwCV5Ec0-lkp@intel.com>

On Sun, Apr 17, 2022 at 07:26:33AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/lkdtm
> head:   2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
> commit: 2e53b877dc1258d4ac3de98f496bb88ec3bf5e25 [6/6] lkdtm: Add CFI_BACKWARD to test ROP mitigations
> config: sparc-randconfig-r026-20220417 (https://download.01.org/0day-ci/archive/20220417/202204170710.LwCV5Ec0-lkp@intel.com/config)
> compiler: sparc-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
>         git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
>         git fetch --no-tags kees for-next/lkdtm
>         git checkout 2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash drivers/misc/lkdtm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/misc/lkdtm/cfi.c: In function 'set_return_addr_unchecked':
> >> drivers/misc/lkdtm/cfi.c:62:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>       62 |         ((__force __typeof__(addr))((__force u64)(addr) | PAGE_OFFSET))
>          |                                     ^
>    drivers/misc/lkdtm/cfi.c:72:13: note: in expansion of macro 'no_pac_addr'
>       72 |         if (no_pac_addr(*ret_addr) == expected)
>          |             ^~~~~~~~~~~

Hmm. I don't see why this is warning. The macro looks like untagged_addr():

#define untagged_addr(addr)     ({ \
        u64 __addr = (__force u64)(addr); \
        __addr &= __untagged_addr(__addr); \
        (__force __typeof__(addr))__addr; \
})


-- 
Kees Cook

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: kbuild-all@lists.01.org
Subject: Re: [kees:for-next/lkdtm 6/6] drivers/misc/lkdtm/cfi.c:62:37: warning: cast from pointer to integer of different size
Date: Mon, 18 Apr 2022 15:25:47 -0700	[thread overview]
Message-ID: <202204181515.FC6649DC81@keescook> (raw)
In-Reply-To: <202204170710.LwCV5Ec0-lkp@intel.com>

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

On Sun, Apr 17, 2022 at 07:26:33AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/lkdtm
> head:   2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
> commit: 2e53b877dc1258d4ac3de98f496bb88ec3bf5e25 [6/6] lkdtm: Add CFI_BACKWARD to test ROP mitigations
> config: sparc-randconfig-r026-20220417 (https://download.01.org/0day-ci/archive/20220417/202204170710.LwCV5Ec0-lkp(a)intel.com/config)
> compiler: sparc-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
>         git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
>         git fetch --no-tags kees for-next/lkdtm
>         git checkout 2e53b877dc1258d4ac3de98f496bb88ec3bf5e25
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash drivers/misc/lkdtm/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/misc/lkdtm/cfi.c: In function 'set_return_addr_unchecked':
> >> drivers/misc/lkdtm/cfi.c:62:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>       62 |         ((__force __typeof__(addr))((__force u64)(addr) | PAGE_OFFSET))
>          |                                     ^
>    drivers/misc/lkdtm/cfi.c:72:13: note: in expansion of macro 'no_pac_addr'
>       72 |         if (no_pac_addr(*ret_addr) == expected)
>          |             ^~~~~~~~~~~

Hmm. I don't see why this is warning. The macro looks like untagged_addr():

#define untagged_addr(addr)     ({ \
        u64 __addr = (__force u64)(addr); \
        __addr &= __untagged_addr(__addr); \
        (__force __typeof__(addr))__addr; \
})


-- 
Kees Cook

  reply	other threads:[~2022-04-18 22:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 23:26 [kees:for-next/lkdtm 6/6] drivers/misc/lkdtm/cfi.c:62:37: warning: cast from pointer to integer of different size kernel test robot
2022-04-18 22:25 ` Kees Cook [this message]
2022-04-18 22:25   ` Kees Cook
2022-04-26 13:03   ` Geert Uytterhoeven
2022-04-26 13:03     ` Geert Uytterhoeven
2022-04-26 23:56     ` Kees Cook
2022-04-26 23:56       ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202204181515.FC6649DC81@keescook \
    --to=keescook@chromium.org \
    --cc=ashimida@linux.alibaba.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.